From 937fa5000a7bb07ed62d35a1aea9ea0819659084 Mon Sep 17 00:00:00 2001 From: subham sarkar Date: Wed, 8 Jun 2022 15:08:33 +0530 Subject: [PATCH] net/netip: add missing ) in ParsePrefix errors The existing error messages didn't add right parenthesis ')' properly leading to improper formation of error messages. Fixes #53283 Change-Id: Iadf9b8059403efa07e39716a81fab68cd10b7f87 Reviewed-on: https://go-review.googlesource.com/c/go/+/411015 Auto-Submit: Tobias Klauser TryBot-Result: Gopher Robot Reviewed-by: Ian Lance Taylor Auto-Submit: Ian Lance Taylor Run-TryBot: Tobias Klauser Run-TryBot: Ian Lance Taylor Reviewed-by: Tobias Klauser Reviewed-by: Damien Neil --- src/net/netip/netip.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/net/netip/netip.go b/src/net/netip/netip.go index eae9c29ea717f..bb83371a557d5 100644 --- a/src/net/netip/netip.go +++ b/src/net/netip/netip.go @@ -1310,14 +1310,14 @@ func ParsePrefix(s string) (Prefix, error) { bitsStr := s[i+1:] bits, err := strconv.Atoi(bitsStr) if err != nil { - return Prefix{}, errors.New("netip.ParsePrefix(" + strconv.Quote(s) + ": bad bits after slash: " + strconv.Quote(bitsStr)) + return Prefix{}, errors.New("netip.ParsePrefix(" + strconv.Quote(s) + "): bad bits after slash: " + strconv.Quote(bitsStr)) } maxBits := 32 if ip.Is6() { maxBits = 128 } if bits < 0 || bits > maxBits { - return Prefix{}, errors.New("netip.ParsePrefix(" + strconv.Quote(s) + ": prefix length out of range") + return Prefix{}, errors.New("netip.ParsePrefix(" + strconv.Quote(s) + "): prefix length out of range") } return PrefixFrom(ip, bits), nil }