all: remove LenIter, use Go 1.22 range-over-int instead
Updates #11058 Updates golang/go#65685 Change-Id: Ibb216b346e511d486271ab3d84e4546c521e4e22 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
committed by
Brad Fitzpatrick
parent
ff1391a97e
commit
e1bd7488d0
@@ -102,7 +102,7 @@ func (c *Conn) ServeHTTPDebug(w http.ResponseWriter, r *http.Request) {
|
||||
sort.Slice(ent, func(i, j int) bool { return ent[i].pub.Less(ent[j].pub) })
|
||||
|
||||
peers := map[key.NodePublic]tailcfg.NodeView{}
|
||||
for i := range c.peers.LenIter() {
|
||||
for i := range c.peers.Len() {
|
||||
p := c.peers.At(i)
|
||||
peers[p.Key()] = p
|
||||
}
|
||||
|
||||
@@ -1366,7 +1366,7 @@ func (de *endpoint) updateFromNode(n tailcfg.NodeView, heartbeatDisabled bool, p
|
||||
}
|
||||
|
||||
func (de *endpoint) setEndpointsLocked(eps interface {
|
||||
LenIter() []struct{}
|
||||
Len() int
|
||||
At(i int) netip.AddrPort
|
||||
}) {
|
||||
for _, st := range de.endpointState {
|
||||
@@ -1374,7 +1374,7 @@ func (de *endpoint) setEndpointsLocked(eps interface {
|
||||
}
|
||||
|
||||
var newIpps []netip.AddrPort
|
||||
for i := range eps.LenIter() {
|
||||
for i := range eps.Len() {
|
||||
if i > math.MaxInt16 {
|
||||
// Seems unlikely.
|
||||
break
|
||||
|
||||
@@ -1793,7 +1793,7 @@ func nodesEqual(x, y views.Slice[tailcfg.NodeView]) bool {
|
||||
if x.Len() != y.Len() {
|
||||
return false
|
||||
}
|
||||
for i := range x.LenIter() {
|
||||
for i := range x.Len() {
|
||||
if !x.At(i).Equal(y.At(i)) {
|
||||
return false
|
||||
}
|
||||
@@ -2056,7 +2056,7 @@ func (c *Conn) logEndpointCreated(n tailcfg.NodeView) {
|
||||
fmt.Fprintf(w, "derp=%v%s ", regionID, code)
|
||||
}
|
||||
|
||||
for i := range n.AllowedIPs().LenIter() {
|
||||
for i := range n.AllowedIPs().Len() {
|
||||
a := n.AllowedIPs().At(i)
|
||||
if a.IsSingleIP() {
|
||||
fmt.Fprintf(w, "aip=%v ", a.Addr())
|
||||
@@ -2064,7 +2064,7 @@ func (c *Conn) logEndpointCreated(n tailcfg.NodeView) {
|
||||
fmt.Fprintf(w, "aip=%v ", a)
|
||||
}
|
||||
}
|
||||
for i := range n.Endpoints().LenIter() {
|
||||
for i := range n.Endpoints().Len() {
|
||||
ep := n.Endpoints().At(i)
|
||||
fmt.Fprintf(w, "ep=%v ", ep)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user