From 037b209ae3e0453004a4d57e152aa522c56f79e4 Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Wed, 4 May 2022 09:20:56 +0200 Subject: [PATCH] net/netip: use strconv.AppendUint in AddrPort.AppendTo MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This is already used in AddrPort.String. name old time/op new time/op delta AddrPortMarshalText/v4-4 67.9ns ± 3% 61.5ns ± 6% -9.43% (p=0.000 n=10+9) AddrPortMarshalText/v6-4 168ns ± 4% 155ns ± 2% -7.54% (p=0.000 n=10+10) AddrPortMarshalText/v6_ellipsis-4 169ns ± 3% 162ns ± 5% -4.03% (p=0.001 n=9+10) AddrPortMarshalText/v6_v4-4 87.0ns ± 4% 85.8ns ± 4% ~ (p=0.165 n=10+10) AddrPortMarshalText/v6_zone-4 169ns ± 3% 166ns ± 3% ~ (p=0.066 n=10+10) Change-Id: If16eda4bf48224029dcaf2069ae87f8d89865d99 Reviewed-on: https://go-review.googlesource.com/c/go/+/404014 Run-TryBot: Ian Lance Taylor Run-TryBot: Tobias Klauser Reviewed-by: David Chase TryBot-Result: Gopher Robot Auto-Submit: Ian Lance Taylor Reviewed-by: Bryan Mills Reviewed-by: Brad Fitzpatrick --- src/net/netip/netip.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/net/netip/netip.go b/src/net/netip/netip.go index 7d8b20384e..2c21715af1 100644 --- a/src/net/netip/netip.go +++ b/src/net/netip/netip.go @@ -1171,7 +1171,7 @@ func (p AddrPort) AppendTo(b []byte) []byte { b = append(b, ']') } b = append(b, ':') - b = strconv.AppendInt(b, int64(p.port), 10) + b = strconv.AppendUint(b, uint64(p.port), 10) return b } -- 2.50.0