Proposal Details
The current ParseAddrPort error has the following value
errors.New("not an ip:port")
errors.New("no IP")
errors.New("no port")
errors.New("missing ]")
errors.New("invalid port " + strconv.Quote(port) + " parsing " + strconv.Quote(s))
errors.New("invalid ip:port " + strconv.Quote(s) + ", square brackets can only be used with IPv6 addresses")
errors.New("invalid ip:port " + strconv.Quote(s) + ", IPv6 addresses must be surrounded by square brackets")
I would suggest turning these error values into the following
netip.ParseAddrPort(strconv.Quote(s)): not an ip:port
netip.ParseAddrPort(strconv.Quote(s)): no IP
netip.ParseAddrPort(strconv.Quote(s)): no port
netip.ParseAddrPort(strconv.Quote(s)): missing ]
netip.ParseAddrPort(strconv.Quote(s)): invalid port strconv.Quote(port)
netip.ParseAddrPort(strconv.Quote(s)): square brackets can only be used with IPv6 addresses
netip.ParseAddrPort(strconv.Quote(s)): IPv6 addresses must be surrounded by square brackets
A new error type can be created without exposing the
type parseAddrError struct {
in string // the string given to ParseAddrPort
msg string // an explanation of the parse failure
}
func (err parseAddrError) Error() string {
q := strconv.Quote
return "netip.ParseAddrPort(" + q(err.in) + "): " + err.msg
}
Proposal Details
The current ParseAddrPort error has the following value
I would suggest turning these error values into the following
A new error type can be created without exposing the