mirror of
https://github.com/golang/go
synced 2024-09-21 00:43:04 +00:00
net/netip: use built-in clear to simplify code
This commit is contained in:
parent
f1d60500bc
commit
a7194571e1
|
@ -335,9 +335,7 @@ func parseIPv6(in string) (Addr, error) {
|
|||
for j := i - 1; j >= ellipsis; j-- {
|
||||
ip[j+n] = ip[j]
|
||||
}
|
||||
for j := ellipsis + n - 1; j >= ellipsis; j-- {
|
||||
ip[j] = 0
|
||||
}
|
||||
clear(ip[ellipsis : ellipsis+n])
|
||||
} else if ellipsis >= 0 {
|
||||
// Ellipsis must represent at least one 0 group.
|
||||
return Addr{}, parseAddrError{in: in, msg: "the :: must expand to at least one field of zeros"}
|
||||
|
|
Loading…
Reference in a new issue