diff --git a/api/namespace_test.go b/api/namespace_test.go index a5fac0310..811fa0a74 100644 --- a/api/namespace_test.go +++ b/api/namespace_test.go @@ -1,3 +1,4 @@ +//go:build ent // +build ent package api diff --git a/api/quota_test.go b/api/quota_test.go index ebe2872a9..88cb12260 100644 --- a/api/quota_test.go +++ b/api/quota_test.go @@ -1,3 +1,4 @@ +//go:build ent // +build ent package api diff --git a/api/sentinel_test.go b/api/sentinel_test.go index 0eebd62f9..79a7c2da8 100644 --- a/api/sentinel_test.go +++ b/api/sentinel_test.go @@ -1,3 +1,4 @@ +//go:build ent // +build ent package api diff --git a/build_linux_arm.go b/build_linux_arm.go index db4f8ebf2..f774e9b2f 100644 --- a/build_linux_arm.go +++ b/build_linux_arm.go @@ -1,3 +1,4 @@ +//go:build linux && cgo // +build linux,cgo // #cgo LDFLAGS: -mfloat-abi=hard diff --git a/client/allocdir/fs_unix.go b/client/allocdir/fs_unix.go index 77447a32f..9f8326938 100644 --- a/client/allocdir/fs_unix.go +++ b/client/allocdir/fs_unix.go @@ -1,3 +1,4 @@ +//go:build darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris // +build darwin dragonfly freebsd linux netbsd openbsd solaris package allocdir diff --git a/client/allocdir/task_dir_nonlinux.go b/client/allocdir/task_dir_nonlinux.go index 08e7ba6eb..87f813f7f 100644 --- a/client/allocdir/task_dir_nonlinux.go +++ b/client/allocdir/task_dir_nonlinux.go @@ -1,3 +1,4 @@ +//go:build !linux // +build !linux package allocdir diff --git a/client/allocrunner/alloc_runner_unix_test.go b/client/allocrunner/alloc_runner_unix_test.go index 213016254..b21d3fecb 100644 --- a/client/allocrunner/alloc_runner_unix_test.go +++ b/client/allocrunner/alloc_runner_unix_test.go @@ -1,3 +1,4 @@ +//go:build !windows // +build !windows package allocrunner diff --git a/client/allocrunner/network_manager_nonlinux.go b/client/allocrunner/network_manager_nonlinux.go index 49f161fcb..e8a2d4ea5 100644 --- a/client/allocrunner/network_manager_nonlinux.go +++ b/client/allocrunner/network_manager_nonlinux.go @@ -1,4 +1,5 @@ -//+build !linux +//go:build !linux +// +build !linux package allocrunner diff --git a/client/allocrunner/networking_cni.go b/client/allocrunner/networking_cni.go index ce3a994d5..0ca806fb8 100644 --- a/client/allocrunner/networking_cni.go +++ b/client/allocrunner/networking_cni.go @@ -1,6 +1,7 @@ // For now CNI is supported only on Linux. // -//+build linux +//go:build linux +// +build linux package allocrunner diff --git a/client/allocrunner/networking_cni_test.go b/client/allocrunner/networking_cni_test.go index 832ca32ce..c4d761d4d 100644 --- a/client/allocrunner/networking_cni_test.go +++ b/client/allocrunner/networking_cni_test.go @@ -1,3 +1,4 @@ +//go:build linux // +build linux package allocrunner @@ -19,10 +20,10 @@ func TestCNI_cniToAllocNet_Fallback(t *testing.T) { // following: cniResult := &cni.CNIResult{ Interfaces: map[string]*cni.Config{ - "cali39179aa3-74": &cni.Config{}, - "eth0": &cni.Config{ + "cali39179aa3-74": {}, + "eth0": { IPConfigs: []*cni.IPConfig{ - &cni.IPConfig{ + { IP: net.IPv4(192, 168, 135, 232), }, }, @@ -48,8 +49,8 @@ func TestCNI_cniToAllocNet_Fallback(t *testing.T) { func TestCNI_cniToAllocNet_Invalid(t *testing.T) { cniResult := &cni.CNIResult{ Interfaces: map[string]*cni.Config{ - "eth0": &cni.Config{}, - "veth1": &cni.Config{ + "eth0": {}, + "veth1": { IPConfigs: []*cni.IPConfig{}, }, }, diff --git a/client/allocrunner/taskrunner/envoy_bootstrap_hook_test.go b/client/allocrunner/taskrunner/envoy_bootstrap_hook_test.go index ab46a0d19..5d473613f 100644 --- a/client/allocrunner/taskrunner/envoy_bootstrap_hook_test.go +++ b/client/allocrunner/taskrunner/envoy_bootstrap_hook_test.go @@ -1,4 +1,6 @@ +//go:build !windows // +build !windows + // todo(shoenig): Once Connect is supported on Windows, we'll need to make this // set of tests work there too. diff --git a/client/allocrunner/taskrunner/logmon_hook_unix_test.go b/client/allocrunner/taskrunner/logmon_hook_unix_test.go index cf64766bc..df85c054e 100644 --- a/client/allocrunner/taskrunner/logmon_hook_unix_test.go +++ b/client/allocrunner/taskrunner/logmon_hook_unix_test.go @@ -1,3 +1,4 @@ +//go:build !windows // +build !windows package taskrunner diff --git a/client/allocrunner/taskrunner/sids_hook_test.go b/client/allocrunner/taskrunner/sids_hook_test.go index 2f2dcc6fc..c0adcb0e9 100644 --- a/client/allocrunner/taskrunner/sids_hook_test.go +++ b/client/allocrunner/taskrunner/sids_hook_test.go @@ -1,4 +1,6 @@ +//go:build !windows // +build !windows + // todo(shoenig): Once Connect is supported on Windows, we'll need to make this // set of tests work there too. diff --git a/client/allocrunner/testing.go b/client/allocrunner/testing.go index 76bc5c519..da850719e 100644 --- a/client/allocrunner/testing.go +++ b/client/allocrunner/testing.go @@ -1,3 +1,4 @@ +//go:build !release // +build !release package allocrunner diff --git a/client/allocwatcher/alloc_watcher_unix_test.go b/client/allocwatcher/alloc_watcher_unix_test.go index aa75ab8ea..7967a69f0 100644 --- a/client/allocwatcher/alloc_watcher_unix_test.go +++ b/client/allocwatcher/alloc_watcher_unix_test.go @@ -1,3 +1,4 @@ +//go:build !windows // +build !windows package allocwatcher diff --git a/client/enterprise_client_oss.go b/client/enterprise_client_oss.go index 923fef86d..0d68f7e83 100644 --- a/client/enterprise_client_oss.go +++ b/client/enterprise_client_oss.go @@ -1,3 +1,4 @@ +//go:build !ent // +build !ent package client diff --git a/client/fingerprint/bridge_default.go b/client/fingerprint/bridge_default.go index bf5445227..506253f13 100644 --- a/client/fingerprint/bridge_default.go +++ b/client/fingerprint/bridge_default.go @@ -1,3 +1,4 @@ +//go:build !linux // +build !linux package fingerprint diff --git a/client/fingerprint/cgroup_default.go b/client/fingerprint/cgroup_default.go index 70d68cf3c..272540834 100644 --- a/client/fingerprint/cgroup_default.go +++ b/client/fingerprint/cgroup_default.go @@ -1,3 +1,4 @@ +//go:build !linux // +build !linux package fingerprint diff --git a/client/fingerprint/cgroup_linux.go b/client/fingerprint/cgroup_linux.go index 2bf58faac..36cefdf0f 100644 --- a/client/fingerprint/cgroup_linux.go +++ b/client/fingerprint/cgroup_linux.go @@ -1,3 +1,4 @@ +//go:build linux // +build linux package fingerprint diff --git a/client/fingerprint/cgroup_test.go b/client/fingerprint/cgroup_test.go index 8aa5b7455..d357c1e17 100644 --- a/client/fingerprint/cgroup_test.go +++ b/client/fingerprint/cgroup_test.go @@ -1,3 +1,4 @@ +//go:build linux // +build linux package fingerprint diff --git a/client/fingerprint/cpu_default.go b/client/fingerprint/cpu_default.go index 79676ad79..1b266c3c6 100644 --- a/client/fingerprint/cpu_default.go +++ b/client/fingerprint/cpu_default.go @@ -1,4 +1,5 @@ -//+build !linux +//go:build !linux +// +build !linux package fingerprint diff --git a/client/fingerprint/fingerprint_default.go b/client/fingerprint/fingerprint_default.go index e2ae1ec6f..d558d62f6 100644 --- a/client/fingerprint/fingerprint_default.go +++ b/client/fingerprint/fingerprint_default.go @@ -1,3 +1,4 @@ +//go:build darwin || dragonfly || freebsd || netbsd || openbsd || solaris || windows // +build darwin dragonfly freebsd netbsd openbsd solaris windows package fingerprint diff --git a/client/fingerprint/network_default.go b/client/fingerprint/network_default.go index 3faa93881..7cf924031 100644 --- a/client/fingerprint/network_default.go +++ b/client/fingerprint/network_default.go @@ -1,3 +1,4 @@ +//go:build !linux && !windows // +build !linux,!windows package fingerprint diff --git a/client/fingerprint/network_test.go b/client/fingerprint/network_test.go index 4b0fce93d..892398d55 100644 --- a/client/fingerprint/network_test.go +++ b/client/fingerprint/network_test.go @@ -479,7 +479,7 @@ func TestNetworkFingerPrint_MultipleAliases(t *testing.T) { } } expected := []string{} - for alias, _ := range cfg.HostNetworks { + for alias := range cfg.HostNetworks { expected = append(expected, alias) } sort.Strings(expected) diff --git a/client/fingerprint/storage_unix.go b/client/fingerprint/storage_unix.go index ada8f4bea..3ac5a6cae 100644 --- a/client/fingerprint/storage_unix.go +++ b/client/fingerprint/storage_unix.go @@ -1,3 +1,4 @@ +//go:build darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris // +build darwin dragonfly freebsd linux netbsd openbsd solaris package fingerprint diff --git a/client/lib/cgutil/cgutil_default.go b/client/lib/cgutil/cgutil_default.go index e9bc0f351..c2fc74e0d 100644 --- a/client/lib/cgutil/cgutil_default.go +++ b/client/lib/cgutil/cgutil_default.go @@ -1,3 +1,4 @@ +//go:build !linux // +build !linux package cgutil diff --git a/client/lib/cgutil/cpuset_manager_default.go b/client/lib/cgutil/cpuset_manager_default.go index 29c970d7f..1f8c077ba 100644 --- a/client/lib/cgutil/cpuset_manager_default.go +++ b/client/lib/cgutil/cpuset_manager_default.go @@ -1,3 +1,4 @@ +//go:build !linux // +build !linux package cgutil diff --git a/client/lib/fifo/fifo_unix.go b/client/lib/fifo/fifo_unix.go index c1d90a3ad..28f51e929 100644 --- a/client/lib/fifo/fifo_unix.go +++ b/client/lib/fifo/fifo_unix.go @@ -1,3 +1,4 @@ +//go:build !windows // +build !windows package fifo diff --git a/client/pluginmanager/drivermanager/testing.go b/client/pluginmanager/drivermanager/testing.go index 080bf1c2d..b442db3aa 100644 --- a/client/pluginmanager/drivermanager/testing.go +++ b/client/pluginmanager/drivermanager/testing.go @@ -1,3 +1,4 @@ +//go:build !release // +build !release package drivermanager diff --git a/client/state/db_test.go b/client/state/db_test.go index 06b78cb87..c4f92ce75 100644 --- a/client/state/db_test.go +++ b/client/state/db_test.go @@ -196,7 +196,7 @@ func TestStateDB_Batch(t *testing.T) { if getTxID != nil { numTransactions := getTxID() - prevTxID writeTime := time.Now().Sub(startTime) - expectedNumTransactions := ceilDiv(2 * numAllocs, batchSize) + ceilDiv(int(writeTime), int(batchDelay)) + expectedNumTransactions := ceilDiv(2*numAllocs, batchSize) + ceilDiv(int(writeTime), int(batchDelay)) require.LessOrEqual(numTransactions, expectedNumTransactions) prevTxID = getTxID() } diff --git a/command/agent/agent_oss.go b/command/agent/agent_oss.go index 3b8733603..4594204e5 100644 --- a/command/agent/agent_oss.go +++ b/command/agent/agent_oss.go @@ -1,3 +1,4 @@ +//go:build !ent // +build !ent package agent diff --git a/command/agent/config_oss.go b/command/agent/config_oss.go index c91544276..9ae283f6f 100644 --- a/command/agent/config_oss.go +++ b/command/agent/config_oss.go @@ -1,3 +1,4 @@ +//go:build !ent // +build !ent package agent diff --git a/command/agent/consul/connect_proxies_test.go b/command/agent/consul/connect_proxies_test.go index 235b319c1..8ebcee193 100644 --- a/command/agent/consul/connect_proxies_test.go +++ b/command/agent/consul/connect_proxies_test.go @@ -12,6 +12,6 @@ func TestConnectProxies_Proxies(t *testing.T) { proxies, err := pc.Proxies() require.NoError(t, err) require.Equal(t, map[string][]string{ - "envoy": []string{"1.14.2", "1.13.2", "1.12.4", "1.11.2"}, + "envoy": {"1.14.2", "1.13.2", "1.12.4", "1.11.2"}, }, proxies) } diff --git a/command/agent/host/darwin.go b/command/agent/host/darwin.go index 856ac9163..7a7807054 100644 --- a/command/agent/host/darwin.go +++ b/command/agent/host/darwin.go @@ -1,3 +1,4 @@ +//go:build darwin // +build darwin package host diff --git a/command/agent/host/linux.go b/command/agent/host/linux.go index f886282ce..f9776988b 100644 --- a/command/agent/host/linux.go +++ b/command/agent/host/linux.go @@ -1,3 +1,4 @@ +//go:build linux // +build linux package host diff --git a/command/agent/host/unix.go b/command/agent/host/unix.go index a5fae0a58..304170045 100644 --- a/command/agent/host/unix.go +++ b/command/agent/host/unix.go @@ -1,3 +1,4 @@ +//go:build !windows // +build !windows package host diff --git a/command/agent/host/windows.go b/command/agent/host/windows.go index 2b15988b9..11aa237f7 100644 --- a/command/agent/host/windows.go +++ b/command/agent/host/windows.go @@ -1,3 +1,4 @@ +//go:build windows // +build windows package host diff --git a/command/agent/http_oss.go b/command/agent/http_oss.go index 863ab4bc2..7f54194c9 100644 --- a/command/agent/http_oss.go +++ b/command/agent/http_oss.go @@ -1,3 +1,4 @@ +//go:build !ent // +build !ent package agent diff --git a/command/agent/namespace_endpoint_test.go b/command/agent/namespace_endpoint_test.go index 9e9a0fd01..7cbf2301b 100644 --- a/command/agent/namespace_endpoint_test.go +++ b/command/agent/namespace_endpoint_test.go @@ -1,3 +1,4 @@ +//go:build ent // +build ent package agent diff --git a/command/agent/operator_endpoint_oss.go b/command/agent/operator_endpoint_oss.go index d589afebe..8467c907b 100644 --- a/command/agent/operator_endpoint_oss.go +++ b/command/agent/operator_endpoint_oss.go @@ -1,3 +1,4 @@ +//go:build !ent // +build !ent package agent diff --git a/command/agent/stub_asset.go b/command/agent/stub_asset.go index 00ef7222d..17fbd2592 100644 --- a/command/agent/stub_asset.go +++ b/command/agent/stub_asset.go @@ -1,3 +1,4 @@ +//go:build !ui // +build !ui package agent diff --git a/command/agent/testagent_oss.go b/command/agent/testagent_oss.go index eae187a51..4f93ace4a 100644 --- a/command/agent/testagent_oss.go +++ b/command/agent/testagent_oss.go @@ -1,3 +1,4 @@ +//go:build !ent // +build !ent package agent diff --git a/command/alloc_exec_unix.go b/command/alloc_exec_unix.go index 36c3901df..a03caaed1 100644 --- a/command/alloc_exec_unix.go +++ b/command/alloc_exec_unix.go @@ -1,3 +1,4 @@ +//go:build darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris // +build darwin dragonfly freebsd linux netbsd openbsd solaris package command diff --git a/command/alloc_status_test.go b/command/alloc_status_test.go index c875a5bc0..69626b50e 100644 --- a/command/alloc_status_test.go +++ b/command/alloc_status_test.go @@ -133,9 +133,9 @@ func TestAllocStatusCommand_LifecycleInfo(t *testing.T) { a.TaskResources["init_task"] = a.TaskResources["web"] a.TaskResources["prestart_sidecar"] = a.TaskResources["web"] a.TaskStates = map[string]*structs.TaskState{ - "web": &structs.TaskState{State: "pending"}, - "init_task": &structs.TaskState{State: "running"}, - "prestart_sidecar": &structs.TaskState{State: "running"}, + "web": {State: "pending"}, + "init_task": {State: "running"}, + "prestart_sidecar": {State: "running"}, } require.Nil(t, state.UpsertAllocs(structs.MsgTypeTestSetup, 1000, []*structs.Allocation{a})) @@ -429,7 +429,7 @@ func TestAllocStatusCommand_HostVolumes(t *testing.T) { // fakes the placement enough so that we have something to iterate // on in 'nomad alloc status' alloc.TaskStates = map[string]*structs.TaskState{ - "web": &structs.TaskState{ + "web": { Events: []*structs.TaskEvent{ structs.NewTaskEvent("test event").SetMessage("test msg"), }, @@ -504,7 +504,7 @@ func TestAllocStatusCommand_CSIVolumes(t *testing.T) { } // if we don't set a task state, there's nothing to iterate on alloc status alloc.TaskStates = map[string]*structs.TaskState{ - "web": &structs.TaskState{ + "web": { Events: []*structs.TaskEvent{ structs.NewTaskEvent("test event").SetMessage("test msg"), }, diff --git a/command/commands_oss.go b/command/commands_oss.go index 83dae1bd2..2b283681f 100644 --- a/command/commands_oss.go +++ b/command/commands_oss.go @@ -1,3 +1,4 @@ +//go:build !ent // +build !ent package command diff --git a/command/namespace_apply_test.go b/command/namespace_apply_test.go index d4d7bd09e..a5611e2ad 100644 --- a/command/namespace_apply_test.go +++ b/command/namespace_apply_test.go @@ -1,3 +1,4 @@ +//go:build ent // +build ent package command diff --git a/command/namespace_delete_test.go b/command/namespace_delete_test.go index 8c187e232..155f2cff7 100644 --- a/command/namespace_delete_test.go +++ b/command/namespace_delete_test.go @@ -1,3 +1,4 @@ +//go:build ent // +build ent package command diff --git a/command/namespace_inspect_test.go b/command/namespace_inspect_test.go index 7f4862a63..296b0fa5d 100644 --- a/command/namespace_inspect_test.go +++ b/command/namespace_inspect_test.go @@ -1,3 +1,4 @@ +//go:build ent // +build ent package command diff --git a/command/namespace_list_test.go b/command/namespace_list_test.go index 95b018333..822199c62 100644 --- a/command/namespace_list_test.go +++ b/command/namespace_list_test.go @@ -1,3 +1,4 @@ +//go:build ent // +build ent package command diff --git a/command/namespace_status_test.go b/command/namespace_status_test.go index fa4a387dd..74073b8f2 100644 --- a/command/namespace_status_test.go +++ b/command/namespace_status_test.go @@ -1,3 +1,4 @@ +//go:build ent // +build ent package command diff --git a/command/quota_delete_test.go b/command/quota_delete_test.go index 91b0d042a..351332c62 100644 --- a/command/quota_delete_test.go +++ b/command/quota_delete_test.go @@ -1,3 +1,4 @@ +//go:build ent // +build ent package command diff --git a/command/quota_inspect_test.go b/command/quota_inspect_test.go index 3c7f7dde8..6fee89c60 100644 --- a/command/quota_inspect_test.go +++ b/command/quota_inspect_test.go @@ -1,3 +1,4 @@ +//go:build ent // +build ent package command diff --git a/command/quota_list_test.go b/command/quota_list_test.go index b1f21e8c2..d50935e7c 100644 --- a/command/quota_list_test.go +++ b/command/quota_list_test.go @@ -1,3 +1,4 @@ +//go:build ent // +build ent package command diff --git a/command/quota_status_test.go b/command/quota_status_test.go index 954d4cf70..53689320f 100644 --- a/command/quota_status_test.go +++ b/command/quota_status_test.go @@ -1,3 +1,4 @@ +//go:build ent // +build ent package command diff --git a/drivers/docker/config_test.go b/drivers/docker/config_test.go index 53485dbb9..b9deb9213 100644 --- a/drivers/docker/config_test.go +++ b/drivers/docker/config_test.go @@ -694,12 +694,12 @@ func TestConfig_DriverConfig_AllowRuntimes(t *testing.T) { { name: "pure default", config: `{}`, - expected: map[string]struct{}{"runc": struct{}{}, "nvidia": struct{}{}}, + expected: map[string]struct{}{"runc": {}, "nvidia": {}}, }, { name: "custom", config: `{ allow_runtimes = ["runc", "firecracker"]}`, - expected: map[string]struct{}{"runc": struct{}{}, "firecracker": struct{}{}}, + expected: map[string]struct{}{"runc": {}, "firecracker": {}}, }, } diff --git a/drivers/docker/driver_default.go b/drivers/docker/driver_default.go index b180ae8f9..8607b899b 100644 --- a/drivers/docker/driver_default.go +++ b/drivers/docker/driver_default.go @@ -1,4 +1,5 @@ -//+build !windows +//go:build !windows +// +build !windows package docker diff --git a/drivers/docker/driver_test.go b/drivers/docker/driver_test.go index f51b8b3f0..aa542a58b 100644 --- a/drivers/docker/driver_test.go +++ b/drivers/docker/driver_test.go @@ -1224,12 +1224,12 @@ func TestDockerDriver_CreateContainerConfig_Mounts(t *testing.T) { defer freeport.Return(ports) cfg.Mounts = []DockerMount{ - DockerMount{ + { Type: "bind", Target: "/map-bind-target", Source: "/map-source", }, - DockerMount{ + { Type: "tmpfs", Target: "/map-tmpfs-target", }, diff --git a/drivers/docker/driver_unix_test.go b/drivers/docker/driver_unix_test.go index d3658ea35..019b42764 100644 --- a/drivers/docker/driver_unix_test.go +++ b/drivers/docker/driver_unix_test.go @@ -1,3 +1,4 @@ +//go:build darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris // +build darwin dragonfly freebsd linux netbsd openbsd solaris package docker diff --git a/drivers/docker/driver_windows_test.go b/drivers/docker/driver_windows_test.go index 05306d83f..f54b83f20 100644 --- a/drivers/docker/driver_windows_test.go +++ b/drivers/docker/driver_windows_test.go @@ -1,3 +1,4 @@ +//go:build windows // +build windows package docker diff --git a/drivers/docker/util/stats_posix.go b/drivers/docker/util/stats_posix.go index 356096395..ae755c430 100644 --- a/drivers/docker/util/stats_posix.go +++ b/drivers/docker/util/stats_posix.go @@ -1,3 +1,4 @@ +//go:build !windows // +build !windows package util diff --git a/drivers/docker/utils_unix_test.go b/drivers/docker/utils_unix_test.go index 2260ef89e..29f526964 100644 --- a/drivers/docker/utils_unix_test.go +++ b/drivers/docker/utils_unix_test.go @@ -1,3 +1,4 @@ +//go:build darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris // +build darwin dragonfly freebsd linux netbsd openbsd solaris package docker diff --git a/drivers/docker/utils_windows_test.go b/drivers/docker/utils_windows_test.go index 2891fe8d3..d433055e9 100644 --- a/drivers/docker/utils_windows_test.go +++ b/drivers/docker/utils_windows_test.go @@ -1,3 +1,4 @@ +//go:build windows // +build windows package docker diff --git a/drivers/exec/driver_unix_test.go b/drivers/exec/driver_unix_test.go index 3b2e60374..a9da57c02 100644 --- a/drivers/exec/driver_unix_test.go +++ b/drivers/exec/driver_unix_test.go @@ -1,3 +1,4 @@ +//go:build darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris // +build darwin dragonfly freebsd linux netbsd openbsd solaris package exec diff --git a/drivers/rawexec/driver_unix_test.go b/drivers/rawexec/driver_unix_test.go index b35902297..9d6d6d70a 100644 --- a/drivers/rawexec/driver_unix_test.go +++ b/drivers/rawexec/driver_unix_test.go @@ -1,3 +1,4 @@ +//go:build !windows // +build !windows package rawexec diff --git a/drivers/shared/executor/executor_basic.go b/drivers/shared/executor/executor_basic.go index 7326ad172..083166bd3 100644 --- a/drivers/shared/executor/executor_basic.go +++ b/drivers/shared/executor/executor_basic.go @@ -1,3 +1,4 @@ +//go:build !linux // +build !linux package executor diff --git a/drivers/shared/executor/executor_linux.go b/drivers/shared/executor/executor_linux.go index 54be7ed79..1956125c3 100644 --- a/drivers/shared/executor/executor_linux.go +++ b/drivers/shared/executor/executor_linux.go @@ -1,3 +1,4 @@ +//go:build linux // +build linux package executor diff --git a/drivers/shared/executor/executor_unix.go b/drivers/shared/executor/executor_unix.go index 6f90b7ade..da2d9ddcb 100644 --- a/drivers/shared/executor/executor_unix.go +++ b/drivers/shared/executor/executor_unix.go @@ -1,3 +1,4 @@ +//go:build darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris // +build darwin dragonfly freebsd linux netbsd openbsd solaris package executor diff --git a/drivers/shared/executor/pty_unix.go b/drivers/shared/executor/pty_unix.go index 964c09fbd..d940d9e04 100644 --- a/drivers/shared/executor/pty_unix.go +++ b/drivers/shared/executor/pty_unix.go @@ -1,3 +1,4 @@ +//go:build darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris // +build darwin dragonfly freebsd linux netbsd openbsd solaris package executor diff --git a/drivers/shared/executor/pty_windows.go b/drivers/shared/executor/pty_windows.go index 12411a5a5..f9c4cf35e 100644 --- a/drivers/shared/executor/pty_windows.go +++ b/drivers/shared/executor/pty_windows.go @@ -1,3 +1,4 @@ +//go:build windows // +build windows package executor diff --git a/drivers/shared/executor/resource_container_default.go b/drivers/shared/executor/resource_container_default.go index 7bd02dbb6..ff4c8f9e8 100644 --- a/drivers/shared/executor/resource_container_default.go +++ b/drivers/shared/executor/resource_container_default.go @@ -1,3 +1,4 @@ +//go:build darwin || dragonfly || freebsd || netbsd || openbsd || solaris || windows // +build darwin dragonfly freebsd netbsd openbsd solaris windows package executor diff --git a/drivers/shared/executor/utils_unix.go b/drivers/shared/executor/utils_unix.go index ce1a39f86..6f45ccf43 100644 --- a/drivers/shared/executor/utils_unix.go +++ b/drivers/shared/executor/utils_unix.go @@ -1,3 +1,4 @@ +//go:build darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris // +build darwin dragonfly freebsd linux netbsd openbsd solaris package executor diff --git a/drivers/shared/hostnames/mount_unix_test.go b/drivers/shared/hostnames/mount_unix_test.go index e7273b1d8..97ee369b9 100644 --- a/drivers/shared/hostnames/mount_unix_test.go +++ b/drivers/shared/hostnames/mount_unix_test.go @@ -1,3 +1,4 @@ +//go:build !windows // +build !windows package hostnames diff --git a/drivers/shared/resolvconf/mount_unix_test.go b/drivers/shared/resolvconf/mount_unix_test.go index 271eb6c02..8469f0a30 100644 --- a/drivers/shared/resolvconf/mount_unix_test.go +++ b/drivers/shared/resolvconf/mount_unix_test.go @@ -1,3 +1,4 @@ +//go:build !windows // +build !windows package resolvconf diff --git a/e2e/consul/namespaces_oss.go b/e2e/consul/namespaces_oss.go index 249fd6f53..ce41810ae 100644 --- a/e2e/consul/namespaces_oss.go +++ b/e2e/consul/namespaces_oss.go @@ -1,3 +1,4 @@ +//go:build !ent // +build !ent // Nomad OSS ignores Consul Namespace configuration in jobs, these e2e tests diff --git a/e2e/nomad09upgrade/upgrade.go b/e2e/nomad09upgrade/upgrade.go index bf0ed6eac..88f2fc88d 100644 --- a/e2e/nomad09upgrade/upgrade.go +++ b/e2e/nomad09upgrade/upgrade.go @@ -1,4 +1,5 @@ -//+build linux +//go:build linux +// +build linux package nomad09upgrade diff --git a/e2e/nomad09upgrade/upgrade_basic.go b/e2e/nomad09upgrade/upgrade_basic.go index 948fa109c..e77783e58 100644 --- a/e2e/nomad09upgrade/upgrade_basic.go +++ b/e2e/nomad09upgrade/upgrade_basic.go @@ -1,3 +1,4 @@ -//+build !linux +//go:build !linux +// +build !linux package nomad09upgrade diff --git a/e2e/quotas/quotas_oss.go b/e2e/quotas/quotas_oss.go index a7a586aa8..44a0f3a4b 100644 --- a/e2e/quotas/quotas_oss.go +++ b/e2e/quotas/quotas_oss.go @@ -1,3 +1,4 @@ +//go:build !ent // +build !ent package quotas diff --git a/e2e/vaultcompat/vault_test.go b/e2e/vaultcompat/vault_test.go index 3c166ae0c..27446ebbd 100644 --- a/e2e/vaultcompat/vault_test.go +++ b/e2e/vaultcompat/vault_test.go @@ -70,7 +70,7 @@ func syncVault(t *testing.T) ([]*version.Version, map[string]string) { } binaries := make(map[string]string, len(versions)) - for ver, _ := range versions { + for ver := range versions { binaries[ver] = filepath.Join(binDir, ver) } return sorted, binaries diff --git a/helper/freeport/ephemeral_darwin.go b/helper/freeport/ephemeral_darwin.go index 897f8fbf6..48277420e 100644 --- a/helper/freeport/ephemeral_darwin.go +++ b/helper/freeport/ephemeral_darwin.go @@ -1,4 +1,5 @@ -//+build darwin +//go:build darwin +// +build darwin package freeport diff --git a/helper/freeport/ephemeral_darwin_test.go b/helper/freeport/ephemeral_darwin_test.go index e602f474a..10d0b9bba 100644 --- a/helper/freeport/ephemeral_darwin_test.go +++ b/helper/freeport/ephemeral_darwin_test.go @@ -1,4 +1,5 @@ -//+build darwin +//go:build darwin +// +build darwin package freeport diff --git a/helper/freeport/ephemeral_freebsd.go b/helper/freeport/ephemeral_freebsd.go index 3c335c88b..64b420eb4 100644 --- a/helper/freeport/ephemeral_freebsd.go +++ b/helper/freeport/ephemeral_freebsd.go @@ -1,4 +1,5 @@ -//+build freebsd +//go:build freebsd +// +build freebsd package freeport diff --git a/helper/freeport/ephemeral_linux.go b/helper/freeport/ephemeral_linux.go index 342b4a0c6..4e6de69ed 100644 --- a/helper/freeport/ephemeral_linux.go +++ b/helper/freeport/ephemeral_linux.go @@ -1,4 +1,5 @@ -//+build linux +//go:build linux +// +build linux package freeport diff --git a/helper/freeport/ephemeral_linux_test.go b/helper/freeport/ephemeral_linux_test.go index 2d9385df4..cd4e9db34 100644 --- a/helper/freeport/ephemeral_linux_test.go +++ b/helper/freeport/ephemeral_linux_test.go @@ -1,4 +1,5 @@ -//+build linux +//go:build linux +// +build linux package freeport diff --git a/helper/freeport/ephemeral_windows.go b/helper/freeport/ephemeral_windows.go index 9401c107f..c4cd40df7 100644 --- a/helper/freeport/ephemeral_windows.go +++ b/helper/freeport/ephemeral_windows.go @@ -1,4 +1,5 @@ -//+build windows +//go:build windows +// +build windows package freeport diff --git a/helper/mount/mount_linux.go b/helper/mount/mount_linux.go index 4e4f2ab69..0bca7bf95 100644 --- a/helper/mount/mount_linux.go +++ b/helper/mount/mount_linux.go @@ -1,3 +1,4 @@ +//go:build linux // +build linux package mount diff --git a/helper/mount/mount_unsupported.go b/helper/mount/mount_unsupported.go index 8605aded4..5522faea2 100644 --- a/helper/mount/mount_unsupported.go +++ b/helper/mount/mount_unsupported.go @@ -1,3 +1,4 @@ +//go:build !linux // +build !linux package mount diff --git a/helper/pluginutils/catalog/register_testing.go b/helper/pluginutils/catalog/register_testing.go index d3d58c925..f1e0914ba 100644 --- a/helper/pluginutils/catalog/register_testing.go +++ b/helper/pluginutils/catalog/register_testing.go @@ -1,3 +1,4 @@ +//go:build !release // +build !release package catalog diff --git a/helper/pluginutils/loader/filter_unix.go b/helper/pluginutils/loader/filter_unix.go index fefea7cb2..5ef821404 100644 --- a/helper/pluginutils/loader/filter_unix.go +++ b/helper/pluginutils/loader/filter_unix.go @@ -1,3 +1,4 @@ +//go:build !windows // +build !windows package loader diff --git a/helper/pluginutils/loader/filter_windows.go b/helper/pluginutils/loader/filter_windows.go index 7e8c4bb7c..021e1cc24 100644 --- a/helper/pluginutils/loader/filter_windows.go +++ b/helper/pluginutils/loader/filter_windows.go @@ -1,3 +1,4 @@ +//go:build windows // +build windows package loader diff --git a/helper/raftutil/fsm_oss.go b/helper/raftutil/fsm_oss.go index c9e725b12..0ac4e7cde 100644 --- a/helper/raftutil/fsm_oss.go +++ b/helper/raftutil/fsm_oss.go @@ -1,3 +1,4 @@ +//go:build !ent // +build !ent package raftutil diff --git a/helper/snapshot/archive_test.go b/helper/snapshot/archive_test.go index 8a12f59ce..1ac93507d 100644 --- a/helper/snapshot/archive_test.go +++ b/helper/snapshot/archive_test.go @@ -21,7 +21,7 @@ func TestArchive(t *testing.T) { Term: 2011, Configuration: raft.Configuration{ Servers: []raft.Server{ - raft.Server{ + { Suffrage: raft.Voter, ID: raft.ServerID("hello"), Address: raft.ServerAddress("127.0.0.1:8300"), diff --git a/helper/testtask/testtask_unix.go b/helper/testtask/testtask_unix.go index c3d3ceb68..cac2fb0d4 100644 --- a/helper/testtask/testtask_unix.go +++ b/helper/testtask/testtask_unix.go @@ -1,3 +1,4 @@ +//go:build darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris // +build darwin dragonfly freebsd linux netbsd openbsd solaris package testtask diff --git a/helper/testtask/testtask_windows.go b/helper/testtask/testtask_windows.go index a532b418e..282730389 100644 --- a/helper/testtask/testtask_windows.go +++ b/helper/testtask/testtask_windows.go @@ -1,3 +1,4 @@ +//go:build windows // +build windows package testtask diff --git a/helper/winsvc/service_windows.go b/helper/winsvc/service_windows.go index eeecf1b82..84c043d15 100644 --- a/helper/winsvc/service_windows.go +++ b/helper/winsvc/service_windows.go @@ -1,4 +1,5 @@ -//+build windows +//go:build windows +// +build windows package winsvc diff --git a/nomad/consul_oss_test.go b/nomad/consul_oss_test.go index 6fbd6e369..520467d71 100644 --- a/nomad/consul_oss_test.go +++ b/nomad/consul_oss_test.go @@ -1,4 +1,5 @@ -//+build !ent +//go:build !ent +// +build !ent package nomad diff --git a/nomad/consul_policy_oss_test.go b/nomad/consul_policy_oss_test.go index 79993291d..464bfcf09 100644 --- a/nomad/consul_policy_oss_test.go +++ b/nomad/consul_policy_oss_test.go @@ -1,4 +1,5 @@ -//+build !ent +//go:build !ent +// +build !ent package nomad diff --git a/nomad/consul_policy_test.go b/nomad/consul_policy_test.go index 4e5f9cea0..150780d15 100644 --- a/nomad/consul_policy_test.go +++ b/nomad/consul_policy_test.go @@ -521,7 +521,7 @@ func TestConsulPolicy_allowKeystoreRead(t *testing.T) { t.Run("kv wild namespace prefix any read", func(t *testing.T) { policy := &ConsulPolicy{ NamespacePrefixes: map[string]*ConsulPolicy{ - "": &ConsulPolicy{ + "": { KeyPrefixes: []*ConsulKeyRule{{ Name: "", Policy: "read", @@ -536,7 +536,7 @@ func TestConsulPolicy_allowKeystoreRead(t *testing.T) { t.Run("kv apple namespace prefix any read", func(t *testing.T) { policy := &ConsulPolicy{ NamespacePrefixes: map[string]*ConsulPolicy{ - "apple": &ConsulPolicy{ + "apple": { KeyPrefixes: []*ConsulKeyRule{{ Name: "", Policy: "read", @@ -551,7 +551,7 @@ func TestConsulPolicy_allowKeystoreRead(t *testing.T) { t.Run("kv matching namespace prefix any read", func(t *testing.T) { policy := &ConsulPolicy{ NamespacePrefixes: map[string]*ConsulPolicy{ - "app": &ConsulPolicy{ + "app": { KeyPrefixes: []*ConsulKeyRule{{ Name: "", Policy: "read", @@ -566,7 +566,7 @@ func TestConsulPolicy_allowKeystoreRead(t *testing.T) { t.Run("kv other namespace prefix any read", func(t *testing.T) { policy := &ConsulPolicy{ NamespacePrefixes: map[string]*ConsulPolicy{ - "other": &ConsulPolicy{ + "other": { KeyPrefixes: []*ConsulKeyRule{{ Name: "", Policy: "read", @@ -583,7 +583,7 @@ func TestConsulPolicy_allowKeystoreRead(t *testing.T) { t.Run("kv match namespace any read", func(t *testing.T) { policy := &ConsulPolicy{ Namespaces: map[string]*ConsulPolicy{ - "apple": &ConsulPolicy{ + "apple": { KeyPrefixes: []*ConsulKeyRule{{ Name: "", Policy: "read", @@ -598,7 +598,7 @@ func TestConsulPolicy_allowKeystoreRead(t *testing.T) { t.Run("kv mismatch namespace any read", func(t *testing.T) { policy := &ConsulPolicy{ Namespaces: map[string]*ConsulPolicy{ - "other": &ConsulPolicy{ + "other": { KeyPrefixes: []*ConsulKeyRule{{ Name: "", Policy: "read", @@ -613,7 +613,7 @@ func TestConsulPolicy_allowKeystoreRead(t *testing.T) { t.Run("kv matching namespace prefix any read", func(t *testing.T) { policy := &ConsulPolicy{ Namespaces: map[string]*ConsulPolicy{ - "apple": &ConsulPolicy{ + "apple": { KeyPrefixes: []*ConsulKeyRule{{ Name: "", Policy: "read", @@ -628,7 +628,7 @@ func TestConsulPolicy_allowKeystoreRead(t *testing.T) { t.Run("kv mismatch namespace prefix any read", func(t *testing.T) { policy := &ConsulPolicy{ Namespaces: map[string]*ConsulPolicy{ - "other": &ConsulPolicy{ + "other": { KeyPrefixes: []*ConsulKeyRule{{ Name: "", Policy: "read", diff --git a/nomad/deploymentwatcher/multiregion_oss.go b/nomad/deploymentwatcher/multiregion_oss.go index 427fa904f..98b363ad4 100644 --- a/nomad/deploymentwatcher/multiregion_oss.go +++ b/nomad/deploymentwatcher/multiregion_oss.go @@ -1,3 +1,4 @@ +//go:build !ent // +build !ent package deploymentwatcher diff --git a/nomad/endpoints_oss.go b/nomad/endpoints_oss.go index eb912f0a3..7c15a04ba 100644 --- a/nomad/endpoints_oss.go +++ b/nomad/endpoints_oss.go @@ -1,3 +1,4 @@ +//go:build !ent // +build !ent package nomad diff --git a/nomad/fsm_not_ent.go b/nomad/fsm_not_ent.go index aa7f4389a..b21ca608e 100644 --- a/nomad/fsm_not_ent.go +++ b/nomad/fsm_not_ent.go @@ -1,3 +1,4 @@ +//go:build !ent // +build !ent package nomad diff --git a/nomad/fsm_registry_oss.go b/nomad/fsm_registry_oss.go index 3ac0351ae..c1a18750f 100644 --- a/nomad/fsm_registry_oss.go +++ b/nomad/fsm_registry_oss.go @@ -1,3 +1,4 @@ +//go:build !ent // +build !ent package nomad diff --git a/nomad/job_endpoint_oss.go b/nomad/job_endpoint_oss.go index ac43893f4..d44853818 100644 --- a/nomad/job_endpoint_oss.go +++ b/nomad/job_endpoint_oss.go @@ -1,3 +1,4 @@ +//go:build !ent // +build !ent package nomad diff --git a/nomad/job_endpoint_oss_test.go b/nomad/job_endpoint_oss_test.go index 24ac312aa..e90e7cb82 100644 --- a/nomad/job_endpoint_oss_test.go +++ b/nomad/job_endpoint_oss_test.go @@ -1,3 +1,4 @@ +//go:build !ent // +build !ent package nomad diff --git a/nomad/leader_oss.go b/nomad/leader_oss.go index 38ff1d4aa..eb19d9107 100644 --- a/nomad/leader_oss.go +++ b/nomad/leader_oss.go @@ -1,3 +1,4 @@ +//go:build !ent // +build !ent package nomad diff --git a/nomad/plan_apply_not_ent.go b/nomad/plan_apply_not_ent.go index 1b413a1e5..44534cab6 100644 --- a/nomad/plan_apply_not_ent.go +++ b/nomad/plan_apply_not_ent.go @@ -1,3 +1,4 @@ +//go:build !ent // +build !ent package nomad diff --git a/nomad/search_endpoint_oss.go b/nomad/search_endpoint_oss.go index a724518c2..4a8735b4e 100644 --- a/nomad/search_endpoint_oss.go +++ b/nomad/search_endpoint_oss.go @@ -1,3 +1,4 @@ +//go:build !ent // +build !ent package nomad diff --git a/nomad/server_setup_oss.go b/nomad/server_setup_oss.go index 6ada6a06e..2e08a9ea5 100644 --- a/nomad/server_setup_oss.go +++ b/nomad/server_setup_oss.go @@ -1,3 +1,4 @@ +//go:build !ent // +build !ent package nomad diff --git a/nomad/state/state_store_oss.go b/nomad/state/state_store_oss.go index e8f91195e..aaa57de03 100644 --- a/nomad/state/state_store_oss.go +++ b/nomad/state/state_store_oss.go @@ -1,3 +1,4 @@ +//go:build !ent // +build !ent package state diff --git a/nomad/structs/consul_oss.go b/nomad/structs/consul_oss.go index a2a2cc4e8..fa1c36c70 100644 --- a/nomad/structs/consul_oss.go +++ b/nomad/structs/consul_oss.go @@ -1,3 +1,4 @@ +//go:build !ent // +build !ent package structs diff --git a/nomad/structs/consul_oss_test.go b/nomad/structs/consul_oss_test.go index 4479fa838..de3359c34 100644 --- a/nomad/structs/consul_oss_test.go +++ b/nomad/structs/consul_oss_test.go @@ -1,3 +1,4 @@ +//go:build !ent // +build !ent package structs @@ -73,7 +74,7 @@ func TestJob_ConfigEntries(t *testing.T) { exp := map[string]*ConsulConfigEntries{ // in OSS, consul namespace is not supported - "": &ConsulConfigEntries{ + "": { Ingress: map[string]*ConsulIngressConfigEntry{ "group1-service1": new(ConsulIngressConfigEntry), "group2-service1": new(ConsulIngressConfigEntry), diff --git a/nomad/structs/structs_oss.go b/nomad/structs/structs_oss.go index ec540a82c..2d0fcf379 100644 --- a/nomad/structs/structs_oss.go +++ b/nomad/structs/structs_oss.go @@ -1,3 +1,4 @@ +//go:build !ent // +build !ent package structs diff --git a/nomad/structs/structs_test.go b/nomad/structs/structs_test.go index ab14ba01a..b595b419b 100644 --- a/nomad/structs/structs_test.go +++ b/nomad/structs/structs_test.go @@ -1390,7 +1390,7 @@ func TestTaskGroupNetwork_Validate(t *testing.T) { }, }, Tasks: []*Task{ - &Task{ + { Name: "task1", Resources: &Resources{ Networks: Networks{ @@ -1424,7 +1424,7 @@ func TestTaskGroupNetwork_Validate(t *testing.T) { }, }, Tasks: []*Task{ - &Task{ + { Name: "task1", Resources: &Resources{ Networks: Networks{ diff --git a/nomad/testing_oss.go b/nomad/testing_oss.go index 5f4d5e82c..2db273d7b 100644 --- a/nomad/testing_oss.go +++ b/nomad/testing_oss.go @@ -1,3 +1,4 @@ +//go:build !ent // +build !ent package nomad diff --git a/plugins/drivers/utils/utils_unix.go b/plugins/drivers/utils/utils_unix.go index d7592be07..12e08cc97 100644 --- a/plugins/drivers/utils/utils_unix.go +++ b/plugins/drivers/utils/utils_unix.go @@ -1,3 +1,4 @@ +//go:build darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris // +build darwin dragonfly freebsd linux netbsd openbsd solaris package utils diff --git a/scheduler/generic_sched_test.go b/scheduler/generic_sched_test.go index 2298250d8..1b38d9c00 100644 --- a/scheduler/generic_sched_test.go +++ b/scheduler/generic_sched_test.go @@ -3452,7 +3452,7 @@ func TestServiceSched_NodeDrain_TaskHandle(t *testing.T) { alloc.Name = fmt.Sprintf("my-job.web[%d]", i) alloc.DesiredTransition.Migrate = helper.BoolToPtr(true) alloc.TaskStates = map[string]*structs.TaskState{ - "web": &structs.TaskState{ + "web": { TaskHandle: &structs.TaskHandle{ Version: 1, DriverState: []byte("test-driver-state"), @@ -6289,7 +6289,7 @@ func TestPropagateTaskState(t *testing.T) { ClientStatus: structs.AllocClientStatusRunning, DesiredTransition: structs.DesiredTransition{}, TaskStates: map[string]*structs.TaskState{ - taskName: &structs.TaskState{ + taskName: { TaskHandle: taskHandle, }, }, @@ -6305,7 +6305,7 @@ func TestPropagateTaskState(t *testing.T) { Migrate: helper.BoolToPtr(true), }, TaskStates: map[string]*structs.TaskState{ - taskName: &structs.TaskState{ + taskName: { TaskHandle: taskHandle, }, }, @@ -6319,7 +6319,7 @@ func TestPropagateTaskState(t *testing.T) { ClientStatus: structs.AllocClientStatusRunning, DesiredTransition: structs.DesiredTransition{}, TaskStates: map[string]*structs.TaskState{ - taskName: &structs.TaskState{}, + taskName: {}, }, }, prevLost: true, @@ -6333,7 +6333,7 @@ func TestPropagateTaskState(t *testing.T) { Migrate: helper.BoolToPtr(true), }, TaskStates: map[string]*structs.TaskState{ - taskName: &structs.TaskState{}, + taskName: {}, }, }, prevLost: false, @@ -6345,7 +6345,7 @@ func TestPropagateTaskState(t *testing.T) { ClientStatus: structs.AllocClientStatusComplete, DesiredTransition: structs.DesiredTransition{}, TaskStates: map[string]*structs.TaskState{ - taskName: &structs.TaskState{ + taskName: { TaskHandle: taskHandle, }, }, diff --git a/scheduler/reconcile_test.go b/scheduler/reconcile_test.go index 736b518d7..d698b2d87 100644 --- a/scheduler/reconcile_test.go +++ b/scheduler/reconcile_test.go @@ -609,7 +609,7 @@ func TestReconciler_Inplace_Rollback(t *testing.T) { // different rescheduling states allocs[1].ClientStatus = structs.AllocClientStatusFailed allocs[1].TaskStates = map[string]*structs.TaskState{ - "web": &structs.TaskState{FinishedAt: time.Now().Add(-10 * time.Minute)}} + "web": {FinishedAt: time.Now().Add(-10 * time.Minute)}} allocs[2].ClientStatus = structs.AllocClientStatusFailed // job is rolled back, we expect allocs[0] to be updated in-place diff --git a/scheduler/scheduler_oss.go b/scheduler/scheduler_oss.go index 71cdff3ec..a6062f2a1 100644 --- a/scheduler/scheduler_oss.go +++ b/scheduler/scheduler_oss.go @@ -1,3 +1,4 @@ +//go:build !ent // +build !ent package scheduler diff --git a/scheduler/stack_not_ent.go b/scheduler/stack_not_ent.go index 2c1660ec2..7214c6be8 100644 --- a/scheduler/stack_not_ent.go +++ b/scheduler/stack_not_ent.go @@ -1,3 +1,4 @@ +//go:build !ent // +build !ent package scheduler diff --git a/scheduler/util_test.go b/scheduler/util_test.go index 9bb3ff81f..eba4227e6 100644 --- a/scheduler/util_test.go +++ b/scheduler/util_test.go @@ -51,7 +51,7 @@ func TestDiffSystemAllocsForNode_Sysbatch_terminal(t *testing.T) { t.Run("current job", func(t *testing.T) { terminal := structs.TerminalByNodeByName{ "node1": map[string]*structs.Allocation{ - "my-sysbatch.pinger[0]": &structs.Allocation{ + "my-sysbatch.pinger[0]": { ID: uuid.Generate(), NodeID: "node1", Name: "my-sysbatch.pinger[0]", @@ -75,7 +75,7 @@ func TestDiffSystemAllocsForNode_Sysbatch_terminal(t *testing.T) { previousJob.JobModifyIndex -= 1 terminal := structs.TerminalByNodeByName{ "node1": map[string]*structs.Allocation{ - "my-sysbatch.pinger[0]": &structs.Allocation{ + "my-sysbatch.pinger[0]": { ID: uuid.Generate(), NodeID: "node1", Name: "my-sysbatch.pinger[0]",