From de2742f10cc878a3ec482feb8608e7623e3f9dfa Mon Sep 17 00:00:00 2001 From: Ron Evans Date: Fri, 19 May 2023 14:02:33 +0200 Subject: [PATCH] Revert "(#501) make IP.String() method return something sensible" This reverts commit b1c96121588cb128f65c8787d2d181b2ecc3e413. --- net/net.go | 5 +---- net/net_test.go | 14 -------------- 2 files changed, 1 insertion(+), 18 deletions(-) delete mode 100644 net/net_test.go diff --git a/net/net.go b/net/net.go index f28da84..8654820 100644 --- a/net/net.go +++ b/net/net.go @@ -357,10 +357,7 @@ func ParseIP(s string) IP { // String returns the string form of the IP address ip. func (ip IP) String() string { - if len(ip) < 4 { - return "" - } - return strconv.Itoa(int(ip[0])) + "." + strconv.Itoa(int(ip[1])) + "." + strconv.Itoa(int(ip[2])) + "." + strconv.Itoa(int(ip[3])) + return string(ip) } // Conn is a generic stream-oriented network connection. diff --git a/net/net_test.go b/net/net_test.go deleted file mode 100644 index e9ac662..0000000 --- a/net/net_test.go +++ /dev/null @@ -1,14 +0,0 @@ -package net - -import ( - "testing" - - qt "github.com/frankban/quicktest" -) - -func TestIPAddressString(t *testing.T) { - c := qt.New(t) - ipaddr := ParseIP("127.0.0.1") - - c.Assert(ipaddr.String(), qt.Equals, "127.0.0.1") -}