From 30d97687b527c4c3738c779d784f43d1d5dcc938 Mon Sep 17 00:00:00 2001 From: Johan Brandhorst-Satzkorn Date: Tue, 2 Sep 2025 15:27:22 -0700 Subject: [PATCH] Upgrade Go to 1.25 (#6011) * Upgrade Go to 1.25 * Upgrade to golangci-lint v2 * Remove use of apt-key --- .go-version | 2 +- .golangci.yml | 162 ++++++++++++++----------- Makefile | 2 +- api/go.mod | 2 +- enos/modules/test_e2e_docker/test.sh | 20 +-- go.mod | 2 +- plugins/boundary/mains/aws/go.mod | 2 +- plugins/boundary/mains/azure/go.mod | 2 +- plugins/boundary/mains/gcp/go.mod | 2 +- plugins/boundary/mains/minio/go.mod | 2 +- plugins/kms/mains/alicloudkms/go.mod | 2 +- plugins/kms/mains/awskms/go.mod | 2 +- plugins/kms/mains/azurekeyvault/go.mod | 2 +- plugins/kms/mains/gcpckms/go.mod | 2 +- plugins/kms/mains/ocikms/go.mod | 2 +- plugins/kms/mains/transit/go.mod | 2 +- sdk/go.mod | 2 +- 17 files changed, 117 insertions(+), 95 deletions(-) diff --git a/.go-version b/.go-version index 2f4320f67..ad2191947 100644 --- a/.go-version +++ b/.go-version @@ -1 +1 @@ -1.24.4 +1.25.0 diff --git a/.golangci.yml b/.golangci.yml index 608d91266..6701a0514 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,77 +1,93 @@ +version: "2" linters: - disable-all: true + default: none enable: - - staticcheck - - stylecheck + - bodyclose - errcheck - misspell - - bodyclose - -issues: - exclude-rules: - - linters: - - stylecheck - text: "ST1005:" - - linters: - - stylecheck - text: "ST1003:" - - linters: - - staticcheck - text: "SA1019: pbs.AuthorizedWorkerList is deprecated:" - - linters: - - staticcheck - text: "SA1019: item.GetGrantScopeId is deprecated:" - - linters: - - staticcheck - text: "SA1019: out.GrantScopeId is deprecated:" - - linters: - - staticcheck - text: "SA1019: authorized.GetWorkerKeyIdentifiers is deprecated:" - - linters: - - staticcheck - text: "SA1019: result.GetAuthorizedWorkers is deprecated:" - - linters: - - staticcheck - text: "SA1019: item.GetWorkerFilter is deprecated:" - - linters: - - staticcheck - text: "SA1019: out.GetWorkerFilter is deprecated:" - - linters: - - staticcheck - text: "SA1019: out.WorkerFilter is deprecated:" - - linters: - - staticcheck - text: "SA1019: req.GetTokenType is deprecated:" - - linters: - - staticcheck - text: "SA1019: s.resp.GetPkcs8HostKeys is deprecated:" - - linters: - - staticcheck - text: "SA1019: s.resp.GetCredentials is deprecated:" - - linters: - - staticcheck - text: 'SA1019: got.GetAuthorizedWorkers is deprecated:' - - linters: - - staticcheck - text: 'SA1019: gotAuthorizedWorkers.GetWorkerKeyIdentifiers is deprecated:' - - linters: - - staticcheck - text: 'SA1019: tc.want.GetAuthorizedWorkers is deprecated:' - - linters: - - staticcheck - text: 'SA1019: wantAuthorizedWorkers.GetWorkerKeyIdentifiers is deprecated:' - - linters: - - staticcheck - text: "SA1019: authorizedWorkerList.WorkerKeyIdentifiers is deprecated:" - - linters: - - staticcheck - text: "SA1019: req.GetConnectedWorkerKeyIdentifiers is deprecated:" - - linters: - - staticcheck - text: "SA1019: j.GetId is deprecated:" - - linters: - - staticcheck - text: "SA1019: pbs.StatusRequest is deprecated:" - - linters: - - staticcheck - text: "SA1019: pbs.StatusResponse is deprecated:" + - staticcheck + exclusions: + generated: lax + presets: + - comments + - common-false-positives + - legacy + - std-error-handling + rules: + - linters: + - staticcheck + text: 'ST1005:' + - linters: + - staticcheck + text: 'ST1003:' + - linters: + - staticcheck + text: 'SA1019: pbs.AuthorizedWorkerList is deprecated:' + - linters: + - staticcheck + text: 'SA1019: item.GetGrantScopeId is deprecated:' + - linters: + - staticcheck + text: 'SA1019: out.GrantScopeId is deprecated:' + - linters: + - staticcheck + text: 'SA1019: authorized.GetWorkerKeyIdentifiers is deprecated:' + - linters: + - staticcheck + text: 'SA1019: result.GetAuthorizedWorkers is deprecated:' + - linters: + - staticcheck + text: 'SA1019: item.GetWorkerFilter is deprecated:' + - linters: + - staticcheck + text: 'SA1019: out.GetWorkerFilter is deprecated:' + - linters: + - staticcheck + text: 'SA1019: out.WorkerFilter is deprecated:' + - linters: + - staticcheck + text: 'SA1019: req.GetTokenType is deprecated:' + - linters: + - staticcheck + text: 'SA1019: s.resp.GetPkcs8HostKeys is deprecated:' + - linters: + - staticcheck + text: 'SA1019: s.resp.GetCredentials is deprecated:' + - linters: + - staticcheck + text: 'SA1019: got.GetAuthorizedWorkers is deprecated:' + - linters: + - staticcheck + text: 'SA1019: gotAuthorizedWorkers.GetWorkerKeyIdentifiers is deprecated:' + - linters: + - staticcheck + text: 'SA1019: tc.want.GetAuthorizedWorkers is deprecated:' + - linters: + - staticcheck + text: 'SA1019: wantAuthorizedWorkers.GetWorkerKeyIdentifiers is deprecated:' + - linters: + - staticcheck + text: 'SA1019: authorizedWorkerList.WorkerKeyIdentifiers is deprecated:' + - linters: + - staticcheck + text: 'SA1019: req.GetConnectedWorkerKeyIdentifiers is deprecated:' + - linters: + - staticcheck + text: 'SA1019: j.GetId is deprecated:' + - linters: + - staticcheck + text: 'SA1019: pbs.StatusRequest is deprecated:' + - linters: + - staticcheck + text: 'SA1019: pbs.StatusResponse is deprecated:' + paths: + - third_party$ + - builtin$ + - examples$ +formatters: + exclusions: + generated: lax + paths: + - third_party$ + - builtin$ + - examples$ diff --git a/Makefile b/Makefile index 0887041f6..ef07c7935 100644 --- a/Makefile +++ b/Makefile @@ -37,7 +37,7 @@ golangci-lint: if [ "$(GOLINT_INSTALLED)" = "" ]; then \ curl -sSfL \ - https://raw.githubusercontent.com/golangci/golangci-lint/3f6f9043a8d0048ec075d2ace970b256cdf37a96/install.sh | sh -s -- -b $(GO_PATH)/bin v1.64.7; \ + https://raw.githubusercontent.com/golangci/golangci-lint/3f6f9043a8d0048ec075d2ace970b256cdf37a96/install.sh | sh -s -- -b $(GO_PATH)/bin v2.4.0; \ fi; .PHONY: cleangen diff --git a/api/go.mod b/api/go.mod index c445d6801..4ab03c56b 100644 --- a/api/go.mod +++ b/api/go.mod @@ -1,6 +1,6 @@ module github.com/hashicorp/boundary/api -go 1.24.0 +go 1.25.0 require ( github.com/coder/websocket v1.8.13 diff --git a/enos/modules/test_e2e_docker/test.sh b/enos/modules/test_e2e_docker/test.sh index 9c44c2d4a..56e2e6b0a 100755 --- a/enos/modules/test_e2e_docker/test.sh +++ b/enos/modules/test_e2e_docker/test.sh @@ -17,16 +17,22 @@ apt update # default-mysql-client is used for mysql tests # wget is used for downloading external dependencies and repository keys # apt-transport-https enables HTTPS transport for APT repositories -apt install unzip pass lsb-release postgresql-client default-mysql-client wget apt-transport-https -y +apt install unzip pass lsb-release postgresql-client default-mysql-client wget apt-transport-https -y # Function to install Cassandra install_cassandra() { # Add Cassandra repository key - wget -q -O - https://www.apache.org/dist/cassandra/KEYS | apt-key add - - + wget -O cassandra.keys https://www.apache.org/dist/cassandra/KEYS + + # Convert key to gpg format + gpg --no-default-keyring --keyring ./temp-keyring.gpg --import cassandra.keys + gpg --no-default-keyring --keyring ./temp-keyring.gpg --export --output cassandra.gpg + rm ./temp-keyring.gpg cassandra.keys + mv cassandra.gpg /etc/apt/keyrings/cassandra.gpg + # Add Cassandra repository - echo "deb https://debian.cassandra.apache.org 41x main" | tee -a /etc/apt/sources.list.d/cassandra.sources.list - + echo "deb [signed-by=/etc/apt/keyrings/cassandra.gpg] https://debian.cassandra.apache.org 41x main" | tee -a /etc/apt/sources.list.d/cassandra.sources.list + # Update package list and install Cassandra apt update apt install cassandra -y @@ -40,9 +46,9 @@ install_cassandra export KEY_PW=boundary gpg --generate-key --batch < ./api diff --git a/plugins/boundary/mains/aws/go.mod b/plugins/boundary/mains/aws/go.mod index 7672ccd04..8a3085050 100644 --- a/plugins/boundary/mains/aws/go.mod +++ b/plugins/boundary/mains/aws/go.mod @@ -1,6 +1,6 @@ module github.com/hashicorp/boundary/plugins/boundary/mains/aws -go 1.24.0 +go 1.25.0 require ( github.com/hashicorp/boundary-plugin-aws v0.5.1 diff --git a/plugins/boundary/mains/azure/go.mod b/plugins/boundary/mains/azure/go.mod index 25275db4d..a658be223 100644 --- a/plugins/boundary/mains/azure/go.mod +++ b/plugins/boundary/mains/azure/go.mod @@ -1,6 +1,6 @@ module github.com/hashicorp/boundary/plugins/boundary/mains/azure -go 1.24.0 +go 1.25.0 require ( github.com/hashicorp/boundary-plugin-azure v0.2.0 diff --git a/plugins/boundary/mains/gcp/go.mod b/plugins/boundary/mains/gcp/go.mod index 26a180dc4..cdaca8a3d 100644 --- a/plugins/boundary/mains/gcp/go.mod +++ b/plugins/boundary/mains/gcp/go.mod @@ -1,6 +1,6 @@ module github.com/hashicorp/boundary/plugins/boundary/mains/gcp -go 1.24.0 +go 1.25.0 require ( github.com/hashicorp/boundary-plugin-gcp v0.1.0 diff --git a/plugins/boundary/mains/minio/go.mod b/plugins/boundary/mains/minio/go.mod index 2fa295708..79228be79 100644 --- a/plugins/boundary/mains/minio/go.mod +++ b/plugins/boundary/mains/minio/go.mod @@ -1,6 +1,6 @@ module github.com/hashicorp/boundary/plugins/boundary/mains/minio -go 1.24.0 +go 1.25.0 require ( github.com/hashicorp/boundary-plugin-minio v0.1.7 diff --git a/plugins/kms/mains/alicloudkms/go.mod b/plugins/kms/mains/alicloudkms/go.mod index 5739b99d9..9c43adeef 100644 --- a/plugins/kms/mains/alicloudkms/go.mod +++ b/plugins/kms/mains/alicloudkms/go.mod @@ -1,6 +1,6 @@ module github.com/hashicorp/boundary/plugins/kms/mains/alicloudkms -go 1.24.0 +go 1.25.0 require ( github.com/hashicorp/go-kms-wrapping/plugin/v2 v2.0.8 diff --git a/plugins/kms/mains/awskms/go.mod b/plugins/kms/mains/awskms/go.mod index ed42cc401..01d11eeb6 100644 --- a/plugins/kms/mains/awskms/go.mod +++ b/plugins/kms/mains/awskms/go.mod @@ -1,6 +1,6 @@ module github.com/hashicorp/boundary/plugins/kms/mains/awskms -go 1.24.0 +go 1.25.0 require ( github.com/hashicorp/go-kms-wrapping/plugin/v2 v2.0.8 diff --git a/plugins/kms/mains/azurekeyvault/go.mod b/plugins/kms/mains/azurekeyvault/go.mod index 32f61aa31..7f2a571c6 100644 --- a/plugins/kms/mains/azurekeyvault/go.mod +++ b/plugins/kms/mains/azurekeyvault/go.mod @@ -1,6 +1,6 @@ module github.com/hashicorp/boundary/plugins/kms/mains/azurekeyvault -go 1.24.0 +go 1.25.0 require ( github.com/hashicorp/go-kms-wrapping/plugin/v2 v2.0.8 diff --git a/plugins/kms/mains/gcpckms/go.mod b/plugins/kms/mains/gcpckms/go.mod index 9c7b74cf3..d59eb46ca 100644 --- a/plugins/kms/mains/gcpckms/go.mod +++ b/plugins/kms/mains/gcpckms/go.mod @@ -1,6 +1,6 @@ module github.com/hashicorp/boundary/plugins/kms/mains/gcpckms -go 1.24.0 +go 1.25.0 require ( github.com/hashicorp/go-kms-wrapping/plugin/v2 v2.0.8 diff --git a/plugins/kms/mains/ocikms/go.mod b/plugins/kms/mains/ocikms/go.mod index 2fe9daed9..003392acd 100644 --- a/plugins/kms/mains/ocikms/go.mod +++ b/plugins/kms/mains/ocikms/go.mod @@ -1,6 +1,6 @@ module github.com/hashicorp/boundary/plugins/kms/mains/ocikms -go 1.24.0 +go 1.25.0 require ( github.com/hashicorp/go-kms-wrapping/plugin/v2 v2.0.8 diff --git a/plugins/kms/mains/transit/go.mod b/plugins/kms/mains/transit/go.mod index 53c35a7d8..0e2317faa 100644 --- a/plugins/kms/mains/transit/go.mod +++ b/plugins/kms/mains/transit/go.mod @@ -1,6 +1,6 @@ module github.com/hashicorp/boundary/plugins/kms/mains/transit -go 1.24.0 +go 1.25.0 require ( github.com/hashicorp/go-kms-wrapping/plugin/v2 v2.0.8 diff --git a/sdk/go.mod b/sdk/go.mod index 0e81eb859..a8786012d 100644 --- a/sdk/go.mod +++ b/sdk/go.mod @@ -1,6 +1,6 @@ module github.com/hashicorp/boundary/sdk -go 1.24.0 +go 1.25.0 require ( github.com/coder/websocket v1.8.13