Improve readability: use of a switch vs two if's
This commit is contained in:
parent
2ffbeee06c
commit
f39e84b672
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue