Improve readability: use of a switch vs two if's

This commit is contained in:
Sean Chittenden 2016-07-10 20:18:57 -07:00
parent 2ffbeee06c
commit f39e84b672
No known key found for this signature in database
GPG key ID: 4EBC9DC16C2E5E16

View file

@ -55,12 +55,11 @@ func (f *NetworkFingerprint) Fingerprint(cfg *config.Config, node *structs.Node)
var ip string var ip string
intf, err := f.findInterface(cfg.NetworkInterface) intf, err := f.findInterface(cfg.NetworkInterface)
if err != nil { switch {
case err != nil:
return false, fmt.Errorf("Error while detecting network interface during fingerprinting: %v", err) return false, fmt.Errorf("Error while detecting network interface during fingerprinting: %v", err)
} case intf == nil:
// No interface could be found
// No interface could be found
if intf == nil {
return false, nil return false, nil
} }