Skip to content

Commit

Permalink
Remove unnecessary else clause
Browse files Browse the repository at this point in the history
  • Loading branch information
s1061123 committed Oct 26, 2018
1 parent a89e627 commit e220172
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions types/conf.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down

0 comments on commit e220172

Please sign in to comment.