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

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

@ -30,7 +30,7 @@ A development environment is supplied via Vagrant to make getting started easier
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
```sh
$ git clone https://github.com/hashicorp/nomad.git

View File

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

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

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