Update linter for golang v1.25 compatibility
Signed-off-by: Jonathon Anderson <janderson@ciq.com>
This commit is contained in:
committed by
Christian Goll
parent
019408d076
commit
081d2ec61e
@@ -179,7 +179,7 @@ func (config *NodesYaml) MergeNode(id string) (node Node, fields fieldMap, err e
|
||||
node.setIds(id)
|
||||
node.valid = true
|
||||
node.updatePrimaryNetDev()
|
||||
node.Profile.cleanLists()
|
||||
node.cleanLists()
|
||||
return node, fields, nil
|
||||
}
|
||||
|
||||
|
||||
@@ -113,7 +113,7 @@ func (config *NodesYaml) Persist() error {
|
||||
return config.PersistToFile(warewulfconf.Get().Paths.NodesConf())
|
||||
}
|
||||
|
||||
func (config *NodesYaml) PersistToFile(configFile string) error {
|
||||
func (config *NodesYaml) PersistToFile(configFile string) (err error) {
|
||||
if configFile == "" {
|
||||
configFile = warewulfconf.Get().Paths.NodesConf()
|
||||
}
|
||||
@@ -127,7 +127,11 @@ func (config *NodesYaml) PersistToFile(configFile string) error {
|
||||
wwlog.Error("%s", err)
|
||||
return err
|
||||
}
|
||||
defer file.Close()
|
||||
defer func() {
|
||||
if cerr := file.Close(); cerr != nil && err == nil {
|
||||
err = cerr
|
||||
}
|
||||
}()
|
||||
_, err = file.WriteString(string(out))
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -83,7 +83,7 @@ func Test_nodeYaml_FindByHwaddr(t *testing.T) {
|
||||
t.Errorf("FindByHwaddr() error = %v, wantErr %v", err, tt.wantErr)
|
||||
return
|
||||
}
|
||||
if !(got.id == tt.want) {
|
||||
if got.id != tt.want {
|
||||
t.Errorf("FindByHwaddr() got = %v, want %v", got, tt.want)
|
||||
}
|
||||
})
|
||||
@@ -121,7 +121,7 @@ func Test_nodeYaml_FindByIpaddr(t *testing.T) {
|
||||
t.Errorf("FindByIpaddr() error = %v, wantErr %v", err, tt.wantErr)
|
||||
return
|
||||
}
|
||||
if !(got.id == tt.want) {
|
||||
if got.id != tt.want {
|
||||
t.Errorf("FindByHwaddr() got = %v, want %v", got, tt.want)
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user