From dbec5b7c9c9eea1d45683580d827c42a28b4f311 Mon Sep 17 00:00:00 2001 From: marco Date: Mon, 29 Apr 2024 15:41:25 +0200 Subject: [PATCH] drop redundant else --- pkg/types/ip.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/pkg/types/ip.go b/pkg/types/ip.go index 5e4d7734f..6d59d027b 100644 --- a/pkg/types/ip.go +++ b/pkg/types/ip.go @@ -97,13 +97,12 @@ func IP2Ints(pip net.IP) (int, int64, int64, error) { if pip4 != nil { ip_nw32 := binary.BigEndian.Uint32(pip4) - return 4, uint2int(uint64(ip_nw32)), uint2int(ip_sfx), nil - } else if pip16 != nil { + } + if pip16 != nil { ip_nw = binary.BigEndian.Uint64(pip16[0:8]) ip_sfx = binary.BigEndian.Uint64(pip16[8:16]) return 16, uint2int(ip_nw), uint2int(ip_sfx), nil - } else { - return -1, 0, 0, fmt.Errorf("unexpected len %d for %s", len(pip), pip) } + return -1, 0, 0, fmt.Errorf("unexpected len %d for %s", len(pip), pip) }