From 6740518403e2312b171b5b65732e45265ec01925 Mon Sep 17 00:00:00 2001 From: Wade Simmons Date: Tue, 18 Aug 2026 14:49:41 -0400 Subject: [PATCH] use stdlib maps.Values (#1843) * use stdlib maps.Values This has been in stdlib since go1.23, no need to use golang.org/x/exp anymore just for this: - https://pkg.go.dev/maps#Values * use slices.AppendSeq to match old behavior --- e2e/router/router.go | 5 +++-- go.mod | 1 - go.sum | 2 -- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/e2e/router/router.go b/e2e/router/router.go index 2556079c..c5f69118 100644 --- a/e2e/router/router.go +++ b/e2e/router/router.go @@ -6,11 +6,13 @@ package router import ( "context" "fmt" + "maps" "net/netip" "os" "path/filepath" "reflect" "regexp" + "slices" "sort" "sync" "sync/atomic" @@ -22,7 +24,6 @@ import ( "github.com/slackhq/nebula" "github.com/slackhq/nebula/header" "github.com/slackhq/nebula/udp" - "golang.org/x/exp/maps" ) // outNatKey is the (from, to) pair used by outNat. Comparable struct, so it works as a map key without the @@ -374,7 +375,7 @@ func (r *R) RenderHostmaps(title string, controls ...*nebula.Control) { } func (r *R) renderHostmaps(title string) { - c := maps.Values(r.controls) + c := slices.AppendSeq(make([]*nebula.Control, 0, len(r.controls)), maps.Values(r.controls)) sort.SliceStable(c, func(i, j int) bool { return c[i].GetVpnAddrs()[0].Compare(c[j].GetVpnAddrs()[0]) > 0 }) diff --git a/go.mod b/go.mod index 1115b248..192096d8 100644 --- a/go.mod +++ b/go.mod @@ -25,7 +25,6 @@ require ( go.uber.org/goleak v1.3.0 go.yaml.in/yaml/v3 v3.0.5 golang.org/x/crypto v0.54.0 - golang.org/x/exp v0.0.0-20230725093048-515e97ebf090 golang.org/x/net v0.57.0 golang.org/x/sync v0.22.0 golang.org/x/sys v0.47.0 diff --git a/go.sum b/go.sum index 1e95a566..e33813ad 100644 --- a/go.sum +++ b/go.sum @@ -161,8 +161,6 @@ golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.54.0 h1:YLIA59K4fiNzHzjnZt2tUJQjQtUWfWbeHBqKtk3eScw= golang.org/x/crypto v0.54.0/go.mod h1:KWL8ny2AZdGR2cWmzeHrp2azQPGogOv+HeQaVEXC2dk= -golang.org/x/exp v0.0.0-20230725093048-515e97ebf090 h1:Di6/M8l0O2lCLc6VVRWhgCiApHV8MnQurBnFSHsQtNY= -golang.org/x/exp v0.0.0-20230725093048-515e97ebf090/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc= golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=