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.Fedora31
|
||||
const ModulePlatformID = "platform:f31"
|
||||
|
||||
func New() (*Fedora31, error) {
|
||||
func New() *Fedora31 {
|
||||
const GigaByte = 1024 * 1024 * 1024
|
||||
|
||||
r := Fedora31{
|
||||
|
|
@ -286,7 +286,7 @@ func New() (*Fedora31, error) {
|
|||
},
|
||||
}
|
||||
|
||||
return &r, nil
|
||||
return &r
|
||||
}
|
||||
|
||||
func (r *Fedora31) Name() string {
|
||||
|
|
|
|||
|
|
@ -19,10 +19,7 @@ func TestListOutputFormats(t *testing.T) {
|
|||
"vmdk",
|
||||
}
|
||||
|
||||
f31, err := fedora31.New()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
f31 := fedora31.New()
|
||||
|
||||
if got := f31.ListOutputFormats(); !reflect.DeepEqual(got, want) {
|
||||
t.Errorf("ListOutputFormats() = %v, want %v", got, want)
|
||||
|
|
@ -96,10 +93,7 @@ func TestFilenameFromType(t *testing.T) {
|
|||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
f31, err := fedora31.New()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
f31 := fedora31.New()
|
||||
got, got1, err := f31.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