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
1 changed files with 4 additions and 5 deletions

View File

@ -55,12 +55,11 @@ func (f *NetworkFingerprint) Fingerprint(cfg *config.Config, node *structs.Node)
var ip string
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)
}
// No interface could be found
if intf == nil {
case intf == nil:
// No interface could be found
return false, nil
}