diff --git a/sztp-agent/pkg/dhcp/dbus.go b/sztp-agent/pkg/dhcp/dbus.go index 1220839..5f7a1ef 100644 --- a/sztp-agent/pkg/dhcp/dbus.go +++ b/sztp-agent/pkg/dhcp/dbus.go @@ -19,7 +19,7 @@ import ( func GetBootstrapURLsViaNetworkManager() ([]string, error) { conn, err := dbus.SystemBus() if err != nil { - panic(fmt.Errorf("failed to connect to system bus: %v", err)) + return nil, fmt.Errorf("failed to connect to system bus: %v", err) } // Get NetworkManager object @@ -28,7 +28,7 @@ func GetBootstrapURLsViaNetworkManager() ([]string, error) { var activeConnPaths []dbus.ObjectPath err = nm.Call("org.freedesktop.DBus.Properties.Get", 0, "org.freedesktop.NetworkManager", "ActiveConnections").Store(&activeConnPaths) if err != nil { - panic(fmt.Errorf("failed to get ActiveConnections property: %v", err)) + return nil, fmt.Errorf("failed to get ActiveConnections property: %v", err) } log.Println("[INFO] active connection paths: ", activeConnPaths) diff --git a/sztp-agent/pkg/secureagent/daemon.go b/sztp-agent/pkg/secureagent/daemon.go index 906d4b1..6bea027 100644 --- a/sztp-agent/pkg/secureagent/daemon.go +++ b/sztp-agent/pkg/secureagent/daemon.go @@ -55,7 +55,7 @@ func (a *Agent) performBootstrapSequence() error { urls := a.GetBootstrapURL() log.Println("[INFO] Performing the Bootstrap Sequence on each URL") for _, url := range urls { - urlCopy := url + urlCopy := url // found no other way to escape golangci-lint err = a.doRequestBootstrapServerOnboardingInfo(&urlCopy) if err != nil { log.Println("[ERROR] ", err.Error())