From f39e84b6722424a644f97570d721435ad9ec38fb Mon Sep 17 00:00:00 2001 From: Sean Chittenden Date: Sun, 10 Jul 2016 20:18:57 -0700 Subject: [PATCH] Improve readability: use of a switch vs two if's --- client/fingerprint/network.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/client/fingerprint/network.go b/client/fingerprint/network.go index f2fec805e..9d4e8683a 100644 --- a/client/fingerprint/network.go +++ b/client/fingerprint/network.go @@ -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 }