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 226df7dea9
commit c26bdebc28

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
}