gofmt all the files

mostly to handle build directives in 1.17.
This commit is contained in:
Mahmood Ali 2021-10-01 09:59:55 -04:00
parent 6c7519fc10
commit 4d90afb425
119 changed files with 162 additions and 54 deletions

View File

@ -1,3 +1,4 @@
//go:build ent
// +build ent
package api

View File

@ -1,3 +1,4 @@
//go:build ent
// +build ent
package api

View File

@ -1,3 +1,4 @@
//go:build ent
// +build ent
package api

View File

@ -1,3 +1,4 @@
//go:build linux && cgo
// +build linux,cgo
// #cgo LDFLAGS: -mfloat-abi=hard

View File

@ -1,3 +1,4 @@
//go:build darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris
// +build darwin dragonfly freebsd linux netbsd openbsd solaris
package allocdir

View File

@ -1,3 +1,4 @@
//go:build !linux
// +build !linux
package allocdir

View File

@ -1,3 +1,4 @@
//go:build !windows
// +build !windows
package allocrunner

View File

@ -1,4 +1,5 @@
//+build !linux
//go:build !linux
// +build !linux
package allocrunner

View File

@ -1,6 +1,7 @@
// For now CNI is supported only on Linux.
//
//+build linux
//go:build linux
// +build linux
package allocrunner

View File

@ -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{},
},
},

View File

@ -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.

View File

@ -1,3 +1,4 @@
//go:build !windows
// +build !windows
package taskrunner

View File

@ -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.

View File

@ -1,3 +1,4 @@
//go:build !release
// +build !release
package allocrunner

View File

@ -1,3 +1,4 @@
//go:build !windows
// +build !windows
package allocwatcher

View File

@ -1,3 +1,4 @@
//go:build !ent
// +build !ent
package client

View File

@ -1,3 +1,4 @@
//go:build !linux
// +build !linux
package fingerprint

View File

@ -1,3 +1,4 @@
//go:build !linux
// +build !linux
package fingerprint

View File

@ -1,3 +1,4 @@
//go:build linux
// +build linux
package fingerprint

View File

@ -1,3 +1,4 @@
//go:build linux
// +build linux
package fingerprint

View File

@ -1,4 +1,5 @@
//+build !linux
//go:build !linux
// +build !linux
package fingerprint

View File

@ -1,3 +1,4 @@
//go:build darwin || dragonfly || freebsd || netbsd || openbsd || solaris || windows
// +build darwin dragonfly freebsd netbsd openbsd solaris windows
package fingerprint

View File

@ -1,3 +1,4 @@
//go:build !linux && !windows
// +build !linux,!windows
package fingerprint

View File

@ -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)

View File

@ -1,3 +1,4 @@
//go:build darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris
// +build darwin dragonfly freebsd linux netbsd openbsd solaris
package fingerprint

View File

@ -1,3 +1,4 @@
//go:build !linux
// +build !linux
package cgutil

View File

@ -1,3 +1,4 @@
//go:build !linux
// +build !linux
package cgutil

View File

@ -1,3 +1,4 @@
//go:build !windows
// +build !windows
package fifo

View File

@ -1,3 +1,4 @@
//go:build !release
// +build !release
package drivermanager

View File

@ -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()
}

View File

@ -1,3 +1,4 @@
//go:build !ent
// +build !ent
package agent

View File

@ -1,3 +1,4 @@
//go:build !ent
// +build !ent
package agent

View File

@ -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)
}

View File

@ -1,3 +1,4 @@
//go:build darwin
// +build darwin
package host

View File

@ -1,3 +1,4 @@
//go:build linux
// +build linux
package host

View File

@ -1,3 +1,4 @@
//go:build !windows
// +build !windows
package host

View File

@ -1,3 +1,4 @@
//go:build windows
// +build windows
package host

View File

@ -1,3 +1,4 @@
//go:build !ent
// +build !ent
package agent

View File

@ -1,3 +1,4 @@
//go:build ent
// +build ent
package agent

View File

@ -1,3 +1,4 @@
//go:build !ent
// +build !ent
package agent

View File

@ -1,3 +1,4 @@
//go:build !ui
// +build !ui
package agent

View File

@ -1,3 +1,4 @@
//go:build !ent
// +build !ent
package agent

View File

@ -1,3 +1,4 @@
//go:build darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris
// +build darwin dragonfly freebsd linux netbsd openbsd solaris
package command

View File

@ -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"),
},

View File

@ -1,3 +1,4 @@
//go:build !ent
// +build !ent
package command

View File

@ -1,3 +1,4 @@
//go:build ent
// +build ent
package command

View File

@ -1,3 +1,4 @@
//go:build ent
// +build ent
package command

View File

@ -1,3 +1,4 @@
//go:build ent
// +build ent
package command

View File

@ -1,3 +1,4 @@
//go:build ent
// +build ent
package command

View File

@ -1,3 +1,4 @@
//go:build ent
// +build ent
package command

View File

@ -1,3 +1,4 @@
//go:build ent
// +build ent
package command

View File

@ -1,3 +1,4 @@
//go:build ent
// +build ent
package command

View File

@ -1,3 +1,4 @@
//go:build ent
// +build ent
package command

View File

@ -1,3 +1,4 @@
//go:build ent
// +build ent
package command

View File

@ -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": {}},
},
}

View File

@ -1,4 +1,5 @@
//+build !windows
//go:build !windows
// +build !windows
package docker

View File

@ -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",
},

View File

@ -1,3 +1,4 @@
//go:build darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris
// +build darwin dragonfly freebsd linux netbsd openbsd solaris
package docker

View File

@ -1,3 +1,4 @@
//go:build windows
// +build windows
package docker

View File

@ -1,3 +1,4 @@
//go:build !windows
// +build !windows
package util

View File

@ -1,3 +1,4 @@
//go:build darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris
// +build darwin dragonfly freebsd linux netbsd openbsd solaris
package docker

View File

@ -1,3 +1,4 @@
//go:build windows
// +build windows
package docker

View File

@ -1,3 +1,4 @@
//go:build darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris
// +build darwin dragonfly freebsd linux netbsd openbsd solaris
package exec

View File

@ -1,3 +1,4 @@
//go:build !windows
// +build !windows
package rawexec

View File

@ -1,3 +1,4 @@
//go:build !linux
// +build !linux
package executor

View File

@ -1,3 +1,4 @@
//go:build linux
// +build linux
package executor

View File

@ -1,3 +1,4 @@
//go:build darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris
// +build darwin dragonfly freebsd linux netbsd openbsd solaris
package executor

View File

@ -1,3 +1,4 @@
//go:build darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris
// +build darwin dragonfly freebsd linux netbsd openbsd solaris
package executor

View File

@ -1,3 +1,4 @@
//go:build windows
// +build windows
package executor

View File

@ -1,3 +1,4 @@
//go:build darwin || dragonfly || freebsd || netbsd || openbsd || solaris || windows
// +build darwin dragonfly freebsd netbsd openbsd solaris windows
package executor

View File

@ -1,3 +1,4 @@
//go:build darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris
// +build darwin dragonfly freebsd linux netbsd openbsd solaris
package executor

View File

@ -1,3 +1,4 @@
//go:build !windows
// +build !windows
package hostnames

View File

@ -1,3 +1,4 @@
//go:build !windows
// +build !windows
package resolvconf

View File

@ -1,3 +1,4 @@
//go:build !ent
// +build !ent
// Nomad OSS ignores Consul Namespace configuration in jobs, these e2e tests

View File

@ -1,4 +1,5 @@
//+build linux
//go:build linux
// +build linux
package nomad09upgrade

View File

@ -1,3 +1,4 @@
//+build !linux
//go:build !linux
// +build !linux
package nomad09upgrade

View File

@ -1,3 +1,4 @@
//go:build !ent
// +build !ent
package quotas

View File

@ -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

View File

@ -1,4 +1,5 @@
//+build darwin
//go:build darwin
// +build darwin
package freeport

View File

@ -1,4 +1,5 @@
//+build darwin
//go:build darwin
// +build darwin
package freeport

View File

@ -1,4 +1,5 @@
//+build freebsd
//go:build freebsd
// +build freebsd
package freeport

View File

@ -1,4 +1,5 @@
//+build linux
//go:build linux
// +build linux
package freeport

View File

@ -1,4 +1,5 @@
//+build linux
//go:build linux
// +build linux
package freeport

View File

@ -1,4 +1,5 @@
//+build windows
//go:build windows
// +build windows
package freeport

View File

@ -1,3 +1,4 @@
//go:build linux
// +build linux
package mount

View File

@ -1,3 +1,4 @@
//go:build !linux
// +build !linux
package mount

View File

@ -1,3 +1,4 @@
//go:build !release
// +build !release
package catalog

View File

@ -1,3 +1,4 @@
//go:build !windows
// +build !windows
package loader

View File

@ -1,3 +1,4 @@
//go:build windows
// +build windows
package loader

View File

@ -1,3 +1,4 @@
//go:build !ent
// +build !ent
package raftutil

View File

@ -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"),

View File

@ -1,3 +1,4 @@
//go:build darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris
// +build darwin dragonfly freebsd linux netbsd openbsd solaris
package testtask

View File

@ -1,3 +1,4 @@
//go:build windows
// +build windows
package testtask

View File

@ -1,4 +1,5 @@
//+build windows
//go:build windows
// +build windows
package winsvc

View File

@ -1,4 +1,5 @@
//+build !ent
//go:build !ent
// +build !ent
package nomad

View File

@ -1,4 +1,5 @@
//+build !ent
//go:build !ent
// +build !ent
package nomad

View File

@ -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",

View File

@ -1,3 +1,4 @@
//go:build !ent
// +build !ent
package deploymentwatcher

View File

@ -1,3 +1,4 @@
//go:build !ent
// +build !ent
package nomad

View File

@ -1,3 +1,4 @@
//go:build !ent
// +build !ent
package nomad

Some files were not shown because too many files have changed in this diff Show More