From e8551d6b405c95d7dc7743aeb624d76e362ca39a Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Wed, 16 Aug 2023 22:09:53 -0700 Subject: [PATCH] all: use Go 1.21 slices, maps instead of x/exp/{slices,maps} Updates #8419 Signed-off-by: Brad Fitzpatrick --- cmd/derper/depaware.txt | 6 +++--- cmd/k8s-operator/operator.go | 2 +- cmd/netlogfmt/main.go | 7 +++---- cmd/tailscale/cli/cli.go | 2 +- cmd/tailscale/cli/configure-kube.go | 2 +- cmd/tailscale/cli/exitnode.go | 3 +-- cmd/tailscale/cli/funnel.go | 2 +- cmd/tailscale/cli/serve.go | 2 +- cmd/tailscale/depaware.txt | 8 +++++--- cmd/tailscaled/depaware.txt | 8 ++++---- cmd/tsconnect/common.go | 2 +- envknob/logknob/logknob.go | 2 +- ipn/ipnlocal/cert.go | 2 +- ipn/ipnlocal/cert_test.go | 3 +-- ipn/ipnlocal/local.go | 2 +- ipn/ipnlocal/peerapi.go | 2 +- ipn/ipnlocal/profiles.go | 2 +- ipn/ipnlocal/serve.go | 2 +- ipn/ipnlocal/ssh.go | 2 +- ipn/localapi/localapi.go | 2 +- ipn/serve.go | 2 +- metrics/metrics.go | 3 +-- net/dns/manager.go | 2 +- net/dns/recursive/recursive.go | 2 +- net/dns/recursive/recursive_test.go | 3 ++- net/dnsfallback/dnsfallback.go | 2 +- net/tsaddr/tsaddr.go | 2 +- net/tstun/wrap.go | 2 +- portlist/poller.go | 2 +- ssh/tailssh/incubator.go | 2 +- ssh/tailssh/privs_test.go | 2 +- syncs/syncs.go | 3 +-- tempfork/gliderlabs/ssh/tcpip_test.go | 1 + tsnet/tsnet.go | 2 +- tstest/clock_test.go | 2 +- tstest/integration/testcontrol/testcontrol.go | 2 +- types/logid/id.go | 3 +-- types/views/views.go | 4 ++-- util/multierr/multierr.go | 3 +-- util/set/slice.go | 3 ++- util/slicesx/slicesx_test.go | 3 +-- wgengine/filter/filter.go | 2 +- wgengine/filter/filter_test.go | 2 +- wgengine/router/ifconfig_windows.go | 2 +- wgengine/router/router_linux_test.go | 2 +- wgengine/userspace.go | 3 +-- wgengine/wgcfg/nmcfg/nmcfg.go | 2 +- 47 files changed, 61 insertions(+), 65 deletions(-) diff --git a/cmd/derper/depaware.txt b/cmd/derper/depaware.txt index 427323d89..394066519 100644 --- a/cmd/derper/depaware.txt +++ b/cmd/derper/depaware.txt @@ -168,9 +168,6 @@ tailscale.com/cmd/derper dependencies: (generated by github.com/tailscale/depawa golang.org/x/crypto/nacl/box from tailscale.com/types/key golang.org/x/crypto/nacl/secretbox from golang.org/x/crypto/nacl/box golang.org/x/crypto/salsa20/salsa from golang.org/x/crypto/nacl/box+ - golang.org/x/exp/constraints from golang.org/x/exp/slices - golang.org/x/exp/maps from tailscale.com/types/views+ - golang.org/x/exp/slices from tailscale.com/net/tsaddr+ L golang.org/x/net/bpf from github.com/mdlayher/netlink+ golang.org/x/net/dns/dnsmessage from net+ golang.org/x/net/http/httpguts from net/http @@ -193,6 +190,7 @@ tailscale.com/cmd/derper dependencies: (generated by github.com/tailscale/depawa golang.org/x/time/rate from tailscale.com/cmd/derper+ bufio from compress/flate+ bytes from bufio+ + cmp from slices compress/flate from compress/gzip+ compress/gzip from internal/profile+ container/list from crypto/tls+ @@ -242,6 +240,7 @@ tailscale.com/cmd/derper dependencies: (generated by github.com/tailscale/depawa io/ioutil from github.com/mitchellh/go-ps+ log from expvar+ log/internal from log + maps from tailscale.com/types/views math from compress/flate+ math/big from crypto/dsa+ math/bits from compress/flate+ @@ -269,6 +268,7 @@ tailscale.com/cmd/derper dependencies: (generated by github.com/tailscale/depawa runtime/metrics from github.com/prometheus/client_golang/prometheus+ runtime/pprof from net/http/pprof runtime/trace from net/http/pprof + slices from tailscale.com/ipn+ sort from compress/flate+ strconv from compress/flate+ strings from bufio+ diff --git a/cmd/k8s-operator/operator.go b/cmd/k8s-operator/operator.go index 15a89a4b2..d5e676709 100644 --- a/cmd/k8s-operator/operator.go +++ b/cmd/k8s-operator/operator.go @@ -12,13 +12,13 @@ "fmt" "net/http" "os" + "slices" "strings" "time" "github.com/go-logr/zapr" "go.uber.org/zap" "go.uber.org/zap/zapcore" - "golang.org/x/exp/slices" "golang.org/x/oauth2/clientcredentials" appsv1 "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1" diff --git a/cmd/netlogfmt/main.go b/cmd/netlogfmt/main.go index 296469327..98c958305 100644 --- a/cmd/netlogfmt/main.go +++ b/cmd/netlogfmt/main.go @@ -35,14 +35,13 @@ "net/http" "net/netip" "os" + "slices" "strconv" "strings" "time" "github.com/dsnet/try" jsonv2 "github.com/go-json-experiment/json" - "golang.org/x/exp/maps" - "golang.org/x/exp/slices" "tailscale.com/types/logid" "tailscale.com/types/netlogtype" "tailscale.com/util/cmpx" @@ -315,8 +314,8 @@ func mustMakeNamesByAddr() map[netip.Addr]string { namesByAddr := make(map[netip.Addr]string) retry: for i := 0; i < 10; i++ { - maps.Clear(seen) - maps.Clear(namesByAddr) + clear(seen) + clear(namesByAddr) for _, d := range m.Devices { name := fieldPrefix(d.Name, i) if seen[name] { diff --git a/cmd/tailscale/cli/cli.go b/cmd/tailscale/cli/cli.go index c1b94d695..f17a8aeb1 100644 --- a/cmd/tailscale/cli/cli.go +++ b/cmd/tailscale/cli/cli.go @@ -14,12 +14,12 @@ "log" "os" "runtime" + "slices" "strings" "sync" "text/tabwriter" "github.com/peterbourgon/ff/v3/ffcli" - "golang.org/x/exp/slices" "tailscale.com/client/tailscale" "tailscale.com/envknob" "tailscale.com/paths" diff --git a/cmd/tailscale/cli/configure-kube.go b/cmd/tailscale/cli/configure-kube.go index 0c7371927..1231991de 100644 --- a/cmd/tailscale/cli/configure-kube.go +++ b/cmd/tailscale/cli/configure-kube.go @@ -11,10 +11,10 @@ "fmt" "os" "path/filepath" + "slices" "strings" "github.com/peterbourgon/ff/v3/ffcli" - "golang.org/x/exp/slices" "k8s.io/client-go/util/homedir" "sigs.k8s.io/yaml" "tailscale.com/version" diff --git a/cmd/tailscale/cli/exitnode.go b/cmd/tailscale/cli/exitnode.go index d07b01333..558942425 100644 --- a/cmd/tailscale/cli/exitnode.go +++ b/cmd/tailscale/cli/exitnode.go @@ -8,14 +8,13 @@ "errors" "flag" "fmt" - "os" + "slices" "strings" "text/tabwriter" "github.com/peterbourgon/ff/v3/ffcli" "golang.org/x/exp/maps" - "golang.org/x/exp/slices" "tailscale.com/ipn/ipnstate" "tailscale.com/tailcfg" "tailscale.com/util/cmpx" diff --git a/cmd/tailscale/cli/funnel.go b/cmd/tailscale/cli/funnel.go index cf6ae15de..e63e7e121 100644 --- a/cmd/tailscale/cli/funnel.go +++ b/cmd/tailscale/cli/funnel.go @@ -9,11 +9,11 @@ "fmt" "net" "os" + "slices" "strconv" "strings" "github.com/peterbourgon/ff/v3/ffcli" - "golang.org/x/exp/slices" "tailscale.com/ipn" "tailscale.com/ipn/ipnstate" "tailscale.com/tailcfg" diff --git a/cmd/tailscale/cli/serve.go b/cmd/tailscale/cli/serve.go index c83228a0d..dc2dbb251 100644 --- a/cmd/tailscale/cli/serve.go +++ b/cmd/tailscale/cli/serve.go @@ -18,12 +18,12 @@ "path/filepath" "reflect" "runtime" + "slices" "sort" "strconv" "strings" "github.com/peterbourgon/ff/v3/ffcli" - "golang.org/x/exp/slices" "tailscale.com/client/tailscale" "tailscale.com/ipn" "tailscale.com/ipn/ipnstate" diff --git a/cmd/tailscale/depaware.txt b/cmd/tailscale/depaware.txt index 5865de17a..ef29eeebe 100644 --- a/cmd/tailscale/depaware.txt +++ b/cmd/tailscale/depaware.txt @@ -168,9 +168,8 @@ tailscale.com/cmd/tailscale dependencies: (generated by github.com/tailscale/dep golang.org/x/crypto/nacl/secretbox from golang.org/x/crypto/nacl/box golang.org/x/crypto/pbkdf2 from software.sslmate.com/src/go-pkcs12 golang.org/x/crypto/salsa20/salsa from golang.org/x/crypto/nacl/box+ - golang.org/x/exp/constraints from golang.org/x/exp/slices+ - golang.org/x/exp/maps from tailscale.com/types/views+ - golang.org/x/exp/slices from tailscale.com/net/tsaddr+ + W golang.org/x/exp/constraints from github.com/dblohm7/wingoes/pe + golang.org/x/exp/maps from tailscale.com/cmd/tailscale/cli golang.org/x/net/bpf from github.com/mdlayher/netlink+ golang.org/x/net/dns/dnsmessage from net+ golang.org/x/net/http/httpguts from net/http+ @@ -199,6 +198,7 @@ tailscale.com/cmd/tailscale dependencies: (generated by github.com/tailscale/dep golang.org/x/time/rate from tailscale.com/cmd/tailscale/cli+ bufio from compress/flate+ bytes from bufio+ + cmp from slices compress/flate from compress/gzip+ compress/gzip from net/http compress/zlib from image/png+ @@ -256,6 +256,7 @@ tailscale.com/cmd/tailscale dependencies: (generated by github.com/tailscale/dep io/ioutil from golang.org/x/sys/cpu+ log from expvar+ log/internal from log + maps from tailscale.com/types/views math from compress/flate+ math/big from crypto/dsa+ math/bits from compress/flate+ @@ -282,6 +283,7 @@ tailscale.com/cmd/tailscale dependencies: (generated by github.com/tailscale/dep regexp from github.com/tailscale/goupnp/httpu+ regexp/syntax from regexp runtime/debug from tailscale.com/util/singleflight+ + slices from tailscale.com/cmd/tailscale/cli+ sort from compress/flate+ strconv from compress/flate+ strings from bufio+ diff --git a/cmd/tailscaled/depaware.txt b/cmd/tailscaled/depaware.txt index 6d417c725..c151878b9 100644 --- a/cmd/tailscaled/depaware.txt +++ b/cmd/tailscaled/depaware.txt @@ -379,9 +379,8 @@ tailscale.com/cmd/tailscaled dependencies: (generated by github.com/tailscale/de golang.org/x/crypto/poly1305 from github.com/tailscale/golang-x-crypto/ssh+ golang.org/x/crypto/salsa20/salsa from golang.org/x/crypto/nacl/box+ LD golang.org/x/crypto/ssh from tailscale.com/ssh/tailssh+ - golang.org/x/exp/constraints from golang.org/x/exp/slices+ - golang.org/x/exp/maps from tailscale.com/wgengine+ - golang.org/x/exp/slices from tailscale.com/ipn/ipnlocal+ + golang.org/x/exp/constraints from github.com/dblohm7/wingoes/pe+ + golang.org/x/exp/maps from tailscale.com/wgengine/magicsock golang.org/x/net/bpf from github.com/mdlayher/genetlink+ golang.org/x/net/dns/dnsmessage from net+ golang.org/x/net/http/httpguts from golang.org/x/net/http2+ @@ -467,6 +466,7 @@ tailscale.com/cmd/tailscaled dependencies: (generated by github.com/tailscale/de log from expvar+ log/internal from log LD log/syslog from tailscale.com/ssh/tailssh + maps from tailscale.com/types/views math from compress/flate+ math/big from crypto/dsa+ math/bits from compress/flate+ @@ -496,7 +496,7 @@ tailscale.com/cmd/tailscaled dependencies: (generated by github.com/tailscale/de runtime/debug from github.com/klauspost/compress/zstd+ runtime/pprof from net/http/pprof+ runtime/trace from net/http/pprof - slices from tailscale.com/wgengine/magicsock + slices from tailscale.com/wgengine/magicsock+ sort from compress/flate+ strconv from compress/flate+ strings from bufio+ diff --git a/cmd/tsconnect/common.go b/cmd/tsconnect/common.go index aab2d2b8e..902768589 100644 --- a/cmd/tsconnect/common.go +++ b/cmd/tsconnect/common.go @@ -12,11 +12,11 @@ "path" "path/filepath" "runtime" + "slices" "strconv" "time" esbuild "github.com/evanw/esbuild/pkg/api" - "golang.org/x/exp/slices" ) const ( diff --git a/envknob/logknob/logknob.go b/envknob/logknob/logknob.go index ed45c7a94..e69912e4a 100644 --- a/envknob/logknob/logknob.go +++ b/envknob/logknob/logknob.go @@ -6,9 +6,9 @@ package logknob import ( + "slices" "sync/atomic" - "golang.org/x/exp/slices" "tailscale.com/envknob" "tailscale.com/types/logger" ) diff --git a/ipn/ipnlocal/cert.go b/ipn/ipnlocal/cert.go index 9da760bb3..de5dee3e9 100644 --- a/ipn/ipnlocal/cert.go +++ b/ipn/ipnlocal/cert.go @@ -27,12 +27,12 @@ "os" "path/filepath" "runtime" + "slices" "strings" "sync" "time" "github.com/tailscale/golang-x-crypto/acme" - "golang.org/x/exp/slices" "tailscale.com/atomicfile" "tailscale.com/envknob" "tailscale.com/hostinfo" diff --git a/ipn/ipnlocal/cert_test.go b/ipn/ipnlocal/cert_test.go index 66d942032..3ae7870e3 100644 --- a/ipn/ipnlocal/cert_test.go +++ b/ipn/ipnlocal/cert_test.go @@ -18,7 +18,6 @@ "time" "github.com/google/go-cmp/cmp" - "golang.org/x/exp/maps" "tailscale.com/ipn/store/mem" ) @@ -112,7 +111,7 @@ func TestShouldStartDomainRenewal(t *testing.T) { reset := func() { renewMu.Lock() defer renewMu.Unlock() - maps.Clear(renewCertAt) + clear(renewCertAt) } mustMakePair := func(template *x509.Certificate) *TLSCertKeyPair { diff --git a/ipn/ipnlocal/local.go b/ipn/ipnlocal/local.go index f84288562..5dc021ab0 100644 --- a/ipn/ipnlocal/local.go +++ b/ipn/ipnlocal/local.go @@ -20,6 +20,7 @@ "os/user" "path/filepath" "runtime" + "slices" "sort" "strconv" "strings" @@ -29,7 +30,6 @@ "go4.org/mem" "go4.org/netipx" - "golang.org/x/exp/slices" "gvisor.dev/gvisor/pkg/tcpip" "tailscale.com/client/tailscale/apitype" "tailscale.com/control/controlclient" diff --git a/ipn/ipnlocal/peerapi.go b/ipn/ipnlocal/peerapi.go index 93d2ed2ad..f7396da17 100644 --- a/ipn/ipnlocal/peerapi.go +++ b/ipn/ipnlocal/peerapi.go @@ -22,6 +22,7 @@ "path" "path/filepath" "runtime" + "slices" "sort" "strconv" "strings" @@ -32,7 +33,6 @@ "unicode/utf8" "github.com/kortschak/wol" - "golang.org/x/exp/slices" "golang.org/x/net/dns/dnsmessage" "golang.org/x/net/http/httpguts" "tailscale.com/client/tailscale/apitype" diff --git a/ipn/ipnlocal/profiles.go b/ipn/ipnlocal/profiles.go index 99839ac50..32e44e486 100644 --- a/ipn/ipnlocal/profiles.go +++ b/ipn/ipnlocal/profiles.go @@ -10,10 +10,10 @@ "math/rand" "net/netip" "runtime" + "slices" "strings" "time" - "golang.org/x/exp/slices" "tailscale.com/envknob" "tailscale.com/ipn" "tailscale.com/types/logger" diff --git a/ipn/ipnlocal/serve.go b/ipn/ipnlocal/serve.go index 155243cb2..1f9d0e8a0 100644 --- a/ipn/ipnlocal/serve.go +++ b/ipn/ipnlocal/serve.go @@ -17,12 +17,12 @@ "net/url" "os" "path" + "slices" "strconv" "strings" "sync" "time" - "golang.org/x/exp/slices" "tailscale.com/ipn" "tailscale.com/logtail/backoff" "tailscale.com/net/netutil" diff --git a/ipn/ipnlocal/ssh.go b/ipn/ipnlocal/ssh.go index 6fa56d7d9..19a23c030 100644 --- a/ipn/ipnlocal/ssh.go +++ b/ipn/ipnlocal/ssh.go @@ -20,12 +20,12 @@ "os/exec" "path/filepath" "runtime" + "slices" "strings" "sync" "github.com/tailscale/golang-x-crypto/ssh" "go4.org/mem" - "golang.org/x/exp/slices" "tailscale.com/tailcfg" "tailscale.com/util/lineread" "tailscale.com/util/mak" diff --git a/ipn/localapi/localapi.go b/ipn/localapi/localapi.go index 7ad1b5522..f74786ec0 100644 --- a/ipn/localapi/localapi.go +++ b/ipn/localapi/localapi.go @@ -20,12 +20,12 @@ "net/netip" "net/url" "runtime" + "slices" "strconv" "strings" "sync" "time" - "golang.org/x/exp/slices" "tailscale.com/client/tailscale/apitype" "tailscale.com/envknob" "tailscale.com/health" diff --git a/ipn/serve.go b/ipn/serve.go index efff23cea..55bf39a93 100644 --- a/ipn/serve.go +++ b/ipn/serve.go @@ -9,10 +9,10 @@ "net" "net/netip" "net/url" + "slices" "strconv" "strings" - "golang.org/x/exp/slices" "tailscale.com/tailcfg" ) diff --git a/metrics/metrics.go b/metrics/metrics.go index 76fc9ee07..054dff9df 100644 --- a/metrics/metrics.go +++ b/metrics/metrics.go @@ -9,9 +9,8 @@ "expvar" "fmt" "io" + "slices" "strings" - - "golang.org/x/exp/slices" ) // Set is a string-to-Var map variable that satisfies the expvar.Var diff --git a/net/dns/manager.go b/net/dns/manager.go index 95f0908ca..f177b5777 100644 --- a/net/dns/manager.go +++ b/net/dns/manager.go @@ -12,11 +12,11 @@ "net" "net/netip" "runtime" + "slices" "strings" "sync/atomic" "time" - "golang.org/x/exp/slices" "tailscale.com/health" "tailscale.com/net/dns/resolver" "tailscale.com/net/netmon" diff --git a/net/dns/recursive/recursive.go b/net/dns/recursive/recursive.go index 1314cdbc3..5b585483c 100644 --- a/net/dns/recursive/recursive.go +++ b/net/dns/recursive/recursive.go @@ -10,11 +10,11 @@ "fmt" "net" "net/netip" + "slices" "strings" "time" "github.com/miekg/dns" - "golang.org/x/exp/slices" "tailscale.com/envknob" "tailscale.com/net/netns" "tailscale.com/types/logger" diff --git a/net/dns/recursive/recursive_test.go b/net/dns/recursive/recursive_test.go index 681252997..0bfba383a 100644 --- a/net/dns/recursive/recursive_test.go +++ b/net/dns/recursive/recursive_test.go @@ -15,8 +15,9 @@ "testing" "time" + "slices" + "github.com/miekg/dns" - "golang.org/x/exp/slices" "tailscale.com/envknob" "tailscale.com/tstest" ) diff --git a/net/dnsfallback/dnsfallback.go b/net/dnsfallback/dnsfallback.go index 3393f5e10..de58fa38c 100644 --- a/net/dnsfallback/dnsfallback.go +++ b/net/dnsfallback/dnsfallback.go @@ -19,11 +19,11 @@ "net/url" "os" "reflect" + "slices" "sync/atomic" "time" "go4.org/netipx" - "golang.org/x/exp/slices" "tailscale.com/atomicfile" "tailscale.com/envknob" "tailscale.com/net/dns/recursive" diff --git a/net/tsaddr/tsaddr.go b/net/tsaddr/tsaddr.go index 566e9716c..2ce98b04c 100644 --- a/net/tsaddr/tsaddr.go +++ b/net/tsaddr/tsaddr.go @@ -8,10 +8,10 @@ "encoding/binary" "errors" "net/netip" + "slices" "sync" "go4.org/netipx" - "golang.org/x/exp/slices" "tailscale.com/net/netaddr" ) diff --git a/net/tstun/wrap.go b/net/tstun/wrap.go index 74bf54134..20f54744d 100644 --- a/net/tstun/wrap.go +++ b/net/tstun/wrap.go @@ -12,6 +12,7 @@ "net/netip" "os" "reflect" + "slices" "strings" "sync" "sync/atomic" @@ -20,7 +21,6 @@ "github.com/tailscale/wireguard-go/device" "github.com/tailscale/wireguard-go/tun" "go4.org/mem" - "golang.org/x/exp/slices" "gvisor.dev/gvisor/pkg/tcpip/stack" "tailscale.com/disco" "tailscale.com/net/connstats" diff --git a/portlist/poller.go b/portlist/poller.go index d1f5b2ab0..423bad3be 100644 --- a/portlist/poller.go +++ b/portlist/poller.go @@ -10,10 +10,10 @@ "errors" "fmt" "runtime" + "slices" "sync" "time" - "golang.org/x/exp/slices" "tailscale.com/envknob" ) diff --git a/ssh/tailssh/incubator.go b/ssh/tailssh/incubator.go index 952d755ea..dd109dc32 100644 --- a/ssh/tailssh/incubator.go +++ b/ssh/tailssh/incubator.go @@ -22,6 +22,7 @@ "os/exec" "path/filepath" "runtime" + "slices" "sort" "strconv" "strings" @@ -31,7 +32,6 @@ "github.com/pkg/sftp" "github.com/u-root/u-root/pkg/termios" gossh "golang.org/x/crypto/ssh" - "golang.org/x/exp/slices" "golang.org/x/sys/unix" "tailscale.com/cmd/tailscaled/childproc" "tailscale.com/hostinfo" diff --git a/ssh/tailssh/privs_test.go b/ssh/tailssh/privs_test.go index 60cfe5e4f..4ef597933 100644 --- a/ssh/tailssh/privs_test.go +++ b/ssh/tailssh/privs_test.go @@ -15,11 +15,11 @@ "reflect" "regexp" "runtime" + "slices" "strconv" "syscall" "testing" - "golang.org/x/exp/slices" "tailscale.com/types/logger" ) diff --git a/syncs/syncs.go b/syncs/syncs.go index 7f193f24e..abfaba5d8 100644 --- a/syncs/syncs.go +++ b/syncs/syncs.go @@ -9,7 +9,6 @@ "sync" "sync/atomic" - "golang.org/x/exp/maps" "tailscale.com/util/mak" ) @@ -232,7 +231,7 @@ func (m *Map[K, V]) Len() int { func (m *Map[K, V]) Clear() { m.mu.Lock() defer m.mu.Unlock() - maps.Clear(m.m) + clear(m.m) } // WaitGroup is identical to [sync.WaitGroup], diff --git a/tempfork/gliderlabs/ssh/tcpip_test.go b/tempfork/gliderlabs/ssh/tcpip_test.go index 8f330f611..118b5d53a 100644 --- a/tempfork/gliderlabs/ssh/tcpip_test.go +++ b/tempfork/gliderlabs/ssh/tcpip_test.go @@ -4,6 +4,7 @@ import ( "bytes" + "io" "net" "strconv" "strings" diff --git a/tsnet/tsnet.go b/tsnet/tsnet.go index 444990f27..7b27c5242 100644 --- a/tsnet/tsnet.go +++ b/tsnet/tsnet.go @@ -22,12 +22,12 @@ "os" "path/filepath" "runtime" + "slices" "strconv" "strings" "sync" "time" - "golang.org/x/exp/slices" "tailscale.com/client/tailscale" "tailscale.com/control/controlclient" "tailscale.com/envknob" diff --git a/tstest/clock_test.go b/tstest/clock_test.go index 461aaade1..93defe7ff 100644 --- a/tstest/clock_test.go +++ b/tstest/clock_test.go @@ -4,11 +4,11 @@ package tstest import ( + "slices" "sync/atomic" "testing" "time" - "golang.org/x/exp/slices" "tailscale.com/tstime" ) diff --git a/tstest/integration/testcontrol/testcontrol.go b/tstest/integration/testcontrol/testcontrol.go index 89a66ef7d..d86ceb5c9 100644 --- a/tstest/integration/testcontrol/testcontrol.go +++ b/tstest/integration/testcontrol/testcontrol.go @@ -19,6 +19,7 @@ "net/http/httptest" "net/netip" "net/url" + "slices" "sort" "strings" "sync" @@ -26,7 +27,6 @@ "github.com/klauspost/compress/zstd" "go4.org/mem" - "golang.org/x/exp/slices" "tailscale.com/net/netaddr" "tailscale.com/net/tsaddr" "tailscale.com/smallzstd" diff --git a/types/logid/id.go b/types/logid/id.go index 92c1a021e..7f620033c 100644 --- a/types/logid/id.go +++ b/types/logid/id.go @@ -11,9 +11,8 @@ "encoding/binary" "encoding/hex" "fmt" + "slices" "unicode/utf8" - - "golang.org/x/exp/slices" ) // PrivateID represents a log steam for writing. diff --git a/types/views/views.go b/types/views/views.go index 512a48732..5297ba864 100644 --- a/types/views/views.go +++ b/types/views/views.go @@ -8,10 +8,10 @@ import ( "encoding/json" "errors" + "maps" "net/netip" + "slices" - "golang.org/x/exp/maps" - "golang.org/x/exp/slices" "tailscale.com/net/tsaddr" ) diff --git a/util/multierr/multierr.go b/util/multierr/multierr.go index 8f40e0111..93ca068f5 100644 --- a/util/multierr/multierr.go +++ b/util/multierr/multierr.go @@ -7,9 +7,8 @@ import ( "errors" + "slices" "strings" - - "golang.org/x/exp/slices" ) // An Error represents multiple errors. diff --git a/util/set/slice.go b/util/set/slice.go index 589b903df..d52376cf4 100644 --- a/util/set/slice.go +++ b/util/set/slice.go @@ -4,7 +4,8 @@ package set import ( - "golang.org/x/exp/slices" + "slices" + "tailscale.com/types/views" ) diff --git a/util/slicesx/slicesx_test.go b/util/slicesx/slicesx_test.go index d2c917a5d..48efae4fb 100644 --- a/util/slicesx/slicesx_test.go +++ b/util/slicesx/slicesx_test.go @@ -5,9 +5,8 @@ import ( "reflect" + "slices" "testing" - - "golang.org/x/exp/slices" ) func TestInterleave(t *testing.T) { diff --git a/wgengine/filter/filter.go b/wgengine/filter/filter.go index cc341b6fc..b5ed82a54 100644 --- a/wgengine/filter/filter.go +++ b/wgengine/filter/filter.go @@ -7,11 +7,11 @@ import ( "fmt" "net/netip" + "slices" "sync" "time" "go4.org/netipx" - "golang.org/x/exp/slices" "tailscale.com/envknob" "tailscale.com/net/flowtrack" "tailscale.com/net/netaddr" diff --git a/wgengine/filter/filter_test.go b/wgengine/filter/filter_test.go index 28d9098f4..91bdb4fbc 100644 --- a/wgengine/filter/filter_test.go +++ b/wgengine/filter/filter_test.go @@ -7,6 +7,7 @@ "encoding/hex" "fmt" "net/netip" + "slices" "strconv" "strings" "testing" @@ -14,7 +15,6 @@ "github.com/google/go-cmp/cmp" "go4.org/netipx" "golang.org/x/exp/maps" - "golang.org/x/exp/slices" "tailscale.com/net/packet" "tailscale.com/net/tsaddr" "tailscale.com/tailcfg" diff --git a/wgengine/router/ifconfig_windows.go b/wgengine/router/ifconfig_windows.go index 76d3e82be..f6bb21c92 100644 --- a/wgengine/router/ifconfig_windows.go +++ b/wgengine/router/ifconfig_windows.go @@ -11,13 +11,13 @@ "log" "net" "net/netip" + "slices" "sort" "time" ole "github.com/go-ole/go-ole" "github.com/tailscale/wireguard-go/tun" "go4.org/netipx" - "golang.org/x/exp/slices" "golang.org/x/sys/windows" "golang.zx2c4.com/wireguard/windows/tunnel/winipcfg" "tailscale.com/health" diff --git a/wgengine/router/router_linux_test.go b/wgengine/router/router_linux_test.go index 268d6f647..761cdc44b 100644 --- a/wgengine/router/router_linux_test.go +++ b/wgengine/router/router_linux_test.go @@ -11,6 +11,7 @@ "os" "reflect" "regexp" + "slices" "sort" "strings" "sync" @@ -21,7 +22,6 @@ "github.com/tailscale/wireguard-go/tun" "github.com/vishvananda/netlink" "go4.org/netipx" - "golang.org/x/exp/slices" "tailscale.com/net/netmon" "tailscale.com/net/tsaddr" "tailscale.com/tstest" diff --git a/wgengine/userspace.go b/wgengine/userspace.go index 6774045aa..83f571b98 100644 --- a/wgengine/userspace.go +++ b/wgengine/userspace.go @@ -19,7 +19,6 @@ "github.com/tailscale/wireguard-go/device" "github.com/tailscale/wireguard-go/tun" - "golang.org/x/exp/maps" "tailscale.com/control/controlclient" "tailscale.com/envknob" "tailscale.com/health" @@ -619,7 +618,7 @@ func (e *userspaceEngine) maybeReconfigWireguardLocked(discoChanged map[key.Node // Don't re-alloc the map; the Go compiler optimizes map clears as of // Go 1.11, so we can re-use the existing + allocated map. if e.trimmedNodes != nil { - maps.Clear(e.trimmedNodes) + clear(e.trimmedNodes) } else { e.trimmedNodes = make(map[key.NodePublic]bool) } diff --git a/wgengine/wgcfg/nmcfg/nmcfg.go b/wgengine/wgcfg/nmcfg/nmcfg.go index 2349b8376..66b246ba9 100644 --- a/wgengine/wgcfg/nmcfg/nmcfg.go +++ b/wgengine/wgcfg/nmcfg/nmcfg.go @@ -8,9 +8,9 @@ "bytes" "fmt" "net/netip" + "slices" "strings" - "golang.org/x/exp/slices" "tailscale.com/net/tsaddr" "tailscale.com/tailcfg" "tailscale.com/types/logger"