distro: the distro constructors cannot fail
Simplify the code by dropping the potential error return. The constructor simply instantiates some maps, this cannot fail. Signed-off-by: Tom Gundersen <teg@jklm.no>
This commit is contained in:
parent
1345ca77fd
commit
08ff8ab81b
11 changed files with 24 additions and 73 deletions
|
|
@ -44,7 +44,7 @@ type output struct {
|
|||
const Distro = common.Fedora32
|
||||
const ModulePlatformID = "platform:f32"
|
||||
|
||||
func New() (*Fedora32, error) {
|
||||
func New() *Fedora32 {
|
||||
const GigaByte = 1024 * 1024 * 1024
|
||||
|
||||
r := Fedora32{
|
||||
|
|
@ -286,7 +286,7 @@ func New() (*Fedora32, error) {
|
|||
},
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
return &r
|
||||
}
|
||||
|
||||
func (r *Fedora32) Name() string {
|
||||
|
|
|
|||
|
|
@ -19,10 +19,7 @@ func TestListOutputFormats(t *testing.T) {
|
|||
"vmdk",
|
||||
}
|
||||
|
||||
f32, err := fedora32.New()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
f32 := fedora32.New()
|
||||
|
||||
if got := f32.ListOutputFormats(); !reflect.DeepEqual(got, want) {
|
||||
t.Errorf("ListOutputFormats() = %v, want %v", got, want)
|
||||
|
|
@ -96,10 +93,8 @@ func TestFilenameFromType(t *testing.T) {
|
|||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
f32, err := fedora32.New()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
f32 := fedora32.New()
|
||||
|
||||
got, got1, err := f32.FilenameFromType(tt.args.outputFormat)
|
||||
if (err != nil) != tt.wantErr {
|
||||
t.Errorf("FilenameFromType() error = %v, wantErr %v", err, tt.wantErr)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue