From 907d534aab925ec186659603e592b2009347dd51 Mon Sep 17 00:00:00 2001 From: Iskander Sharipov Date: Wed, 3 Oct 2018 01:28:30 +0300 Subject: [PATCH] utils: replace single case type switch with if https://open.microsoft.com/2018/09/30/join-hacktoberfest-2018-celebration-microsoft Signed-off-by: Iskander Sharipov --- utils/utils.go | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/utils/utils.go b/utils/utils.go index 49cd96dc..491ce550 100755 --- a/utils/utils.go +++ b/utils/utils.go @@ -19,11 +19,8 @@ func LocalIPsWithoutLoopback() ([]net.IP, error) { return nil, fmt.Errorf("could not list the addresses for network interface %v: %v\n", i, err) } for _, address := range addresses { - switch v := address.(type) { - case *net.IPNet: - if !v.IP.IsLoopback() { - ips = append(ips, v.IP) - } + if v, ok := address.(*net.IPNet); ok && !v.IP.IsLoopback() { + ips = append(ips, v.IP) } } }