Skip to content

Commit

Permalink
Backport of build: update to go1.20 into release/1.2.x (#16048)
Browse files Browse the repository at this point in the history
This pull request was automerged via backport-assistant
  • Loading branch information
hc-github-team-nomad-core authored Feb 3, 2023
1 parent fdd37d1 commit ce1a72a
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 18 deletions.
3 changes: 3 additions & 0 deletions .changelog/16029.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:improvement
build: Update to go1.20
```
8 changes: 4 additions & 4 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ executors:
go:
working_directory: /go/src/github.com/hashicorp/nomad
docker:
- image: docker.mirror.hashicorp.services/golang:1.19.5
- image: docker.mirror.hashicorp.services/golang:1.20
resource_class: medium
environment:
<<: *common_envs
Expand All @@ -473,7 +473,7 @@ executors:
resource_class: large
environment: &machine_env
<<: *common_envs
GOLANG_VERSION: 1.19.5
GOLANG_VERSION: '1.20'

go-macos:
working_directory: ~/go/src/github.com/hashicorp/nomad
Expand All @@ -482,7 +482,7 @@ executors:
environment:
<<: *common_envs
GOPATH: /Users/distiller/go
GOLANG_VERSION: 1.19.5
GOLANG_VERSION: '1.20'

go-windows:
machine:
Expand All @@ -494,7 +494,7 @@ executors:
GOPATH: c:\gopath
GOBIN: c:\gopath\bin
GOTESTSUM_PATH: c:\tmp\test-reports
GOLANG_VERSION: 1.19.5
GOLANG_VERSION: '1.20'
GOTESTSUM_VERSION: 1.7.0
VAULT_VERSION: 1.4.1

Expand Down
2 changes: 1 addition & 1 deletion .go-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.19.5
1.20
9 changes: 7 additions & 2 deletions command/agent/http_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -712,6 +712,7 @@ func TestHTTP_VerifyHTTPSClient(t *testing.T) {
CertFile: foocert,
KeyFile: fookey,
}
c.LogLevel = "off"
})
defer s.Shutdown()

Expand All @@ -727,7 +728,9 @@ func TestHTTP_VerifyHTTPSClient(t *testing.T) {
if !ok {
t.Fatalf("expected a *url.Error but received: %T -> %v", err, err)
}
hostErr, ok := urlErr.Err.(x509.HostnameError)

cveErr := (urlErr.Err.(*tls.CertificateVerificationError)).Err
hostErr, ok := cveErr.(x509.HostnameError)
if !ok {
t.Fatalf("expected a x509.HostnameError but received: %T -> %v", urlErr.Err, urlErr.Err)
}
Expand Down Expand Up @@ -755,7 +758,9 @@ func TestHTTP_VerifyHTTPSClient(t *testing.T) {
if !ok {
t.Fatalf("expected a *url.Error but received: %T -> %v", err, err)
}
_, ok = urlErr.Err.(x509.UnknownAuthorityError)

cveErr = (urlErr.Err.(*tls.CertificateVerificationError)).Err
_, ok = cveErr.(x509.UnknownAuthorityError)
if !ok {
t.Fatalf("expected a x509.UnknownAuthorityError but received: %T -> %v", urlErr.Err, urlErr.Err)
}
Expand Down
14 changes: 7 additions & 7 deletions command/metrics_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (

"github.com/hashicorp/nomad/ci"
"github.com/mitchellh/cli"
"github.com/stretchr/testify/require"
"github.com/shoenig/test/must"
)

var _ cli.Command = &OperatorMetricsCommand{}
Expand Down Expand Up @@ -73,19 +73,19 @@ func TestCommand_Metrics_Cases(t *testing.T) {
[]string{"-address=http://foo"},
1,
"",
"dial tcp: lookup foo: Temporary failure in name resolution",
"dial tcp: lookup foo", // dns resolution error messages changes with Go, OS version
},
}

for _, c := range cases {
t.Run(c.name, func(t *testing.T) {
code := cmd.Run(c.args)
out := ui.OutputWriter.String()
outerr := ui.ErrorWriter.String()
stdOut := ui.OutputWriter.String()
stdErr := ui.ErrorWriter.String()

require.Equalf(t, code, c.expectedCode, "expected exit code %d, got: %d: %s", c.expectedCode, code, outerr)
require.Contains(t, out, c.expectedOutput, "expected output \"%s\", got \"%s\"", c.expectedOutput, out)
require.Containsf(t, outerr, c.expectedError, "expected error \"%s\", got \"%s\"", c.expectedError, outerr)
must.Eq(t, code, c.expectedCode, must.Sprintf("expected exit code %d, got: %d: %s", c.expectedCode, code, stdErr))
must.StrContains(t, stdOut, c.expectedOutput)
must.StrContains(t, stdErr, c.expectedError)

ui.OutputWriter.Reset()
ui.ErrorWriter.Reset()
Expand Down
2 changes: 1 addition & 1 deletion contributing/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ A development environment is supplied via Vagrant to make getting started easier

Developing without Vagrant
---
1. Install [Go 1.19.5+](https://golang.org/) *(Note: `gcc-go` is not supported)*
1. Install [Go 1.20+](https://golang.org/) *(Note: `gcc-go` is not supported)*
1. Clone this repo
```sh
$ git clone https://github.com/hashicorp/nomad.git
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/hashicorp/nomad

go 1.19
go 1.20

// Pinned dependencies are noted in github.com/hashicorp/nomad/issues/11826
replace (
Expand Down
2 changes: 1 addition & 1 deletion scripts/release/mac-remote-build
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ REPO_PATH="${TMP_WORKSPACE}/gopath/src/github.com/hashicorp/nomad"
mkdir -p "${TMP_WORKSPACE}/tmp"
install_go() {
local go_version="1.19.5"
local go_version="1.20"
local download=
download="https://storage.googleapis.com/golang/go${go_version}.darwin-amd64.tar.gz"
Expand Down
2 changes: 1 addition & 1 deletion scripts/vagrant-linux-priv-go.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
set -o errexit

function install_go() {
local go_version="1.19.5"
local go_version="1.20"
local download="https://storage.googleapis.com/golang/go${go_version}.linux-amd64.tar.gz"

if go version 2>&1 | grep -q "${go_version}"; then
Expand Down

0 comments on commit ce1a72a

Please sign in to comment.