From e220172608bd78380aec4429b882d422cd8c59f2 Mon Sep 17 00:00:00 2001 From: Tomofumi Hayashi Date: Fri, 26 Oct 2018 14:47:59 +0900 Subject: [PATCH] Remove unnecessary else clause --- types/conf.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/types/conf.go b/types/conf.go index 121bcfd10..0a9166205 100644 --- a/types/conf.go +++ b/types/conf.go @@ -52,18 +52,19 @@ func LoadDelegateNetConfList(bytes []byte, delegateConf *DelegateNetConf) error // Convert raw CNI JSON into a DelegateNetConf structure func LoadDelegateNetConf(bytes []byte, net *NetworkSelectionElement, deviceID string) (*DelegateNetConf, error) { - delegateConf := &DelegateNetConf{} - logging.Debugf("LoadDelegateNetConf: %s, %v", string(bytes), net) + var err error + logging.Debugf("LoadDelegateNetConf: %s, %v, %s", string(bytes), net, deviceID) // If deviceID is present, inject this into delegate config if deviceID != "" { - if updatedBytes, err := delegateAddDeviceID(bytes, deviceID); err != nil { + var updatedBytes []byte + if updatedBytes, err = delegateAddDeviceID(bytes, deviceID); err != nil { return nil, logging.Errorf("error in LoadDelegateNetConf - delegateAddDeviceID unable to update delegate config: %v", err) - } else { - bytes = updatedBytes } + bytes = updatedBytes } + delegateConf := &DelegateNetConf{} if err := json.Unmarshal(bytes, &delegateConf.Conf); err != nil { return nil, logging.Errorf("error in LoadDelegateNetConf - unmarshalling delegate config: %v", err) }