diff --git a/.changelog/25249.txt b/.changelog/25249.txt new file mode 100644 index 000000000..c00036c18 --- /dev/null +++ b/.changelog/25249.txt @@ -0,0 +1,3 @@ +```release-note:improvement +build: Updated Go to 1.24.1 +``` diff --git a/.go-version b/.go-version index d8c40e539..f9e8384bb 100644 --- a/.go-version +++ b/.go-version @@ -1 +1 @@ -1.23.6 +1.24.1 diff --git a/.golangci.yml b/.golangci.yml index d08679282..81a4e92b8 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -47,7 +47,8 @@ linters-settings: # exclude: /path/to/file.txt govet: # report about shadowed variables - check-shadowing: false + disable: + - shadow gofmt: # simplify code: gofmt with `-s` option, true by default simplify: true @@ -86,7 +87,6 @@ linters: - durationcheck # - errchkjson (todo) # - errorlint (todo) - - exportloopref + - copyloopvar - usestdlibvars fast: false - diff --git a/.semgrep/loopclosure.yml b/.semgrep/loopclosure.yml deleted file mode 100644 index ce358e951..000000000 --- a/.semgrep/loopclosure.yml +++ /dev/null @@ -1,31 +0,0 @@ -# Copyright (c) HashiCorp, Inc. -# SPDX-License-Identifier: BUSL-1.1 - -rules: - - id: loopclosure - patterns: - - pattern-inside: | - for $A, $B := range $C { - ... - } - - pattern-inside: | - go func() { - ... - }() - - pattern-not-inside: | - go func(..., $B, ...) { - ... - }(..., $B, ...) - - pattern-not-inside: | - go func() { - ... - for ... { - ... - } - ... - }() - - pattern: $B - message: Loop variable $B used inside goroutine - languages: - - go - severity: WARNING diff --git a/GNUmakefile b/GNUmakefile index 251dba9f2..8c30a97c9 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -136,16 +136,16 @@ deps: ## Install build and development dependencies go install github.com/hashicorp/go-msgpack/v2/codec/codecgen@v2.1.2 go install github.com/bufbuild/buf/cmd/buf@v0.36.0 go install github.com/hashicorp/go-changelog/cmd/changelog-build@latest - go install golang.org/x/tools/cmd/stringer@v0.18.0 + go install golang.org/x/tools/cmd/stringer@v0.30.0 go install github.com/hashicorp/hc-install/cmd/hc-install@v0.9.0 go install github.com/shoenig/go-modtool@v0.2.0 .PHONY: lint-deps lint-deps: ## Install linter dependencies @echo "==> Updating linter dependencies..." - go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.61.0 + go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.64.5 go install github.com/client9/misspell/cmd/misspell@v0.3.4 - go install github.com/hashicorp/go-hclog/hclogvet@v0.2.0 + go install github.com/hashicorp/go-hclog/hclogvet@feaf6d2ec20fd895e711195c99e3fde93a68afc5 .PHONY: git-hooks git-dir = $(shell git rev-parse --git-dir) diff --git a/command/agent/config_parse.go b/command/agent/config_parse.go index d5bb7b549..7ee8d8e53 100644 --- a/command/agent/config_parse.go +++ b/command/agent/config_parse.go @@ -185,9 +185,6 @@ func ParseConfigFile(path string) (*Config, error) { // Parse durations for Consul and Vault config blocks if provided. for _, consulConfig := range c.Consuls { - // Capture consulConfig inside the loop so the parse duration function - // modifies the right configuration. - consulConfig := consulConfig if consulConfig.ServiceIdentity != nil { tds = append(tds, durationConversionMap{ @@ -209,9 +206,6 @@ func ParseConfigFile(path string) (*Config, error) { } for _, vaultConfig := range c.Vaults { - // Capture vaultConfig inside the loop so the parse duration function - // modifies the right configuration. - vaultConfig := vaultConfig if vaultConfig.DefaultIdentity != nil { tds = append(tds, durationConversionMap{ diff --git a/command/job_stop.go b/command/job_stop.go index 323f4a51d..e08787ec2 100644 --- a/command/job_stop.go +++ b/command/job_stop.go @@ -148,7 +148,6 @@ func (c *JobStopCommand) Run(args []string) int { var wg sync.WaitGroup for _, jobID := range jobIDs { - jobID := jobID wg.Add(1) go func() { diff --git a/contributing/README.md b/contributing/README.md index 802cc8d93..178377a16 100644 --- a/contributing/README.md +++ b/contributing/README.md @@ -33,7 +33,7 @@ A development environment is supplied via Vagrant to make getting started easier Developing without Vagrant --- -1. Install [Go 1.23.6+](https://golang.org/) *(Note: `gcc-go` is not supported)* +1. Install [Go 1.24.1+](https://golang.org/) *(Note: `gcc-go` is not supported)* 1. Clone this repo ```sh $ git clone https://github.com/hashicorp/nomad.git diff --git a/scripts/linux-priv-go.sh b/scripts/linux-priv-go.sh index 81bfb2089..7411513ce 100755 --- a/scripts/linux-priv-go.sh +++ b/scripts/linux-priv-go.sh @@ -21,7 +21,7 @@ case $(arch) in esac function install_go() { - local go_version="1.23.6" + local go_version="1.24.1" local download="https://storage.googleapis.com/golang/go${go_version}.linux-${ARCH}.tar.gz" if go version 2>&1 | grep -q "${go_version}"; then diff --git a/scripts/release/mac-remote-build b/scripts/release/mac-remote-build index 19d6319ea..18fdde628 100755 --- a/scripts/release/mac-remote-build +++ b/scripts/release/mac-remote-build @@ -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.23.6" + local go_version="1.24.1" local download= download="https://storage.googleapis.com/golang/go${go_version}.darwin-amd64.tar.gz"