From 6a8f9dbcd317129fb0b450fec9db669e9b2c1cf7 Mon Sep 17 00:00:00 2001 From: youngifif Date: Tue, 4 Jun 2024 00:54:30 +0800 Subject: [PATCH] fix_return_err_shadowing_by_nil Signed-off-by: youngifif --- netboot/netconf.go | 2 +- netboot/netconf_integ_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/netboot/netconf.go b/netboot/netconf.go index 6370b5dc..c01bda70 100644 --- a/netboot/netconf.go +++ b/netboot/netconf.go @@ -192,7 +192,7 @@ func ConfigureInterface(ifname string, netconf *NetConf) (err error) { return err } defer func() { - if cerr := rt.Close(); err != nil { + if cerr := rt.Close(); err == nil { err = cerr } }() diff --git a/netboot/netconf_integ_test.go b/netboot/netconf_integ_test.go index a0af291c..d537f920 100644 --- a/netboot/netconf_integ_test.go +++ b/netboot/netconf_integ_test.go @@ -55,7 +55,7 @@ func TestConfigureInterface(t *testing.T) { Name: "IP addr, DNS, and routers", NetConf: &NetConf{ Addresses: []AddrConf{ - AddrConf{IPNet: net.IPNet{IP: net.ParseIP("10.20.30.40")}}, + AddrConf{IPNet: net.IPNet{IP: net.ParseIP("10.20.30.41")}}, }, DNSServers: []net.IP{net.ParseIP("8.8.8.8")}, DNSSearchList: []string{"slackware.it"},