tree-wide: use uuid.MustParse() when possible

According to the new guidelines in docs/errors.md.
This commit is contained in:
Lars Karlitski 2020-03-24 23:18:33 +01:00
parent 9625c589b0
commit ad1a12f7aa
6 changed files with 12 additions and 42 deletions

View file

@ -617,10 +617,7 @@ func (r *fedora30ImageType) fsTabStageOptions(uefi bool) *osbuild.FSTabStageOpti
}
func (r *fedora30ImageType) grub2StageOptions(kernelOptions string, kernel *blueprint.KernelCustomization, uefi bool) *osbuild.GRUB2StageOptions {
id, err := uuid.Parse("76a22bf4-f153-4541-b6c7-0332c0dfaeac")
if err != nil {
panic("invalid UUID")
}
id := uuid.MustParse("76a22bf4-f153-4541-b6c7-0332c0dfaeac")
if kernel != nil {
kernelOptions += " " + kernel.Append
@ -711,10 +708,7 @@ func (r *Fedora30) tarAssembler(filename, compression string) *osbuild.Assembler
}
func (r *Fedora30) rawFSAssembler(filename string, size uint64) *osbuild.Assembler {
id, err := uuid.Parse("76a22bf4-f153-4541-b6c7-0332c0dfaeac")
if err != nil {
panic("invalid UUID")
}
id := uuid.MustParse("76a22bf4-f153-4541-b6c7-0332c0dfaeac")
return osbuild.NewRawFSAssembler(
&osbuild.RawFSAssemblerOptions{
Filename: filename,

View file

@ -617,10 +617,7 @@ func (r *fedora31ImageType) fsTabStageOptions(uefi bool) *osbuild.FSTabStageOpti
}
func (r *fedora31ImageType) grub2StageOptions(kernelOptions string, kernel *blueprint.KernelCustomization, uefi bool) *osbuild.GRUB2StageOptions {
id, err := uuid.Parse("76a22bf4-f153-4541-b6c7-0332c0dfaeac")
if err != nil {
panic("invalid UUID")
}
id := uuid.MustParse("76a22bf4-f153-4541-b6c7-0332c0dfaeac")
if kernel != nil {
kernelOptions += " " + kernel.Append
@ -711,10 +708,7 @@ func (r *Fedora31) tarAssembler(filename, compression string) *osbuild.Assembler
}
func (r *Fedora31) rawFSAssembler(filename string, size uint64) *osbuild.Assembler {
id, err := uuid.Parse("76a22bf4-f153-4541-b6c7-0332c0dfaeac")
if err != nil {
panic("invalid UUID")
}
id := uuid.MustParse("76a22bf4-f153-4541-b6c7-0332c0dfaeac")
return osbuild.NewRawFSAssembler(
&osbuild.RawFSAssemblerOptions{
Filename: filename,

View file

@ -617,10 +617,7 @@ func (r *fedora32ImageType) fsTabStageOptions(uefi bool) *osbuild.FSTabStageOpti
}
func (r *fedora32ImageType) grub2StageOptions(kernelOptions string, kernel *blueprint.KernelCustomization, uefi bool) *osbuild.GRUB2StageOptions {
id, err := uuid.Parse("76a22bf4-f153-4541-b6c7-0332c0dfaeac")
if err != nil {
panic("invalid UUID")
}
id := uuid.MustParse("76a22bf4-f153-4541-b6c7-0332c0dfaeac")
if kernel != nil {
kernelOptions += " " + kernel.Append
@ -711,10 +708,7 @@ func (r *Fedora32) tarAssembler(filename, compression string) *osbuild.Assembler
}
func (r *Fedora32) rawFSAssembler(filename string, size uint64) *osbuild.Assembler {
id, err := uuid.Parse("76a22bf4-f153-4541-b6c7-0332c0dfaeac")
if err != nil {
panic("invalid UUID")
}
id := uuid.MustParse("76a22bf4-f153-4541-b6c7-0332c0dfaeac")
return osbuild.NewRawFSAssembler(
&osbuild.RawFSAssemblerOptions{
Filename: filename,

View file

@ -762,10 +762,7 @@ func (r *rhel81ImageType) fsTabStageOptions(uefi bool) *osbuild.FSTabStageOption
}
func (r *rhel81ImageType) grub2StageOptions(kernelOptions string, uefi bool) *osbuild.GRUB2StageOptions {
id, err := uuid.Parse("0bd700f8-090f-4556-b797-b340297ea1bd")
if err != nil {
panic("invalid UUID")
}
id := uuid.MustParse("0bd700f8-090f-4556-b797-b340297ea1bd")
var uefiOptions *osbuild.GRUB2UEFI
if uefi {
@ -852,10 +849,7 @@ func (r *RHEL81) tarAssembler(filename, compression string) *osbuild.Assembler {
}
func (r *RHEL81) rawFSAssembler(filename string, size uint64) *osbuild.Assembler {
id, err := uuid.Parse("0bd700f8-090f-4556-b797-b340297ea1bd")
if err != nil {
panic("invalid UUID")
}
id := uuid.MustParse("0bd700f8-090f-4556-b797-b340297ea1bd")
return osbuild.NewRawFSAssembler(
&osbuild.RawFSAssemblerOptions{
Filename: filename,

View file

@ -789,10 +789,7 @@ func (r *rhel82ImageType) fsTabStageOptions(uefi bool) *osbuild.FSTabStageOption
}
func (r *rhel82ImageType) grub2StageOptions(kernelOptions string, uefi bool) *osbuild.GRUB2StageOptions {
id, err := uuid.Parse("0bd700f8-090f-4556-b797-b340297ea1bd")
if err != nil {
panic("invalid UUID")
}
id := uuid.MustParse("0bd700f8-090f-4556-b797-b340297ea1bd")
var uefiOptions *osbuild.GRUB2UEFI
if uefi {
@ -879,10 +876,7 @@ func (r *RHEL82) tarAssembler(filename, compression string) *osbuild.Assembler {
}
func (r *RHEL82) rawFSAssembler(filename string, size uint64) *osbuild.Assembler {
id, err := uuid.Parse("0bd700f8-090f-4556-b797-b340297ea1bd")
if err != nil {
panic("invalid UUID")
}
id := uuid.MustParse("0bd700f8-090f-4556-b797-b340297ea1bd")
return osbuild.NewRawFSAssembler(
&osbuild.RawFSAssemblerOptions{
Filename: filename,

View file

@ -39,7 +39,7 @@ func TestBasic(t *testing.T) {
}
func TestCreate(t *testing.T) {
id, _ := uuid.Parse("ffffffff-ffff-ffff-ffff-ffffffffffff")
id := uuid.MustParse("ffffffff-ffff-ffff-ffff-ffffffffffff")
distroStruct := fedoratest.New()
arch, err := distroStruct.GetArch("x86_64")
if err != nil {
@ -62,7 +62,7 @@ func TestCreate(t *testing.T) {
}
func testUpdateTransition(t *testing.T, from, to string, expectedStatus int, expectedResponse string) {
id, _ := uuid.Parse("ffffffff-ffff-ffff-ffff-ffffffffffff")
id := uuid.MustParse("ffffffff-ffff-ffff-ffff-ffffffffffff")
distroStruct := fedoratest.New()
arch, err := distroStruct.GetArch("x86_64")
if err != nil {