From 9a0e52ff549bce1850ad660c32306767b9214a56 Mon Sep 17 00:00:00 2001 From: Stefan Bueringer Date: Mon, 5 Feb 2024 13:41:20 +0100 Subject: [PATCH] Bump to Go 1.21 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Stefan Büringer --- .github/workflows/pr-golangci-lint.yaml | 2 +- .golangci.yml | 17 ++++++++++------- Makefile | 2 +- hack/ensure-go.sh | 2 +- pkg/services/govmomi/util_test.go | 3 ++- pkg/services/network/nsxt_provider.go | 2 +- pkg/services/vmoperator/vmopmachine_test.go | 2 +- 7 files changed, 17 insertions(+), 13 deletions(-) diff --git a/.github/workflows/pr-golangci-lint.yaml b/.github/workflows/pr-golangci-lint.yaml index 553f9cba37..3e12f1daaa 100644 --- a/.github/workflows/pr-golangci-lint.yaml +++ b/.github/workflows/pr-golangci-lint.yaml @@ -23,5 +23,5 @@ jobs: - name: golangci-lint uses: golangci/golangci-lint-action@639cd343e1d3b897ff35927a75193d57cfcba299 # tag=v3.6.0 with: - version: v1.53.3 + version: v1.55.2 args: --out-format=colored-line-number diff --git a/.golangci.yml b/.golangci.yml index f3ed128f44..dd0ecdea48 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,3 +1,13 @@ +run: + timeout: 10m + go: "1.21" + skip-files: + - ".*zz_generated.*\\.go" + - "contrib/.*" + - "apis/v1alpha3/.*" + - "apis/v1alpha4/.*" + allow-parallel-runners: true + linters: disable-all: true enable: @@ -40,13 +50,6 @@ linters: linters-settings: gci: local-prefixes: sigs.k8s.io/cluster-api-provider-vsphere -run: - skip-files: - - ".*zz_generated.*\\.go" - - "contrib/.*" - - "apis/v1alpha3/.*" - - "apis/v1alpha4/.*" - timeout: 5m issue: max-same-issues: 0 max-per-linter: 0 diff --git a/Makefile b/Makefile index 2430435a11..5e21efd526 100644 --- a/Makefile +++ b/Makefile @@ -23,7 +23,7 @@ SHELL:=/usr/bin/env bash # # Go. # -GO_VERSION ?= 1.20.12 +GO_VERSION ?= 1.21.5 GO_CONTAINER_IMAGE ?= docker.io/library/golang:$(GO_VERSION) # Use GOPROXY environment variable if set diff --git a/hack/ensure-go.sh b/hack/ensure-go.sh index 08186dd58e..f9c2152de3 100755 --- a/hack/ensure-go.sh +++ b/hack/ensure-go.sh @@ -21,7 +21,7 @@ set -o pipefail # MIN_GO_VERSION is the minimum, supported Go version. # Note: Enforce only the minor version as we can't guarantee that # the images we use in ProwJobs already use the latest patch version. -MIN_GO_VERSION="go${MIN_GO_VERSION:-1.20}" +MIN_GO_VERSION="go${MIN_GO_VERSION:-1.21}" # Ensure the go tool exists and is a viable version. verify_go_version() { diff --git a/pkg/services/govmomi/util_test.go b/pkg/services/govmomi/util_test.go index 33f05b2704..b6964a7797 100644 --- a/pkg/services/govmomi/util_test.go +++ b/pkg/services/govmomi/util_test.go @@ -81,7 +81,8 @@ func Test_ShouldRetryTask(t *testing.T) { {baseTask(types.TaskInfoStateRunning, ""), false}, {baseTask(types.TaskInfoStateSuccess, ""), true}, } - for _, tt := range tests { + for i := range tests { + tt := tests[i] t.Run(fmt.Sprintf("state: %s", tt.task.Info.State), func(t *testing.T) { g = NewWithT(t) reconciled, err := checkAndRetryTask(vmCtx, &tt.task) diff --git a/pkg/services/network/nsxt_provider.go b/pkg/services/network/nsxt_provider.go index 49439da05e..f91d85c9ac 100644 --- a/pkg/services/network/nsxt_provider.go +++ b/pkg/services/network/nsxt_provider.go @@ -117,7 +117,7 @@ func (np *nsxtNetworkProvider) ProvisionClusterNetwork(ctx *vmware.ClusterContex "cluster", clusterKey, "ip", systemNSSnatIP) // WhitelistSourceRanges accept cidrs only - vnet.Spec.WhitelistSourceRanges = systemNSSnatIP + "/32" + vnet.Spec.WhitelistSourceRanges = systemNSSnatIP + "/32" //nolint:goconst } } diff --git a/pkg/services/vmoperator/vmopmachine_test.go b/pkg/services/vmoperator/vmopmachine_test.go index 8b5abae2ea..d92f26d4a5 100644 --- a/pkg/services/vmoperator/vmopmachine_test.go +++ b/pkg/services/vmoperator/vmopmachine_test.go @@ -196,7 +196,7 @@ var _ = Describe("VirtualMachine tests", func() { // Provide valid bootstrap data. By("bootstrap data is created") - secretName := machine.GetName() + "-data" + secretName := machine.GetName() + "-data" //nolint:goconst secret := &corev1.Secret{ ObjectMeta: metav1.ObjectMeta{ Name: secretName,