Merge pull request #11251 from hashicorp/f-golang-1.17.1

Upgrade Golang to 1.17.1
This commit is contained in:
Mahmood Ali 2021-10-04 13:52:00 -04:00 committed by GitHub
commit 8b2ce4e353
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
126 changed files with 174 additions and 62 deletions

3
.changelog/11251.txt Normal file
View file

@ -0,0 +1,3 @@
```release-note:improvement
build: Updated to Go 1.17.1
```

View file

@ -512,7 +512,7 @@ executors:
go: go:
working_directory: /go/src/github.com/hashicorp/nomad working_directory: /go/src/github.com/hashicorp/nomad
docker: docker:
- image: docker.mirror.hashicorp.services/golang:1.16.7 - image: docker.mirror.hashicorp.services/golang:1.17.1
environment: environment:
<<: *common_envs <<: *common_envs
GOPATH: /go GOPATH: /go
@ -524,7 +524,7 @@ executors:
environment: &machine_env environment: &machine_env
<<: *common_envs <<: *common_envs
GOPATH: /home/circleci/go GOPATH: /home/circleci/go
GOLANG_VERSION: 1.16.7 GOLANG_VERSION: 1.17.1
# uses a more recent image with unattended upgrades disabled properly # uses a more recent image with unattended upgrades disabled properly
# but seems to break docker builds # but seems to break docker builds
@ -541,7 +541,7 @@ executors:
environment: environment:
<<: *common_envs <<: *common_envs
GOPATH: /Users/distiller/go GOPATH: /Users/distiller/go
GOLANG_VERSION: 1.16.7 GOLANG_VERSION: 1.17.1
go-windows: go-windows:
machine: machine:
@ -553,7 +553,7 @@ executors:
GOPATH: c:\gopath GOPATH: c:\gopath
GOBIN: c:\gopath\bin GOBIN: c:\gopath\bin
GOTESTSUM_PATH: c:\tmp\test-reports GOTESTSUM_PATH: c:\tmp\test-reports
GOLANG_VERSION: 1.16.7 GOLANG_VERSION: 1.17.1
GOTESTSUM_VERSION: 0.4.2 GOTESTSUM_VERSION: 0.4.2
VAULT_VERSION: 1.4.1 VAULT_VERSION: 1.4.1

View file

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

View file

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

View file

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

View file

@ -1,3 +1,4 @@
//go:build linux && cgo
// +build linux,cgo // +build linux,cgo
// #cgo LDFLAGS: -mfloat-abi=hard // #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 // +build darwin dragonfly freebsd linux netbsd openbsd solaris
package allocdir package allocdir

View file

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

View file

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

View file

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

View file

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

View file

@ -1,3 +1,4 @@
//go:build linux
// +build linux // +build linux
package allocrunner package allocrunner
@ -19,10 +20,10 @@ func TestCNI_cniToAllocNet_Fallback(t *testing.T) {
// following: // following:
cniResult := &cni.CNIResult{ cniResult := &cni.CNIResult{
Interfaces: map[string]*cni.Config{ Interfaces: map[string]*cni.Config{
"cali39179aa3-74": &cni.Config{}, "cali39179aa3-74": {},
"eth0": &cni.Config{ "eth0": {
IPConfigs: []*cni.IPConfig{ IPConfigs: []*cni.IPConfig{
&cni.IPConfig{ {
IP: net.IPv4(192, 168, 135, 232), 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) { func TestCNI_cniToAllocNet_Invalid(t *testing.T) {
cniResult := &cni.CNIResult{ cniResult := &cni.CNIResult{
Interfaces: map[string]*cni.Config{ Interfaces: map[string]*cni.Config{
"eth0": &cni.Config{}, "eth0": {},
"veth1": &cni.Config{ "veth1": {
IPConfigs: []*cni.IPConfig{}, IPConfigs: []*cni.IPConfig{},
}, },
}, },

View file

@ -1,4 +1,6 @@
//go:build !windows
// +build !windows // +build !windows
// todo(shoenig): Once Connect is supported on Windows, we'll need to make this // todo(shoenig): Once Connect is supported on Windows, we'll need to make this
// set of tests work there too. // set of tests work there too.

View file

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

View file

@ -1,4 +1,6 @@
//go:build !windows
// +build !windows // +build !windows
// todo(shoenig): Once Connect is supported on Windows, we'll need to make this // todo(shoenig): Once Connect is supported on Windows, we'll need to make this
// set of tests work there too. // set of tests work there too.

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,4 +1,5 @@
//+build !linux //go:build !linux
// +build !linux
package fingerprint 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 // +build darwin dragonfly freebsd netbsd openbsd solaris windows
package fingerprint package fingerprint

View file

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

View file

@ -479,7 +479,7 @@ func TestNetworkFingerPrint_MultipleAliases(t *testing.T) {
} }
} }
expected := []string{} expected := []string{}
for alias, _ := range cfg.HostNetworks { for alias := range cfg.HostNetworks {
expected = append(expected, alias) expected = append(expected, alias)
} }
sort.Strings(expected) 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 // +build darwin dragonfly freebsd linux netbsd openbsd solaris
package fingerprint package fingerprint

View file

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

View file

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

View file

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

View file

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

View file

@ -196,7 +196,7 @@ func TestStateDB_Batch(t *testing.T) {
if getTxID != nil { if getTxID != nil {
numTransactions := getTxID() - prevTxID numTransactions := getTxID() - prevTxID
writeTime := time.Now().Sub(startTime) 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) require.LessOrEqual(numTransactions, expectedNumTransactions)
prevTxID = getTxID() prevTxID = getTxID()
} }

View file

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

View file

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

View file

@ -12,6 +12,6 @@ func TestConnectProxies_Proxies(t *testing.T) {
proxies, err := pc.Proxies() proxies, err := pc.Proxies()
require.NoError(t, err) require.NoError(t, err)
require.Equal(t, map[string][]string{ 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) }, proxies)
} }

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,3 +1,4 @@
//go:build !ent
// +build !ent // +build !ent
package agent 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 // +build darwin dragonfly freebsd linux netbsd openbsd solaris
package command package command

View file

@ -133,9 +133,9 @@ func TestAllocStatusCommand_LifecycleInfo(t *testing.T) {
a.TaskResources["init_task"] = a.TaskResources["web"] a.TaskResources["init_task"] = a.TaskResources["web"]
a.TaskResources["prestart_sidecar"] = a.TaskResources["web"] a.TaskResources["prestart_sidecar"] = a.TaskResources["web"]
a.TaskStates = map[string]*structs.TaskState{ a.TaskStates = map[string]*structs.TaskState{
"web": &structs.TaskState{State: "pending"}, "web": {State: "pending"},
"init_task": &structs.TaskState{State: "running"}, "init_task": {State: "running"},
"prestart_sidecar": &structs.TaskState{State: "running"}, "prestart_sidecar": {State: "running"},
} }
require.Nil(t, state.UpsertAllocs(structs.MsgTypeTestSetup, 1000, []*structs.Allocation{a})) 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 // fakes the placement enough so that we have something to iterate
// on in 'nomad alloc status' // on in 'nomad alloc status'
alloc.TaskStates = map[string]*structs.TaskState{ alloc.TaskStates = map[string]*structs.TaskState{
"web": &structs.TaskState{ "web": {
Events: []*structs.TaskEvent{ Events: []*structs.TaskEvent{
structs.NewTaskEvent("test event").SetMessage("test msg"), 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 // if we don't set a task state, there's nothing to iterate on alloc status
alloc.TaskStates = map[string]*structs.TaskState{ alloc.TaskStates = map[string]*structs.TaskState{
"web": &structs.TaskState{ "web": {
Events: []*structs.TaskEvent{ Events: []*structs.TaskEvent{
structs.NewTaskEvent("test event").SetMessage("test msg"), structs.NewTaskEvent("test event").SetMessage("test msg"),
}, },

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -30,7 +30,7 @@ A development environment is supplied via Vagrant to make getting started easier
Developing without Vagrant Developing without Vagrant
--- ---
1. Install [Go 1.16.7+](https://golang.org/) *(Note: `gcc-go` is not supported)* 1. Install [Go 1.17.1+](https://golang.org/) *(Note: `gcc-go` is not supported)*
1. Clone this repo 1. Clone this repo
```sh ```sh
$ git clone https://github.com/hashicorp/nomad.git $ git clone https://github.com/hashicorp/nomad.git

View file

@ -12,6 +12,7 @@ version.
| Nomad Version | Go Version | | Nomad Version | Go Version |
|:-------------:|:----------:| |:-------------:|:----------:|
| 1.2 | 1.17 |
| 1.1 | 1.16 | | 1.1 | 1.16 |
| 1.0 | 1.15 | | 1.0 | 1.15 |
| 0.12 | 1.14 | | 0.12 | 1.14 |

View file

@ -694,12 +694,12 @@ func TestConfig_DriverConfig_AllowRuntimes(t *testing.T) {
{ {
name: "pure default", name: "pure default",
config: `{}`, config: `{}`,
expected: map[string]struct{}{"runc": struct{}{}, "nvidia": struct{}{}}, expected: map[string]struct{}{"runc": {}, "nvidia": {}},
}, },
{ {
name: "custom", name: "custom",
config: `{ allow_runtimes = ["runc", "firecracker"]}`, 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 package docker

View file

@ -1224,12 +1224,12 @@ func TestDockerDriver_CreateContainerConfig_Mounts(t *testing.T) {
defer freeport.Return(ports) defer freeport.Return(ports)
cfg.Mounts = []DockerMount{ cfg.Mounts = []DockerMount{
DockerMount{ {
Type: "bind", Type: "bind",
Target: "/map-bind-target", Target: "/map-bind-target",
Source: "/map-source", Source: "/map-source",
}, },
DockerMount{ {
Type: "tmpfs", Type: "tmpfs",
Target: "/map-tmpfs-target", 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 // +build darwin dragonfly freebsd linux netbsd openbsd solaris
package docker package docker

View file

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

View file

@ -1,3 +1,4 @@
//go:build !windows
// +build !windows // +build !windows
package util 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 // +build darwin dragonfly freebsd linux netbsd openbsd solaris
package docker package docker

View file

@ -1,3 +1,4 @@
//go:build windows
// +build windows // +build windows
package docker 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 // +build darwin dragonfly freebsd linux netbsd openbsd solaris
package exec package exec

View file

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

View file

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

View file

@ -1,3 +1,4 @@
//go:build linux
// +build linux // +build linux
package executor 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 // +build darwin dragonfly freebsd linux netbsd openbsd solaris
package executor 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 // +build darwin dragonfly freebsd linux netbsd openbsd solaris
package executor package executor

View file

@ -1,3 +1,4 @@
//go:build windows
// +build windows // +build windows
package executor 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 // +build darwin dragonfly freebsd netbsd openbsd solaris windows
package executor 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 // +build darwin dragonfly freebsd linux netbsd openbsd solaris
package executor package executor

View file

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

View file

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

View file

@ -1,3 +1,4 @@
//go:build !ent
// +build !ent // +build !ent
// Nomad OSS ignores Consul Namespace configuration in jobs, these e2e tests // 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 package nomad09upgrade

View file

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

View file

@ -1,3 +1,4 @@
//go:build !ent
// +build !ent // +build !ent
package quotas 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)) binaries := make(map[string]string, len(versions))
for ver, _ := range versions { for ver := range versions {
binaries[ver] = filepath.Join(binDir, ver) binaries[ver] = filepath.Join(binDir, ver)
} }
return sorted, binaries return sorted, binaries

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -21,7 +21,7 @@ func TestArchive(t *testing.T) {
Term: 2011, Term: 2011,
Configuration: raft.Configuration{ Configuration: raft.Configuration{
Servers: []raft.Server{ Servers: []raft.Server{
raft.Server{ {
Suffrage: raft.Voter, Suffrage: raft.Voter,
ID: raft.ServerID("hello"), ID: raft.ServerID("hello"),
Address: raft.ServerAddress("127.0.0.1:8300"), 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 // +build darwin dragonfly freebsd linux netbsd openbsd solaris
package testtask package testtask

View file

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

View file

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

View file

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

View file

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

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