From d16ba90d342888dcccfc8a0ee97836a4604ac628 Mon Sep 17 00:00:00 2001 From: muly Date: Tue, 12 Jan 2021 14:09:13 -0500 Subject: [PATCH] Changed the return statements to go idiomatic way Change-Id: I56f57d9e6ef385245b2a299d9d6d7bacd2266b68 --- pkg/remote/management.go | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/pkg/remote/management.go b/pkg/remote/management.go index e691ca4fa..5fc70ad31 100644 --- a/pkg/remote/management.go +++ b/pkg/remote/management.go @@ -183,16 +183,14 @@ func NewManager(cfg *config.Config, phaseName string, hosts ...HostSelector) (*M func newBaremetalHost(mgmtCfg config.ManagementConfiguration, hostDoc document.Document, docBundle document.Bundle) (baremetalHost, error) { - var host baremetalHost - address, err := document.GetBMHBMCAddress(hostDoc) if err != nil { - return host, err + return baremetalHost{}, err } username, password, err := document.GetBMHBMCCredentials(hostDoc, docBundle) if err != nil { - return host, err + return baremetalHost{}, err } var clientFactory remoteifc.ClientFactory @@ -204,7 +202,7 @@ func newBaremetalHost(mgmtCfg config.ManagementConfiguration, case redfishdell.ClientType: clientFactory = redfishdell.ClientFactory default: - return host, ErrUnknownManagementType{Type: mgmtCfg.Type} + return baremetalHost{}, ErrUnknownManagementType{Type: mgmtCfg.Type} } client, err := clientFactory( @@ -216,11 +214,10 @@ func newBaremetalHost(mgmtCfg config.ManagementConfiguration, mgmtCfg.SystemRebootDelay) if err != nil { - return host, err + return baremetalHost{}, err } - host = baremetalHost{client, address, hostDoc.GetName(), username, password} - return host, nil + return baremetalHost{client, address, hostDoc.GetName(), username, password}, nil } // reconcileHosts produces the intersection of two baremetal host arrays.