Skip to content

Commit df1acfc

Browse files
authored
Merge pull request #3791 from Juneezee/refactor/exp
Replace `golang.org/x/exp` with stdlib
2 parents 0550d8d + f43a52a commit df1acfc

File tree

9 files changed

+6
-17
lines changed

9 files changed

+6
-17
lines changed

DEPENDENCIES.md

-1
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,6 @@ following Free and Open Source software:
142142
go.opentelemetry.io/otel/metric v1.34.0 Apache License 2.0
143143
go.opentelemetry.io/otel/trace v1.34.0 Apache License 2.0
144144
golang.org/x/crypto v0.32.0 3-clause BSD license
145-
golang.org/x/exp v0.0.0-20250106191152-7588d65b2ba8 3-clause BSD license
146145
golang.org/x/mod v0.22.0 3-clause BSD license
147146
golang.org/x/net v0.34.0 3-clause BSD license
148147
golang.org/x/oauth2 v0.25.0 3-clause BSD license

cmd/traffic/cmd/manager/cluster/subscriber.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,9 @@ import (
55
"context"
66
"fmt"
77
"net"
8+
"slices"
89
"sync"
910

10-
"golang.org/x/exp/slices"
11-
1211
rpc "github.com/telepresenceio/telepresence/rpc/v2/manager"
1312
)
1413

cmd/traffic/cmd/manager/service.go

+2-3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package manager
33
import (
44
"context"
55
"fmt"
6+
"maps"
67
"net/netip"
78
"slices"
89
"sort"
@@ -11,7 +12,6 @@ import (
1112
"github.com/blang/semver/v4"
1213
"github.com/google/uuid"
1314
dns2 "github.com/miekg/dns"
14-
"golang.org/x/exp/maps"
1515
"google.golang.org/grpc"
1616
"google.golang.org/grpc/codes"
1717
"google.golang.org/grpc/status"
@@ -414,8 +414,7 @@ func (s *service) watchAgents(ctx context.Context, includeAgent func(string, *rp
414414
dlog.Debug(ctx, "WatchAgentsNS request cancelled")
415415
return nil
416416
}
417-
agentSessionIDs := maps.Keys(snapshot.State)
418-
sort.Strings(agentSessionIDs)
417+
agentSessionIDs := slices.Sorted(maps.Keys(snapshot.State))
419418
agents := make([]*rpc.AgentInfo, len(agentSessionIDs))
420419
for i, agentSessionID := range agentSessionIDs {
421420
agents[i] = snapshot.State[agentSessionID]

go.mod

-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ require (
3737
github.com/telepresenceio/go-fuseftp/rpc v0.5.0
3838
github.com/telepresenceio/telepresence/rpc/v2 v2.21.1
3939
github.com/vishvananda/netlink v1.3.0
40-
golang.org/x/exp v0.0.0-20250106191152-7588d65b2ba8
4140
golang.org/x/net v0.34.0
4241
golang.org/x/sys v0.29.0
4342
golang.org/x/term v0.28.0

go.sum

-2
Original file line numberDiff line numberDiff line change
@@ -462,8 +462,6 @@ golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5y
462462
golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4=
463463
golang.org/x/crypto v0.32.0 h1:euUpcYgM8WcP71gNpTqQCn6rC2t6ULUPiOzfWaXVVfc=
464464
golang.org/x/crypto v0.32.0/go.mod h1:ZnnJkOaASj8g0AjIduWNlq2NRxL0PlBrbKVyZ6V/Ugc=
465-
golang.org/x/exp v0.0.0-20250106191152-7588d65b2ba8 h1:yqrTHse8TCMW1M1ZCP+VAR/l0kKxwaAIqN/il7x4voA=
466-
golang.org/x/exp v0.0.0-20250106191152-7588d65b2ba8/go.mod h1:tujkw807nyEEAamNbDrEGzRav+ilXA7PCRAd6xsmwiU=
467465
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
468466
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
469467
golang.org/x/mod v0.5.1/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro=

pkg/client/rootd/vip/env_nat_test.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,10 @@ package vip
22

33
import (
44
"context"
5+
"maps"
56
"net/netip"
67
"testing"
78

8-
"golang.org/x/exp/maps"
9-
109
"github.com/datawire/dlib/dlog"
1110
)
1211

pkg/maps/utils.go

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
package maps
22

33
import (
4+
"cmp"
45
"sort"
5-
6-
"golang.org/x/exp/constraints"
76
)
87

98
// Copy creates a copy of the given map and returns it.
@@ -36,7 +35,7 @@ func Merge[K comparable, V any](dst, src map[K]V) {
3635
}
3736

3837
// ToSortedSlice returns a slice of the values in the given map, sorted by that map's keys.
39-
func ToSortedSlice[K constraints.Ordered, V any](m map[K]V) []V {
38+
func ToSortedSlice[K cmp.Ordered, V any](m map[K]V) []V {
4039
ns := make([]K, len(m))
4140
i := 0
4241
for n := range m {

pkg/vif/testdata/router/go.mod

-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ require (
5454
github.com/vishvananda/netns v0.0.5 // indirect
5555
github.com/x448/float16 v0.8.4 // indirect
5656
github.com/xlab/treeprint v1.2.0 // indirect
57-
golang.org/x/exp v0.0.0-20250106191152-7588d65b2ba8 // indirect
5857
golang.org/x/net v0.34.0 // indirect
5958
golang.org/x/oauth2 v0.25.0 // indirect
6059
golang.org/x/sync v0.10.0 // indirect

pkg/vif/testdata/router/go.sum

-2
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,6 @@ go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE=
150150
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
151151
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
152152
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
153-
golang.org/x/exp v0.0.0-20250106191152-7588d65b2ba8 h1:yqrTHse8TCMW1M1ZCP+VAR/l0kKxwaAIqN/il7x4voA=
154-
golang.org/x/exp v0.0.0-20250106191152-7588d65b2ba8/go.mod h1:tujkw807nyEEAamNbDrEGzRav+ilXA7PCRAd6xsmwiU=
155153
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
156154
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
157155
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=

0 commit comments

Comments
 (0)