diff --git a/.github/workflows/pr-golangci-lint.yaml b/.github/workflows/pr-golangci-lint.yaml index 21dbcffc9b..0f4213ac36 100644 --- a/.github/workflows/pr-golangci-lint.yaml +++ b/.github/workflows/pr-golangci-lint.yaml @@ -30,6 +30,6 @@ jobs: - name: golangci-lint uses: golangci/golangci-lint-action@55c2c1448f86e01eaae002a5a3a9624417608d84 # tag=v6.5.2 with: - version: v1.60.2 + version: v1.64.3 args: --out-format=colored-line-number working-directory: ${{matrix.working-directory}} diff --git a/.golangci.yml b/.golangci.yml index c742366a1a..a056cdeb43 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -16,7 +16,6 @@ linters: - durationcheck - errcheck - errchkjson - - exportloopref - gci - ginkgolinter - goconst diff --git a/Makefile b/Makefile index b3d9e1c889..41df5d4a07 100644 --- a/Makefile +++ b/Makefile @@ -23,7 +23,7 @@ SHELL:=/usr/bin/env bash # # Go. # -GO_VERSION ?= 1.23.12 +GO_VERSION ?= 1.24.10 GO_DIRECTIVE_VERSION ?= 1.23.0 GO_CONTAINER_IMAGE ?= docker.io/library/golang:$(GO_VERSION) diff --git a/controllers/vspherecluster_reconciler.go b/controllers/vspherecluster_reconciler.go index bf7418de00..0c813aa1a9 100644 --- a/controllers/vspherecluster_reconciler.go +++ b/controllers/vspherecluster_reconciler.go @@ -567,10 +567,7 @@ func (r *clusterReconciler) controlPlaneMachineToCluster(ctx context.Context, o } return []ctrl.Request{{ - NamespacedName: types.NamespacedName{ - Namespace: vsphereClusterKey.Namespace, - Name: vsphereClusterKey.Name, - }, + NamespacedName: vsphereClusterKey, }} } diff --git a/controllers/vspherecluster_reconciler_test.go b/controllers/vspherecluster_reconciler_test.go index 8a1f37582f..56334119bd 100644 --- a/controllers/vspherecluster_reconciler_test.go +++ b/controllers/vspherecluster_reconciler_test.go @@ -119,7 +119,7 @@ var _ = Describe("VIM based VSphere ClusterReconciler", func() { // Make sure the VSphereCluster exists. Eventually(func() error { return testEnv.Get(ctx, key, instance) - }, timeout).Should(BeNil()) + }, timeout).Should(Succeed()) By("setting the OwnerRef on the VSphereCluster") Eventually(func() error { @@ -132,7 +132,7 @@ var _ = Describe("VIM based VSphere ClusterReconciler", func() { UID: "blah", }) return ph.Patch(ctx, instance, patch.WithStatusObservedGeneration{}) - }, timeout).Should(BeNil()) + }, timeout).Should(Succeed()) Eventually(func() bool { if err := testEnv.Get(ctx, key, instance); err != nil { @@ -432,7 +432,7 @@ var _ = Describe("VIM based VSphere ClusterReconciler", func() { Expect(err).ShouldNot(HaveOccurred()) zoneOne.Status.Ready = ptr.To(true) return ph.Patch(ctx, zoneOne, patch.WithStatusObservedGeneration{}) - }, timeout).Should(BeNil()) + }, timeout).Should(Succeed()) Eventually(func() bool { if err := testEnv.Get(ctx, key, instance); err != nil { @@ -451,7 +451,7 @@ var _ = Describe("VIM based VSphere ClusterReconciler", func() { Expect(err).ShouldNot(HaveOccurred()) zoneOne.Status.Ready = ptr.To(true) return ph.Patch(ctx, zoneOne, patch.WithStatusObservedGeneration{}) - }, timeout).Should(BeNil()) + }, timeout).Should(Succeed()) }) It("should remove the FailureDomainsAvailable condition from the cluster", func() { diff --git a/controllers/vspheremachine_controller_test.go b/controllers/vspheremachine_controller_test.go index cd167e76cf..7f92bcae91 100644 --- a/controllers/vspheremachine_controller_test.go +++ b/controllers/vspheremachine_controller_test.go @@ -167,7 +167,7 @@ var _ = Describe("VsphereMachineReconciler", func() { Expect(err).ShouldNot(HaveOccurred()) capiCluster.Status.InfrastructureReady = true return ph.Patch(ctx, capiCluster, patch.WithStatusObservedGeneration{}) - }, timeout).Should(BeNil()) + }, timeout).Should(Succeed()) Eventually(func() bool { return isPresentAndFalseWithReason(infraMachine, infrav1.VMProvisionedCondition, infrav1.WaitingForClusterInfrastructureReason) @@ -200,7 +200,7 @@ var _ = Describe("VsphereMachineReconciler", func() { DataSecretName: ptr.To("some-secret"), } return ph.Patch(ctx, capiMachine, patch.WithStatusObservedGeneration{}) - }, timeout).Should(BeNil()) + }, timeout).Should(Succeed()) Eventually(func() int { vms := infrav1.VSphereVMList{} diff --git a/go.mod b/go.mod index 2716133a6a..5eac1d051f 100644 --- a/go.mod +++ b/go.mod @@ -2,6 +2,8 @@ module sigs.k8s.io/cluster-api-provider-vsphere go 1.23.0 +godebug default=go1.23 + replace sigs.k8s.io/cluster-api => sigs.k8s.io/cluster-api v1.10.1 replace github.com/vmware-tanzu/vm-operator/pkg/constants/testlabels => github.com/vmware-tanzu/vm-operator/pkg/constants/testlabels v0.0.0-20240404200847-de75746a9505 diff --git a/packaging/go.mod b/packaging/go.mod index 0072b17f70..802c92e2cc 100644 --- a/packaging/go.mod +++ b/packaging/go.mod @@ -2,6 +2,8 @@ module sigs.k8s.io/cluster-api-provider-vsphere/packaging go 1.23.0 +godebug default=go1.23 + replace sigs.k8s.io/cluster-api => sigs.k8s.io/cluster-api v1.10.1 replace sigs.k8s.io/cluster-api-provider-vsphere => ../ diff --git a/pkg/services/govmomi/ipam/status_test.go b/pkg/services/govmomi/ipam/status_test.go index 860ca20b9b..28e3777fa9 100644 --- a/pkg/services/govmomi/ipam/status_test.go +++ b/pkg/services/govmomi/ipam/status_test.go @@ -218,7 +218,7 @@ func Test_buildIPAMDeviceConfigs(t *testing.T) { // The IPAddressClaimed condition should not be added config, err := buildIPAMDeviceConfigs(ctx, vmCtx, networkStatus) g.Expect(err).NotTo(gomega.HaveOccurred()) - g.Expect(config[0].IPAMAddresses).To(gomega.HaveLen(0)) + g.Expect(config[0].IPAMAddresses).To(gomega.BeEmpty()) }) } @@ -435,7 +435,7 @@ func Test_BuildState(t *testing.T) { state, err := BuildState(ctx, vmCtx, networkStatus) g.Expect(err).NotTo(gomega.HaveOccurred()) - g.Expect(state).To(gomega.HaveLen(0)) + g.Expect(state).To(gomega.BeEmpty()) }) t.Run("when one device has no pool and is DHCP true, and one device has a IPAddressPool", func(_ *testing.T) { diff --git a/test/e2e/multivc_test.go b/test/e2e/multivc_test.go index b4c0840aa9..ecea12889e 100644 --- a/test/e2e/multivc_test.go +++ b/test/e2e/multivc_test.go @@ -138,11 +138,11 @@ func VerifyMultiVC(ctx context.Context, input MultiVCenterSpecInput) { Consistently(func() error { kubeSystem := &corev1.Namespace{} return input.Global.BootstrapClusterProxy.GetClient().Get(ctx, client.ObjectKey{Name: "kube-system"}, kubeSystem) - }, "5s", "100ms").Should(BeNil(), "Failed to assert bootstrap API server stability") + }, "5s", "100ms").Should(Succeed(), "Failed to assert bootstrap API server stability") Consistently(func() error { kubeSystem := &corev1.Namespace{} return mgmtClusterProxy.GetClient().Get(ctx, client.ObjectKey{Name: "kube-system"}, kubeSystem) - }, "5s", "100ms").Should(BeNil(), "Failed to assert self-hosted API server stability") + }, "5s", "100ms").Should(Succeed(), "Failed to assert self-hosted API server stability") // Get the machines of the workloadCluster before it is moved to become self-hosted to make sure that the move did not trigger // any unexpected rollouts. diff --git a/test/go.mod b/test/go.mod index 89ddcae39d..d78ed7e19f 100644 --- a/test/go.mod +++ b/test/go.mod @@ -2,6 +2,8 @@ module sigs.k8s.io/cluster-api-provider-vsphere/test go 1.23.0 +godebug default=go1.23 + replace sigs.k8s.io/cluster-api => sigs.k8s.io/cluster-api v1.10.1 replace sigs.k8s.io/cluster-api/test => sigs.k8s.io/cluster-api/test v1.10.1