From 51215bf102d9f8a0e6803a33e8d1628a1d76e13a Mon Sep 17 00:00:00 2001 From: Seth Hoenig Date: Mon, 16 Sep 2024 13:40:10 -0500 Subject: [PATCH] deps: update to go-set/v3 and refactor to use custom iterators (#23971) * deps: update to go-set/v3 * deps: use custom set iterators for looping --- client/acl.go | 2 +- client/allocdir/task_dir.go | 2 +- client/allocrunner/consul_grpc_sock_hook.go | 8 +++----- client/allocrunner/consul_http_sock_hook.go | 7 +++---- client/allocrunner/networking_cni.go | 2 +- client/lib/cgroupslib/editor.go | 7 +++---- client/lib/cgroupslib/mount.go | 2 +- client/lib/idset/idset.go | 4 ++-- client/serviceregistration/watcher.go | 2 +- command/acl_token_create.go | 2 +- command/agent/consul/service_client.go | 9 ++++----- command/job_restart.go | 6 +++--- command/job_restart_test.go | 2 +- command/node_pool.go | 2 +- command/node_pool_delete.go | 2 +- command/node_pool_test.go | 2 +- command/var_put.go | 8 ++++---- drivers/docker/driver.go | 2 +- drivers/docker/reconcile_dangling.go | 4 ++-- drivers/docker/reconcile_dangling_test.go | 2 +- drivers/docker/state.go | 2 +- drivers/shared/executor/executor_basic.go | 2 +- drivers/shared/executor/executor_linux.go | 2 +- drivers/shared/executor/executor_universal_linux.go | 2 +- drivers/shared/executor/procstats/getstats.go | 2 +- drivers/shared/executor/procstats/list_default.go | 2 +- drivers/shared/executor/procstats/list_linux.go | 2 +- drivers/shared/executor/procstats/list_windows.go | 2 +- drivers/shared/executor/procstats/procstats.go | 2 +- e2e/acl/helpers.go | 10 +++++----- e2e/consulcompat/consulcompat_test.go | 5 ++--- e2e/consulcompat/shared_download_test.go | 2 +- e2e/nodedrain/node_drain_test.go | 2 +- e2e/v3/jobs3/jobs3.go | 2 +- e2e/v3/namespaces3/namespaces3.go | 10 +++++----- e2e/vaultcompat/vaultcompat_test.go | 7 +++---- go.mod | 5 +++-- go.sum | 2 ++ helper/funcs.go | 2 +- helper/funcs_test.go | 2 +- helper/users/dynamic/pool.go | 2 +- nomad/acl_endpoint.go | 2 +- nomad/eval_endpoint_test.go | 2 +- nomad/job_endpoint.go | 2 +- nomad/job_endpoint_hook_connect.go | 2 +- nomad/job_endpoint_statuses.go | 2 +- nomad/node_pool_endpoint_test.go | 2 +- nomad/service_registration_endpoint.go | 2 +- nomad/state/state_store.go | 6 +++--- nomad/structs/acl.go | 2 +- nomad/structs/config/workload_id.go | 2 +- nomad/structs/funcs.go | 2 +- nomad/structs/job.go | 2 +- nomad/structs/job_test.go | 2 +- nomad/structs/services.go | 2 +- nomad/structs/structs.go | 2 +- scheduler/device.go | 2 +- scheduler/device_test.go | 2 +- scheduler/propertyset.go | 2 +- scheduler/rank.go | 2 +- scheduler/reconcile_test.go | 2 +- scheduler/spread_test.go | 2 +- scheduler/util.go | 2 +- tools/go.mod | 10 ++++------ tools/go.sum | 12 ++++++------ tools/missing/main.go | 5 +++-- 66 files changed, 108 insertions(+), 113 deletions(-) diff --git a/client/acl.go b/client/acl.go index b4a5e0f5ec5..fee8472d403 100644 --- a/client/acl.go +++ b/client/acl.go @@ -7,7 +7,7 @@ import ( "time" "github.com/armon/go-metrics" - "github.com/hashicorp/go-set/v2" + "github.com/hashicorp/go-set/v3" "github.com/hashicorp/nomad/acl" "github.com/hashicorp/nomad/nomad/structs" ) diff --git a/client/allocdir/task_dir.go b/client/allocdir/task_dir.go index ac0cdd450f8..143c6e75319 100644 --- a/client/allocdir/task_dir.go +++ b/client/allocdir/task_dir.go @@ -10,7 +10,7 @@ import ( "github.com/hashicorp/go-hclog" "github.com/hashicorp/go-multierror" - "github.com/hashicorp/go-set/v2" + "github.com/hashicorp/go-set/v3" "github.com/hashicorp/nomad/helper/users/dynamic" "github.com/hashicorp/nomad/plugins/drivers/fsisolation" ) diff --git a/client/allocrunner/consul_grpc_sock_hook.go b/client/allocrunner/consul_grpc_sock_hook.go index 492f06d0992..e8682471096 100644 --- a/client/allocrunner/consul_grpc_sock_hook.go +++ b/client/allocrunner/consul_grpc_sock_hook.go @@ -17,7 +17,7 @@ import ( "github.com/hashicorp/go-hclog" multierror "github.com/hashicorp/go-multierror" - "github.com/hashicorp/go-set/v2" + "github.com/hashicorp/go-set/v3" "github.com/hashicorp/nomad/client/allocdir" "github.com/hashicorp/nomad/client/allocrunner/interfaces" "github.com/hashicorp/nomad/nomad/structs" @@ -72,8 +72,7 @@ func newConsulGRPCSocketHook( } proxies := map[string]*grpcSocketProxy{} - clusterNames.ForEach(func(clusterName string) bool { - + for clusterName := range clusterNames.Items() { // Attempt to find the gRPC port via the node attributes, otherwise use // the default fallback. attrName := "consul.grpc" @@ -91,8 +90,7 @@ func newConsulGRPCSocketHook( configs[clusterName], consulGRPCPort, ) - return true - }) + } return &consulGRPCSocketHook{ alloc: alloc, diff --git a/client/allocrunner/consul_http_sock_hook.go b/client/allocrunner/consul_http_sock_hook.go index f4990974a6e..b817e7aa854 100644 --- a/client/allocrunner/consul_http_sock_hook.go +++ b/client/allocrunner/consul_http_sock_hook.go @@ -15,7 +15,7 @@ import ( "github.com/hashicorp/go-hclog" multierror "github.com/hashicorp/go-multierror" - "github.com/hashicorp/go-set/v2" + "github.com/hashicorp/go-set/v3" "github.com/hashicorp/nomad/client/allocdir" "github.com/hashicorp/nomad/client/allocrunner/interfaces" "github.com/hashicorp/nomad/nomad/structs" @@ -59,14 +59,13 @@ func newConsulHTTPSocketHook( } proxies := map[string]*httpSocketProxy{} - clusterNames.ForEach(func(clusterName string) bool { + for clusterName := range clusterNames.Items() { proxies[clusterName] = newHTTPSocketProxy( logger, allocDir, configs[clusterName], ) - return true - }) + } return &consulHTTPSockHook{ alloc: alloc, diff --git a/client/allocrunner/networking_cni.go b/client/allocrunner/networking_cni.go index 5aada33d104..da5afcd4ef6 100644 --- a/client/allocrunner/networking_cni.go +++ b/client/allocrunner/networking_cni.go @@ -27,7 +27,7 @@ import ( cnilibrary "github.com/containernetworking/cni/libcni" consulIPTables "github.com/hashicorp/consul/sdk/iptables" log "github.com/hashicorp/go-hclog" - "github.com/hashicorp/go-set/v2" + "github.com/hashicorp/go-set/v3" "github.com/hashicorp/nomad/helper" "github.com/hashicorp/nomad/helper/envoy" "github.com/hashicorp/nomad/nomad/structs" diff --git a/client/lib/cgroupslib/editor.go b/client/lib/cgroupslib/editor.go index 96ef95c4c95..13519424bc3 100644 --- a/client/lib/cgroupslib/editor.go +++ b/client/lib/cgroupslib/editor.go @@ -13,7 +13,7 @@ import ( "strconv" "strings" - "github.com/hashicorp/go-set/v2" + "github.com/hashicorp/go-set/v3" "golang.org/x/sys/unix" ) @@ -176,10 +176,9 @@ func (l *lifeCG1) Kill() error { } signal := unix.SignalNum("SIGKILL") - pids.ForEach(func(pid int) bool { + for pid := range pids.Items() { _ = unix.Kill(pid, signal) - return true - }) + } return l.thaw() } diff --git a/client/lib/cgroupslib/mount.go b/client/lib/cgroupslib/mount.go index 4042546ab89..92935f4575c 100644 --- a/client/lib/cgroupslib/mount.go +++ b/client/lib/cgroupslib/mount.go @@ -13,7 +13,7 @@ import ( "strings" "syscall" - "github.com/hashicorp/go-set/v2" + "github.com/hashicorp/go-set/v3" ) // detect tries to detect which cgroups version we have by looking at the mount diff --git a/client/lib/idset/idset.go b/client/lib/idset/idset.go index d6e8307f13f..f41b8caa2ad 100644 --- a/client/lib/idset/idset.go +++ b/client/lib/idset/idset.go @@ -12,7 +12,7 @@ import ( "strconv" "strings" - "github.com/hashicorp/go-set/v2" + "github.com/hashicorp/go-set/v3" ) // An ID is representative of a non-negative identifier of something like @@ -184,7 +184,7 @@ func (s *Set[T]) String() string { // ForEach iterates the elements in the set and applies f. Iteration stops // if the result of f is a non-nil error. func (s *Set[T]) ForEach(f func(id T) error) error { - for _, id := range s.items.Slice() { + for id := range s.items.Items() { if err := f(id); err != nil { return err } diff --git a/client/serviceregistration/watcher.go b/client/serviceregistration/watcher.go index ba134f1d718..94ee1e84da1 100644 --- a/client/serviceregistration/watcher.go +++ b/client/serviceregistration/watcher.go @@ -9,7 +9,7 @@ import ( "time" "github.com/hashicorp/go-hclog" - "github.com/hashicorp/go-set/v2" + "github.com/hashicorp/go-set/v3" "github.com/hashicorp/nomad/helper" "github.com/hashicorp/nomad/nomad/structs" ) diff --git a/command/acl_token_create.go b/command/acl_token_create.go index 70c09efd6d2..ecc187161ff 100644 --- a/command/acl_token_create.go +++ b/command/acl_token_create.go @@ -8,7 +8,7 @@ import ( "strings" "time" - "github.com/hashicorp/go-set/v2" + "github.com/hashicorp/go-set/v3" "github.com/hashicorp/nomad/api" "github.com/hashicorp/nomad/helper" "github.com/posener/complete" diff --git a/command/agent/consul/service_client.go b/command/agent/consul/service_client.go index 266de37ad1d..973dd3649ef 100644 --- a/command/agent/consul/service_client.go +++ b/command/agent/consul/service_client.go @@ -22,7 +22,7 @@ import ( "github.com/armon/go-metrics" "github.com/hashicorp/consul/api" "github.com/hashicorp/go-hclog" - "github.com/hashicorp/go-set/v2" + "github.com/hashicorp/go-set/v3" "github.com/hashicorp/nomad/client/serviceregistration" "github.com/hashicorp/nomad/helper" "github.com/hashicorp/nomad/helper/envoy" @@ -1824,8 +1824,7 @@ func (c *ServiceClient) Shutdown() error { // Always attempt to deregister Nomad agent Consul entries, even if // deadline was reached - for _, id := range c.agentServices.Slice() { - + for id := range c.agentServices.Items() { opts := &api.QueryOptions{ Token: c.getServiceToken(id), } @@ -1860,7 +1859,7 @@ func (c *ServiceClient) Shutdown() error { return false } - for _, id := range c.agentChecks.Slice() { + for id := range c.agentChecks.Items() { // if we couldn't populate remainingChecks it is unlikely that CheckDeregister will work, but try anyway // if we could list the remaining checks, verify that the check we store still exists before removing it. if remainingChecks == nil || checkRemains(id) { @@ -1932,7 +1931,7 @@ func (c *ServiceClient) setServiceTokens(tokens map[string]string) { func (c *ServiceClient) gcDeregisteredServiceTokens() { c.serviceTokensLock.Lock() defer c.serviceTokensLock.Unlock() - for _, serviceID := range c.explicitlyDeregisteredServices.Slice() { + for serviceID := range c.explicitlyDeregisteredServices.Items() { delete(c.serviceTokens, serviceID) } } diff --git a/command/job_restart.go b/command/job_restart.go index 102cd9874b5..30385b85c3a 100644 --- a/command/job_restart.go +++ b/command/job_restart.go @@ -18,7 +18,7 @@ import ( humanize "github.com/dustin/go-humanize" "github.com/dustin/go-humanize/english" multierror "github.com/hashicorp/go-multierror" - "github.com/hashicorp/go-set/v2" + "github.com/hashicorp/go-set/v3" "github.com/hashicorp/nomad/api" "github.com/hashicorp/nomad/api/contexts" "github.com/posener/complete" @@ -674,7 +674,7 @@ func (c *JobRestartCommand) filterAllocs(stubs []AllocationListStubWithJob) []Al // Skip allocations that don't have any of the requested tasks. if c.tasks.Size() > 0 { hasTask := false - for _, taskName := range c.tasks.Slice() { + for taskName := range c.tasks.Items() { if stub.HasTask(taskName) { hasTask = true break @@ -910,7 +910,7 @@ func (c *JobRestartCommand) restartAlloc(alloc AllocationListStubWithJob) error // Run restarts concurrently when specific tasks were requested. var restarts multierror.Group - for _, task := range c.tasks.Slice() { + for task := range c.tasks.Items() { if !alloc.HasTask(task) { continue } diff --git a/command/job_restart_test.go b/command/job_restart_test.go index 4104fd87c39..7ab11abd9d1 100644 --- a/command/job_restart_test.go +++ b/command/job_restart_test.go @@ -18,7 +18,7 @@ import ( "time" "github.com/google/go-cmp/cmp/cmpopts" - "github.com/hashicorp/go-set/v2" + "github.com/hashicorp/go-set/v3" "github.com/hashicorp/nomad/api" "github.com/hashicorp/nomad/ci" "github.com/hashicorp/nomad/command/agent" diff --git a/command/node_pool.go b/command/node_pool.go index f16d5920313..66782ecd4a1 100644 --- a/command/node_pool.go +++ b/command/node_pool.go @@ -7,7 +7,7 @@ import ( "fmt" "strings" - "github.com/hashicorp/go-set/v2" + "github.com/hashicorp/go-set/v3" "github.com/hashicorp/nomad/api" "github.com/hashicorp/nomad/api/contexts" "github.com/mitchellh/cli" diff --git a/command/node_pool_delete.go b/command/node_pool_delete.go index 45003dcb733..ac34d12ae64 100644 --- a/command/node_pool_delete.go +++ b/command/node_pool_delete.go @@ -7,7 +7,7 @@ import ( "fmt" "strings" - "github.com/hashicorp/go-set/v2" + "github.com/hashicorp/go-set/v3" "github.com/hashicorp/nomad/api" "github.com/posener/complete" ) diff --git a/command/node_pool_test.go b/command/node_pool_test.go index d502802681e..e589be2ed6c 100644 --- a/command/node_pool_test.go +++ b/command/node_pool_test.go @@ -7,7 +7,7 @@ import ( "regexp" "testing" - "github.com/hashicorp/go-set/v2" + "github.com/hashicorp/go-set/v3" "github.com/hashicorp/nomad/api" "github.com/hashicorp/nomad/ci" "github.com/mitchellh/cli" diff --git a/command/var_put.go b/command/var_put.go index 7115bc802e2..e98604c7807 100644 --- a/command/var_put.go +++ b/command/var_put.go @@ -15,7 +15,7 @@ import ( "strings" multierror "github.com/hashicorp/go-multierror" - "github.com/hashicorp/go-set/v2" + "github.com/hashicorp/go-set/v3" "github.com/hashicorp/hcl" "github.com/hashicorp/hcl/hcl/ast" "github.com/hashicorp/nomad/api" @@ -588,11 +588,11 @@ func formatInvalidVarKeyChars(invalid []string) string { // Sort the characters for output charList := make([]string, 0, chars.Size()) - chars.ForEach(func(k string) bool { + + for k := range chars.Items() { // Use %s instead of %q to avoid escaping characters. charList = append(charList, fmt.Sprintf(`"%s"`, k)) - return true - }) + } slices.Sort(charList) diff --git a/drivers/docker/driver.go b/drivers/docker/driver.go index 6128d589b65..5613b213f2c 100644 --- a/drivers/docker/driver.go +++ b/drivers/docker/driver.go @@ -23,7 +23,7 @@ import ( hclog "github.com/hashicorp/go-hclog" multierror "github.com/hashicorp/go-multierror" plugin "github.com/hashicorp/go-plugin" - "github.com/hashicorp/go-set/v2" + "github.com/hashicorp/go-set/v3" "github.com/hashicorp/nomad/client/lib/cgroupslib" "github.com/hashicorp/nomad/client/lib/cpustats" "github.com/hashicorp/nomad/client/taskenv" diff --git a/drivers/docker/reconcile_dangling.go b/drivers/docker/reconcile_dangling.go index bf25edb985c..923b65ba8b5 100644 --- a/drivers/docker/reconcile_dangling.go +++ b/drivers/docker/reconcile_dangling.go @@ -12,7 +12,7 @@ import ( docker "github.com/fsouza/go-dockerclient" hclog "github.com/hashicorp/go-hclog" - "github.com/hashicorp/go-set/v2" + "github.com/hashicorp/go-set/v3" ) // containerReconciler detects and kills unexpectedly running containers. @@ -114,7 +114,7 @@ func (r *containerReconciler) removeDanglingContainersIteration() error { return err } - for _, id := range untracked.Slice() { + for id := range untracked.Items() { ctx, cancel := r.dockerAPIQueryContext() err := dockerClient.RemoveContainer(docker.RemoveContainerOptions{ Context: ctx, diff --git a/drivers/docker/reconcile_dangling_test.go b/drivers/docker/reconcile_dangling_test.go index 5229ae06851..5728bc5e704 100644 --- a/drivers/docker/reconcile_dangling_test.go +++ b/drivers/docker/reconcile_dangling_test.go @@ -12,7 +12,7 @@ import ( "time" docker "github.com/fsouza/go-dockerclient" - "github.com/hashicorp/go-set/v2" + "github.com/hashicorp/go-set/v3" "github.com/shoenig/test/must" "github.com/shoenig/test/wait" diff --git a/drivers/docker/state.go b/drivers/docker/state.go index 9c172a91447..9ba655705bb 100644 --- a/drivers/docker/state.go +++ b/drivers/docker/state.go @@ -6,7 +6,7 @@ package docker import ( "sync" - "github.com/hashicorp/go-set/v2" + "github.com/hashicorp/go-set/v3" ) type taskStore struct { diff --git a/drivers/shared/executor/executor_basic.go b/drivers/shared/executor/executor_basic.go index e7443167abf..bb0b42bde96 100644 --- a/drivers/shared/executor/executor_basic.go +++ b/drivers/shared/executor/executor_basic.go @@ -9,7 +9,7 @@ import ( "os/exec" "github.com/hashicorp/go-hclog" - "github.com/hashicorp/go-set/v2" + "github.com/hashicorp/go-set/v3" "github.com/hashicorp/nomad/client/lib/cpustats" "github.com/hashicorp/nomad/drivers/shared/executor/procstats" "github.com/hashicorp/nomad/plugins/drivers" diff --git a/drivers/shared/executor/executor_linux.go b/drivers/shared/executor/executor_linux.go index f83d88ec1d9..6baef44ca5e 100644 --- a/drivers/shared/executor/executor_linux.go +++ b/drivers/shared/executor/executor_linux.go @@ -23,7 +23,7 @@ import ( "github.com/armon/circbuf" "github.com/hashicorp/consul-template/signals" hclog "github.com/hashicorp/go-hclog" - "github.com/hashicorp/go-set/v2" + "github.com/hashicorp/go-set/v3" "github.com/hashicorp/nomad/client/allocdir" "github.com/hashicorp/nomad/client/lib/cgroupslib" "github.com/hashicorp/nomad/client/lib/cpustats" diff --git a/drivers/shared/executor/executor_universal_linux.go b/drivers/shared/executor/executor_universal_linux.go index 1ce8615c283..89c5486038b 100644 --- a/drivers/shared/executor/executor_universal_linux.go +++ b/drivers/shared/executor/executor_universal_linux.go @@ -12,7 +12,7 @@ import ( "strconv" "syscall" - "github.com/hashicorp/go-set/v2" + "github.com/hashicorp/go-set/v3" "github.com/hashicorp/nomad/client/lib/cgroupslib" "github.com/hashicorp/nomad/client/lib/nsutil" "github.com/hashicorp/nomad/drivers/shared/executor/procstats" diff --git a/drivers/shared/executor/procstats/getstats.go b/drivers/shared/executor/procstats/getstats.go index 062145cb270..690942110c4 100644 --- a/drivers/shared/executor/procstats/getstats.go +++ b/drivers/shared/executor/procstats/getstats.go @@ -63,7 +63,7 @@ func (lps *linuxProcStats) scanPIDs() { } // insert trackers for new pids not yet present - for _, pid := range currentPIDs.Slice() { + for pid := range currentPIDs.Items() { if _, exists := lps.latest[pid]; !exists { lps.latest[pid] = &stats{ TotalCPU: cpustats.New(lps.compute), diff --git a/drivers/shared/executor/procstats/list_default.go b/drivers/shared/executor/procstats/list_default.go index 04553e73a95..b6df7d386c5 100644 --- a/drivers/shared/executor/procstats/list_default.go +++ b/drivers/shared/executor/procstats/list_default.go @@ -9,7 +9,7 @@ import ( "context" "time" - "github.com/hashicorp/go-set/v2" + "github.com/hashicorp/go-set/v3" "github.com/hashicorp/nomad/lib/lang" "github.com/shirou/gopsutil/v3/process" ) diff --git a/drivers/shared/executor/procstats/list_linux.go b/drivers/shared/executor/procstats/list_linux.go index 837935bfb16..bbe70c531d1 100644 --- a/drivers/shared/executor/procstats/list_linux.go +++ b/drivers/shared/executor/procstats/list_linux.go @@ -6,7 +6,7 @@ package procstats import ( - "github.com/hashicorp/go-set/v2" + "github.com/hashicorp/go-set/v3" "github.com/hashicorp/nomad/client/lib/cgroupslib" ) diff --git a/drivers/shared/executor/procstats/list_windows.go b/drivers/shared/executor/procstats/list_windows.go index 8e01deab11a..c6affafab33 100644 --- a/drivers/shared/executor/procstats/list_windows.go +++ b/drivers/shared/executor/procstats/list_windows.go @@ -6,7 +6,7 @@ package procstats import ( - "github.com/hashicorp/go-set/v2" + "github.com/hashicorp/go-set/v3" "github.com/mitchellh/go-ps" ) diff --git a/drivers/shared/executor/procstats/procstats.go b/drivers/shared/executor/procstats/procstats.go index 04d157d4ee0..1f7e87ea0ce 100644 --- a/drivers/shared/executor/procstats/procstats.go +++ b/drivers/shared/executor/procstats/procstats.go @@ -6,7 +6,7 @@ package procstats import ( "time" - "github.com/hashicorp/go-set/v2" + "github.com/hashicorp/go-set/v3" "github.com/hashicorp/nomad/client/lib/cpustats" "github.com/hashicorp/nomad/plugins/drivers" ) diff --git a/e2e/acl/helpers.go b/e2e/acl/helpers.go index 06c80e8d9f3..0404194465b 100644 --- a/e2e/acl/helpers.go +++ b/e2e/acl/helpers.go @@ -6,7 +6,7 @@ package acl import ( "testing" - "github.com/hashicorp/go-set/v2" + "github.com/hashicorp/go-set/v3" "github.com/hashicorp/nomad/api" "github.com/shoenig/test" "github.com/shoenig/test/must" @@ -48,22 +48,22 @@ func NewCleanup() *Cleanup { // Any failure will ultimately fail the test, but will not stop the attempts to // delete all the resources. func (c *Cleanup) Run(t *testing.T, nomadClient *api.Client) { - for _, namespace := range c.namespaces.Slice() { + for namespace := range c.namespaces.Items() { _, err := nomadClient.Namespaces().Delete(namespace, nil) test.NoError(t, err) } - for _, policy := range c.aclPolicies.Slice() { + for policy := range c.aclPolicies.Items() { _, err := nomadClient.ACLPolicies().Delete(policy, nil) test.NoError(t, err) } - for _, role := range c.aclRoles.Slice() { + for role := range c.aclRoles.Items() { _, err := nomadClient.ACLRoles().Delete(role, nil) test.NoError(t, err) } - for _, token := range c.aclTokens.Slice() { + for token := range c.aclTokens.Items() { _, err := nomadClient.ACLTokens().Delete(token, nil) test.NoError(t, err) } diff --git a/e2e/consulcompat/consulcompat_test.go b/e2e/consulcompat/consulcompat_test.go index 91e9949e479..3769e3748ff 100644 --- a/e2e/consulcompat/consulcompat_test.go +++ b/e2e/consulcompat/consulcompat_test.go @@ -32,12 +32,11 @@ func TestConsulCompat(t *testing.T) { } versions := scanConsulVersions(t, getMinimumVersion(t)) - versions.ForEach(func(b build) bool { + for b := range versions.Items() { downloadConsulBuild(t, b, baseDir) testConsulBuildLegacy(t, b, baseDir) testConsulBuild(t, b, baseDir) - return true - }) + } }) } diff --git a/e2e/consulcompat/shared_download_test.go b/e2e/consulcompat/shared_download_test.go index 728fed20359..9c08b372bab 100644 --- a/e2e/consulcompat/shared_download_test.go +++ b/e2e/consulcompat/shared_download_test.go @@ -14,7 +14,7 @@ import ( "time" "github.com/hashicorp/go-cleanhttp" - "github.com/hashicorp/go-set/v2" + "github.com/hashicorp/go-set/v3" "github.com/hashicorp/go-version" "github.com/shoenig/test/must" ) diff --git a/e2e/nodedrain/node_drain_test.go b/e2e/nodedrain/node_drain_test.go index c76656325d7..e1514863267 100644 --- a/e2e/nodedrain/node_drain_test.go +++ b/e2e/nodedrain/node_drain_test.go @@ -10,7 +10,7 @@ import ( "testing" "time" - "github.com/hashicorp/go-set/v2" + "github.com/hashicorp/go-set/v3" "github.com/shoenig/test" "github.com/shoenig/test/must" "github.com/shoenig/test/wait" diff --git a/e2e/v3/jobs3/jobs3.go b/e2e/v3/jobs3/jobs3.go index b9d8452810d..ffbea060d1b 100644 --- a/e2e/v3/jobs3/jobs3.go +++ b/e2e/v3/jobs3/jobs3.go @@ -14,7 +14,7 @@ import ( "testing" "time" - "github.com/hashicorp/go-set/v2" + "github.com/hashicorp/go-set/v3" nomadapi "github.com/hashicorp/nomad/api" "github.com/hashicorp/nomad/e2e/v3/util3" "github.com/hashicorp/nomad/helper/pointer" diff --git a/e2e/v3/namespaces3/namespaces3.go b/e2e/v3/namespaces3/namespaces3.go index 82b0a879706..81b2a267d4a 100644 --- a/e2e/v3/namespaces3/namespaces3.go +++ b/e2e/v3/namespaces3/namespaces3.go @@ -7,7 +7,7 @@ import ( "testing" "time" - "github.com/hashicorp/go-set/v2" + "github.com/hashicorp/go-set/v3" nomadapi "github.com/hashicorp/nomad/api" "github.com/hashicorp/nomad/e2e/v3/util3" "github.com/hashicorp/nomad/helper" @@ -40,7 +40,7 @@ func (g *Names) cleanup() { namespaceAPI := g.nomadClient.Namespaces() // remove any namespaces we created (or updated) - for _, namespace := range g.apply.Slice() { + for namespace := range g.apply.Items() { name := namespace.Name g.logf("cleanup namespace %q", name) _, err := namespaceAPI.Delete(name, nil) @@ -75,7 +75,7 @@ func configure(t *testing.T, opts ...Option) Cleanup { g := &Names{ t: t, timeout: 10 * time.Second, - apply: set.NewHashSet[*Namespace, string](3), + apply: set.NewHashSet[*Namespace](3), remove: set.New[string](3), } @@ -93,14 +93,14 @@ func (g *Names) run() { namespacesAPI := g.nomadClient.Namespaces() // do deletions - for _, namespace := range g.remove.Slice() { + for namespace := range g.remove.Items() { g.logf("delete namespace %q", namespace) _, err := namespacesAPI.Delete(namespace, nil) must.NoError(g.t, err) } // do applies - for _, namespace := range g.apply.Slice() { + for namespace := range g.apply.Items() { g.logf("apply namespace %q", namespace) _, err := namespacesAPI.Register(&nomadapi.Namespace{ Name: namespace.Name, diff --git a/e2e/vaultcompat/vaultcompat_test.go b/e2e/vaultcompat/vaultcompat_test.go index 6cb31115188..1210102744b 100644 --- a/e2e/vaultcompat/vaultcompat_test.go +++ b/e2e/vaultcompat/vaultcompat_test.go @@ -16,7 +16,7 @@ import ( "time" "github.com/hashicorp/go-cleanhttp" - "github.com/hashicorp/go-set/v2" + "github.com/hashicorp/go-set/v3" "github.com/hashicorp/go-version" goversion "github.com/hashicorp/go-version" "github.com/hashicorp/nomad/api" @@ -54,11 +54,10 @@ func TestVaultCompat(t *testing.T) { func testVaultVersions(t *testing.T) { versions := scanVaultVersions(t, getMinimumVersion(t)) - versions.ForEach(func(b build) bool { + for b := range versions.Items() { downloadVaultBuild(t, b) testVaultBuild(t, b) - return true - }) + } } func testVaultBuild(t *testing.T, b build) { diff --git a/go.mod b/go.mod index 378ef0b9f47..f3349ce9996 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/hashicorp/nomad -go 1.22 +go 1.23 // Pinned dependencies are noted in github.com/hashicorp/nomad/issues/11826. replace ( @@ -69,7 +69,7 @@ require ( github.com/hashicorp/go-plugin v1.6.0 github.com/hashicorp/go-secure-stdlib/listenerutil v0.1.4 github.com/hashicorp/go-secure-stdlib/strutil v0.1.2 - github.com/hashicorp/go-set/v2 v2.1.0 + github.com/hashicorp/go-set/v3 v3.0.0-alpha.1 github.com/hashicorp/go-sockaddr v1.0.6 github.com/hashicorp/go-syslog v1.0.0 github.com/hashicorp/go-uuid v1.0.3 @@ -228,6 +228,7 @@ require ( github.com/hashicorp/go-secure-stdlib/parseutil v0.1.7 // indirect github.com/hashicorp/go-secure-stdlib/reloadutil v0.1.1 // indirect github.com/hashicorp/go-secure-stdlib/tlsutil v0.1.2 // indirect + github.com/hashicorp/go-set/v2 v2.1.0 // indirect github.com/hashicorp/golang-lru v1.0.2 // indirect github.com/hashicorp/mdns v1.0.4 // indirect github.com/hashicorp/vault/api/auth/kubernetes v0.5.0 // indirect diff --git a/go.sum b/go.sum index 9f154ff3f1b..73fe31fa9dd 100644 --- a/go.sum +++ b/go.sum @@ -717,6 +717,8 @@ github.com/hashicorp/go-secure-stdlib/tlsutil v0.1.2 h1:phcbL8urUzF/kxA/Oj6awENa github.com/hashicorp/go-secure-stdlib/tlsutil v0.1.2/go.mod h1:l8slYwnJA26yBz+ErHpp2IRCLr0vuOMGBORIz4rRiAs= github.com/hashicorp/go-set/v2 v2.1.0 h1:iERPCQWks+I+4bTgy0CT2myZsCqNgBg79ZHqwniohXo= github.com/hashicorp/go-set/v2 v2.1.0/go.mod h1:6q4nh8UCVZODn2tJ5RbJi8+ki7pjZBsAEYGt6yaGeTo= +github.com/hashicorp/go-set/v3 v3.0.0-alpha.1 h1:dPUtuqKJGgxtF7YO42oE+NdUONXi5nfLMKH2NpBffIM= +github.com/hashicorp/go-set/v3 v3.0.0-alpha.1/go.mod h1:7bJRgsF3EL3AtRTzcKXdjAFbYGSef+1gHXhglGGO52k= github.com/hashicorp/go-sockaddr v1.0.2/go.mod h1:rB4wwRAUzs07qva3c5SdrY/NEtAUjGlgmH/UkBUC97A= github.com/hashicorp/go-sockaddr v1.0.6 h1:RSG8rKU28VTUTvEKghe5gIhIQpv8evvNpnDEyqO4u9I= github.com/hashicorp/go-sockaddr v1.0.6/go.mod h1:uoUUmtwU7n9Dv3O4SNLeFvg0SxQ3lyjsj6+CCykpaxI= diff --git a/helper/funcs.go b/helper/funcs.go index e79dcbce6c7..536676dcf53 100644 --- a/helper/funcs.go +++ b/helper/funcs.go @@ -18,7 +18,7 @@ import ( "time" multierror "github.com/hashicorp/go-multierror" - "github.com/hashicorp/go-set/v2" + "github.com/hashicorp/go-set/v3" "github.com/hashicorp/hcl/hcl/ast" ) diff --git a/helper/funcs_test.go b/helper/funcs_test.go index f6c9b3e24a1..4e1947f28d4 100644 --- a/helper/funcs_test.go +++ b/helper/funcs_test.go @@ -10,7 +10,7 @@ import ( "sort" "testing" - "github.com/hashicorp/go-set/v2" + "github.com/hashicorp/go-set/v3" "github.com/shoenig/test/must" "github.com/stretchr/testify/require" ) diff --git a/helper/users/dynamic/pool.go b/helper/users/dynamic/pool.go index 8b020dab18a..fb2ecb4fcab 100644 --- a/helper/users/dynamic/pool.go +++ b/helper/users/dynamic/pool.go @@ -11,7 +11,7 @@ import ( "strconv" "sync" - "github.com/hashicorp/go-set/v2" + "github.com/hashicorp/go-set/v3" "github.com/hashicorp/nomad/helper" ) diff --git a/nomad/acl_endpoint.go b/nomad/acl_endpoint.go index 78c300e6b6b..353d3b5123d 100644 --- a/nomad/acl_endpoint.go +++ b/nomad/acl_endpoint.go @@ -17,7 +17,7 @@ import ( capOIDC "github.com/hashicorp/cap/oidc" "github.com/hashicorp/go-hclog" "github.com/hashicorp/go-memdb" - "github.com/hashicorp/go-set/v2" + "github.com/hashicorp/go-set/v3" policy "github.com/hashicorp/nomad/acl" "github.com/hashicorp/nomad/helper" diff --git a/nomad/eval_endpoint_test.go b/nomad/eval_endpoint_test.go index 1ea56ec0098..62e84036016 100644 --- a/nomad/eval_endpoint_test.go +++ b/nomad/eval_endpoint_test.go @@ -11,7 +11,7 @@ import ( "time" memdb "github.com/hashicorp/go-memdb" - "github.com/hashicorp/go-set/v2" + "github.com/hashicorp/go-set/v3" msgpackrpc "github.com/hashicorp/net-rpc-msgpackrpc/v2" "github.com/hashicorp/nomad/acl" "github.com/hashicorp/nomad/ci" diff --git a/nomad/job_endpoint.go b/nomad/job_endpoint.go index ec5258c733b..b8fbf4120ab 100644 --- a/nomad/job_endpoint.go +++ b/nomad/job_endpoint.go @@ -17,7 +17,7 @@ import ( "github.com/hashicorp/go-hclog" "github.com/hashicorp/go-memdb" "github.com/hashicorp/go-multierror" - "github.com/hashicorp/go-set/v2" + "github.com/hashicorp/go-set/v3" "github.com/hashicorp/nomad/acl" "github.com/hashicorp/nomad/helper" "github.com/hashicorp/nomad/helper/pointer" diff --git a/nomad/job_endpoint_hook_connect.go b/nomad/job_endpoint_hook_connect.go index 14917b5cdea..f87517e58d2 100644 --- a/nomad/job_endpoint_hook_connect.go +++ b/nomad/job_endpoint_hook_connect.go @@ -12,7 +12,7 @@ import ( "strings" "time" - "github.com/hashicorp/go-set/v2" + "github.com/hashicorp/go-set/v3" "github.com/hashicorp/nomad/client/taskenv" "github.com/hashicorp/nomad/helper/envoy" "github.com/hashicorp/nomad/helper/pointer" diff --git a/nomad/job_endpoint_statuses.go b/nomad/job_endpoint_statuses.go index c02768fe15b..74ff445620d 100644 --- a/nomad/job_endpoint_statuses.go +++ b/nomad/job_endpoint_statuses.go @@ -10,7 +10,7 @@ import ( "github.com/armon/go-metrics" "github.com/hashicorp/go-memdb" - "github.com/hashicorp/go-set/v2" + "github.com/hashicorp/go-set/v3" "github.com/hashicorp/nomad/acl" "github.com/hashicorp/nomad/nomad/state" "github.com/hashicorp/nomad/nomad/state/paginator" diff --git a/nomad/node_pool_endpoint_test.go b/nomad/node_pool_endpoint_test.go index 9443e2aa823..5df1bf218bc 100644 --- a/nomad/node_pool_endpoint_test.go +++ b/nomad/node_pool_endpoint_test.go @@ -10,7 +10,7 @@ import ( "github.com/google/go-cmp/cmp/cmpopts" "github.com/hashicorp/go-memdb" - "github.com/hashicorp/go-set/v2" + "github.com/hashicorp/go-set/v3" msgpackrpc "github.com/hashicorp/net-rpc-msgpackrpc/v2" "github.com/hashicorp/nomad/ci" "github.com/hashicorp/nomad/helper" diff --git a/nomad/service_registration_endpoint.go b/nomad/service_registration_endpoint.go index c82aab6344e..eede684ce8c 100644 --- a/nomad/service_registration_endpoint.go +++ b/nomad/service_registration_endpoint.go @@ -14,7 +14,7 @@ import ( "github.com/armon/go-metrics" "github.com/hashicorp/go-memdb" "github.com/hashicorp/go-multierror" - "github.com/hashicorp/go-set/v2" + "github.com/hashicorp/go-set/v3" "github.com/hashicorp/nomad/acl" "github.com/hashicorp/nomad/nomad/state" diff --git a/nomad/state/state_store.go b/nomad/state/state_store.go index f6bd16333d7..a6f96e4d5fc 100644 --- a/nomad/state/state_store.go +++ b/nomad/state/state_store.go @@ -17,7 +17,7 @@ import ( "github.com/hashicorp/go-hclog" "github.com/hashicorp/go-memdb" "github.com/hashicorp/go-multierror" - "github.com/hashicorp/go-set/v2" + "github.com/hashicorp/go-set/v3" "github.com/hashicorp/nomad/helper" "github.com/hashicorp/nomad/helper/pointer" "github.com/hashicorp/nomad/lib/lang" @@ -2094,7 +2094,7 @@ func (s *StateStore) deleteJobSubmission(job *structs.Job, txn *txn) error { } // now delete the submissions we found associated with the job - for _, sub := range remove.Slice() { + for sub := range remove.Items() { err := txn.Delete("job_submission", sub) if err != nil { return err @@ -3941,7 +3941,7 @@ func (s *StateStore) UpdateAllocsFromClient(msgType structs.MessageType, index u } // Update the index of when nodes last updated their allocs. - for _, nodeID := range nodeIDs.Slice() { + for nodeID := range nodeIDs.Items() { if err := s.updateClientAllocUpdateIndex(txn, index, nodeID); err != nil { return fmt.Errorf("node update failed: %v", err) } diff --git a/nomad/structs/acl.go b/nomad/structs/acl.go index d1cedf69619..b60c1c2f1aa 100644 --- a/nomad/structs/acl.go +++ b/nomad/structs/acl.go @@ -15,7 +15,7 @@ import ( "github.com/hashicorp/go-bexpr" "github.com/hashicorp/go-multierror" - "github.com/hashicorp/go-set/v2" + "github.com/hashicorp/go-set/v3" lru "github.com/hashicorp/golang-lru/v2" "github.com/hashicorp/nomad/helper" "github.com/hashicorp/nomad/helper/pointer" diff --git a/nomad/structs/config/workload_id.go b/nomad/structs/config/workload_id.go index 22aeda46800..89019584051 100644 --- a/nomad/structs/config/workload_id.go +++ b/nomad/structs/config/workload_id.go @@ -8,7 +8,7 @@ import ( "slices" "time" - "github.com/hashicorp/go-set/v2" + "github.com/hashicorp/go-set/v3" "github.com/hashicorp/nomad/helper/pointer" ) diff --git a/nomad/structs/funcs.go b/nomad/structs/funcs.go index 25333fc800e..93d48aaec71 100644 --- a/nomad/structs/funcs.go +++ b/nomad/structs/funcs.go @@ -13,7 +13,7 @@ import ( "strconv" "strings" - "github.com/hashicorp/go-set/v2" + "github.com/hashicorp/go-set/v3" "github.com/hashicorp/nomad/acl" "golang.org/x/crypto/blake2b" ) diff --git a/nomad/structs/job.go b/nomad/structs/job.go index 7b8ea4b8f03..0c635d0370f 100644 --- a/nomad/structs/job.go +++ b/nomad/structs/job.go @@ -4,7 +4,7 @@ package structs import ( - "github.com/hashicorp/go-set/v2" + "github.com/hashicorp/go-set/v3" ) const ( diff --git a/nomad/structs/job_test.go b/nomad/structs/job_test.go index f46dc2686fa..af860e19ed9 100644 --- a/nomad/structs/job_test.go +++ b/nomad/structs/job_test.go @@ -6,7 +6,7 @@ package structs import ( "testing" - "github.com/hashicorp/go-set/v2" + "github.com/hashicorp/go-set/v3" "github.com/shoenig/test/must" "github.com/stretchr/testify/require" ) diff --git a/nomad/structs/services.go b/nomad/structs/services.go index c155f622287..4f1c296ff5c 100644 --- a/nomad/structs/services.go +++ b/nomad/structs/services.go @@ -22,7 +22,7 @@ import ( "github.com/hashicorp/consul/api" "github.com/hashicorp/go-multierror" - "github.com/hashicorp/go-set/v2" + "github.com/hashicorp/go-set/v3" "github.com/hashicorp/nomad/helper" "github.com/hashicorp/nomad/helper/args" "github.com/hashicorp/nomad/helper/pointer" diff --git a/nomad/structs/structs.go b/nomad/structs/structs.go index 2a6d43c69b7..a12c62342b8 100644 --- a/nomad/structs/structs.go +++ b/nomad/structs/structs.go @@ -32,7 +32,7 @@ import ( "github.com/hashicorp/cronexpr" "github.com/hashicorp/go-msgpack/v2/codec" "github.com/hashicorp/go-multierror" - "github.com/hashicorp/go-set/v2" + "github.com/hashicorp/go-set/v3" "github.com/hashicorp/go-version" "github.com/hashicorp/nomad/acl" "github.com/hashicorp/nomad/client/lib/idset" diff --git a/scheduler/device.go b/scheduler/device.go index 32ee0bef323..ce479753af2 100644 --- a/scheduler/device.go +++ b/scheduler/device.go @@ -9,7 +9,7 @@ import ( "math" - "github.com/hashicorp/go-set/v2" + "github.com/hashicorp/go-set/v3" "github.com/hashicorp/nomad/client/lib/numalib" "github.com/hashicorp/nomad/nomad/structs" psstructs "github.com/hashicorp/nomad/plugins/shared/structs" diff --git a/scheduler/device_test.go b/scheduler/device_test.go index 64d79819df6..b188b605969 100644 --- a/scheduler/device_test.go +++ b/scheduler/device_test.go @@ -6,7 +6,7 @@ package scheduler import ( "testing" - "github.com/hashicorp/go-set/v2" + "github.com/hashicorp/go-set/v3" "github.com/hashicorp/nomad/ci" "github.com/hashicorp/nomad/client/lib/numalib" "github.com/hashicorp/nomad/helper/uuid" diff --git a/scheduler/propertyset.go b/scheduler/propertyset.go index 7cef31ad2cb..0dbe0c94984 100644 --- a/scheduler/propertyset.go +++ b/scheduler/propertyset.go @@ -9,7 +9,7 @@ import ( log "github.com/hashicorp/go-hclog" memdb "github.com/hashicorp/go-memdb" - "github.com/hashicorp/go-set/v2" + "github.com/hashicorp/go-set/v3" "github.com/hashicorp/nomad/nomad/structs" ) diff --git a/scheduler/rank.go b/scheduler/rank.go index e0634774f89..fcc157edf56 100644 --- a/scheduler/rank.go +++ b/scheduler/rank.go @@ -8,7 +8,7 @@ import ( "math" "slices" - "github.com/hashicorp/go-set/v2" + "github.com/hashicorp/go-set/v3" "github.com/hashicorp/nomad/client/lib/idset" "github.com/hashicorp/nomad/client/lib/numalib/hw" "github.com/hashicorp/nomad/helper" diff --git a/scheduler/reconcile_test.go b/scheduler/reconcile_test.go index 35e97e2f450..a60fc059df1 100644 --- a/scheduler/reconcile_test.go +++ b/scheduler/reconcile_test.go @@ -11,7 +11,7 @@ import ( "testing" "time" - "github.com/hashicorp/go-set/v2" + "github.com/hashicorp/go-set/v3" "github.com/hashicorp/nomad/ci" "github.com/hashicorp/nomad/helper/pointer" "github.com/hashicorp/nomad/helper/testlog" diff --git a/scheduler/spread_test.go b/scheduler/spread_test.go index 2993fa202c1..f23ad185136 100644 --- a/scheduler/spread_test.go +++ b/scheduler/spread_test.go @@ -15,7 +15,7 @@ import ( "github.com/shoenig/test/must" "github.com/stretchr/testify/require" - "github.com/hashicorp/go-set/v2" + "github.com/hashicorp/go-set/v3" "github.com/hashicorp/nomad/ci" "github.com/hashicorp/nomad/helper/pointer" "github.com/hashicorp/nomad/helper/uuid" diff --git a/scheduler/util.go b/scheduler/util.go index 09d52b5a34b..dd050abd5ae 100644 --- a/scheduler/util.go +++ b/scheduler/util.go @@ -12,7 +12,7 @@ import ( log "github.com/hashicorp/go-hclog" memdb "github.com/hashicorp/go-memdb" - "github.com/hashicorp/go-set/v2" + "github.com/hashicorp/go-set/v3" "github.com/hashicorp/nomad/helper" "github.com/hashicorp/nomad/nomad/structs" ) diff --git a/tools/go.mod b/tools/go.mod index 5567fa3ffdc..0927c393d61 100644 --- a/tools/go.mod +++ b/tools/go.mod @@ -1,12 +1,10 @@ module github.com/hashicorp/nomad/tools -go 1.21 - -toolchain go1.21.0 +go 1.23 require ( - github.com/hashicorp/go-set/v2 v2.1.0 - github.com/shoenig/test v0.6.7 + github.com/hashicorp/go-set/v3 v3.0.0-alpha.1 + github.com/shoenig/test v1.8.2 ) -require github.com/google/go-cmp v0.5.9 // indirect +require github.com/google/go-cmp v0.6.0 // indirect diff --git a/tools/go.sum b/tools/go.sum index 5c19420cda2..210f9def25d 100644 --- a/tools/go.sum +++ b/tools/go.sum @@ -1,6 +1,6 @@ -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= -github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/hashicorp/go-set/v2 v2.1.0 h1:iERPCQWks+I+4bTgy0CT2myZsCqNgBg79ZHqwniohXo= -github.com/hashicorp/go-set/v2 v2.1.0/go.mod h1:6q4nh8UCVZODn2tJ5RbJi8+ki7pjZBsAEYGt6yaGeTo= -github.com/shoenig/test v0.6.7 h1:k92ohN9VyRfZn0ezNfwamtIBT/5byyfLVktRmL/Jmek= -github.com/shoenig/test v0.6.7/go.mod h1:byHiCGXqrVaflBLAMq/srcZIHynQPQgeyvkvXnjqq0k= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/hashicorp/go-set/v3 v3.0.0-alpha.1 h1:dPUtuqKJGgxtF7YO42oE+NdUONXi5nfLMKH2NpBffIM= +github.com/hashicorp/go-set/v3 v3.0.0-alpha.1/go.mod h1:7bJRgsF3EL3AtRTzcKXdjAFbYGSef+1gHXhglGGO52k= +github.com/shoenig/test v1.8.2 h1:WDlty8UBqJRdmgdJX8lMwvCq97tiN7Um/GZD2vBDuug= +github.com/shoenig/test v1.8.2/go.mod h1:UxJ6u/x2v/TNs/LoLxBNJRV9DiwBBKYxXSyczsBHFoI= diff --git a/tools/missing/main.go b/tools/missing/main.go index 47af5619700..e524c41b104 100644 --- a/tools/missing/main.go +++ b/tools/missing/main.go @@ -4,6 +4,7 @@ package main import ( + "cmp" "encoding/json" "errors" "fmt" @@ -14,7 +15,7 @@ import ( "sort" "strings" - "github.com/hashicorp/go-set/v2" + "github.com/hashicorp/go-set/v3" ) func main() { @@ -177,7 +178,7 @@ func skip(p string) bool { } func inCode(root string) ([]string, error) { - pkgs := set.NewTreeSet[string](set.Compare[string]) + pkgs := set.NewTreeSet(cmp.Compare[string]) err := filepath.Walk(root, func(path string, info fs.FileInfo, err error) error { if info.IsDir() {