all: use new Go 1.23 slices.Sorted more

Updates #12912

Change-Id: If1294e5bc7b5d3cf0067535ae10db75e8b988d8b
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
Brad Fitzpatrick
2024-09-04 13:27:07 -07:00
committed by Brad Fitzpatrick
parent fd6686d81a
commit 3d401c11fa
4 changed files with 9 additions and 26 deletions
+3 -7
View File
@@ -7,11 +7,12 @@ import (
"bufio"
"context"
"fmt"
"maps"
"net"
"net/netip"
"reflect"
"runtime"
"sort"
"slices"
"sync"
"time"
"unsafe"
@@ -907,12 +908,7 @@ func (c *Conn) foreachActiveDerpSortedLocked(fn func(regionID int, ad activeDerp
}
return
}
ids := make([]int, 0, len(c.activeDerp))
for id := range c.activeDerp {
ids = append(ids, id)
}
sort.Ints(ids)
for _, id := range ids {
for _, id := range slices.Sorted(maps.Keys(c.activeDerp)) {
fn(id, c.activeDerp[id])
}
}