diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index 8c796c8a..b580db80 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -7,16 +7,21 @@ jobs: name: lint runs-on: ubuntu-latest strategy: + fail-fast: false matrix: working-directory: - "" steps: - - uses: actions/checkout@v4 - - uses: actions/setup-go@v5 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # tag=v4.2.2 + - name: Calculate go version + id: vars + run: echo "go_version=$(make go-version)" >> $GITHUB_OUTPUT + - name: Set up Go + uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # tag=v5.1.0 with: - go-version: '1.22' + go-version: ${{ steps.vars.outputs.go_version }} - name: golangci-lint - uses: golangci/golangci-lint-action@v6 + uses: golangci/golangci-lint-action@971e284b6050e8a5849b72094c50ab08da042db8 # tag=v6.1.1 with: - version: v1.57.2 - args: --timeout 15m + version: v1.60.2 + args: --timeout 15m diff --git a/.github/workflows/pr-dependabot.yaml b/.github/workflows/pr-dependabot.yaml index 7af9f19c..7e487be1 100644 --- a/.github/workflows/pr-dependabot.yaml +++ b/.github/workflows/pr-dependabot.yaml @@ -27,7 +27,7 @@ jobs: uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # tag=v5.0.0 with: # go-version: ${{ steps.vars.outputs.go_version }} // TODO: we have to use go version consistent with test infra jobs - go-version: '1.22' + go-version: '1.23' - uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # tag=v4.2.0 name: Restore go cache with: diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 04fab8bd..6496f721 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -22,7 +22,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v5 with: - go-version: '1.22' + go-version: '1.23' - name: Run GoReleaser uses: goreleaser/goreleaser-action@v6 with: diff --git a/.golangci.yaml b/.golangci.yaml index a992e045..0f6d8d9f 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -1,6 +1,6 @@ run: timeout: 5m - go: "1.22" + go: "1.23" skip-files: - "zz_generated.*\\.go$" allow-parallel-runners: true diff --git a/Makefile b/Makefile index 98dc1ad0..09e83a51 100644 --- a/Makefile +++ b/Makefile @@ -23,7 +23,7 @@ ROOT:=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST)))) .DEFAULT_GOAL:=help -GO_VERSION ?= 1.22.11 +GO_VERSION ?= 1.23.0 GO_CONTAINER_IMAGE ?= docker.io/library/golang:$(GO_VERSION) # Use GOPROXY environment variable if set @@ -70,7 +70,7 @@ CONTROLLER_GEN_VER := v0.16.1 CONTROLLER_GEN_BIN := controller-gen CONTROLLER_GEN := $(TOOLS_BIN_DIR)/$(CONTROLLER_GEN_BIN)-$(CONTROLLER_GEN_VER) -GOLANGCI_LINT_VER := v1.57.2 +GOLANGCI_LINT_VER := v1.60.2 GOLANGCI_LINT_BIN := golangci-lint GOLANGCI_LINT := $(TOOLS_BIN_DIR)/$(GOLANGCI_LINT_BIN)-$(GOLANGCI_LINT_VER) diff --git a/Tiltfile b/Tiltfile index c8f7c902..06d26bda 100644 --- a/Tiltfile +++ b/Tiltfile @@ -20,7 +20,7 @@ def build_image(): "SECURITY_CONTACTS" ], build_args = { - "builder_image": "docker.io/library/golang:1.22.11", + "builder_image": "docker.io/library/golang:1.23.0", } ) diff --git a/cmd/plugin/cmd/upgrade_plan.go b/cmd/plugin/cmd/upgrade_plan.go index ec0b3eac..9b71afbf 100644 --- a/cmd/plugin/cmd/upgrade_plan.go +++ b/cmd/plugin/cmd/upgrade_plan.go @@ -178,10 +178,14 @@ func runUpgradePlan() error { w := tabwriter.NewWriter(os.Stdout, 10, 4, 3, ' ', 0) - fmt.Fprintln(w, "NAME\tNAMESPACE\tTYPE\tCURRENT VERSION\tNEXT VERSION") + if _, err := fmt.Fprintln(w, "NAME\tNAMESPACE\tTYPE\tCURRENT VERSION\tNEXT VERSION"); err != nil { + return err + } for _, upgradeItem := range upgradePlan.Providers { - fmt.Fprintf(w, "%s\t%s\t%s\t%s\t%s\n", upgradeItem.Name, upgradeItem.Namespace, upgradeItem.Type, upgradeItem.CurrentVersion, prettifyTargetVersion(upgradeItem.NextVersion)) + if _, err := fmt.Fprintf(w, "%s\t%s\t%s\t%s\t%s\n", upgradeItem.Name, upgradeItem.Namespace, upgradeItem.Type, upgradeItem.CurrentVersion, prettifyTargetVersion(upgradeItem.NextVersion)); err != nil { + return err + } if upgradeItem.NextVersion != "" { upgradeAvailable = true diff --git a/go.mod b/go.mod index 6c66b594..08c060e9 100644 --- a/go.mod +++ b/go.mod @@ -1,8 +1,6 @@ module sigs.k8s.io/cluster-api-operator -go 1.22.0 - -toolchain go1.22.11 +go 1.23.0 require ( github.com/MakeNowJust/heredoc v1.0.0 diff --git a/hack/chart-update/go.mod b/hack/chart-update/go.mod index 119debd4..cfe3cec3 100644 --- a/hack/chart-update/go.mod +++ b/hack/chart-update/go.mod @@ -1,8 +1,6 @@ module sigs.k8s.io/cluster-api-operator/hack/chart-update -go 1.22.0 - -toolchain go1.22.11 +go 1.23.0 require ( github.com/google/go-github/v50 v50.2.0 diff --git a/hack/ensure-go.sh b/hack/ensure-go.sh index 1009c39f..020b7434 100755 --- a/hack/ensure-go.sh +++ b/hack/ensure-go.sh @@ -31,7 +31,7 @@ EOF local go_version IFS=" " read -ra go_version <<< "$(go version)" local minimum_go_version - minimum_go_version=go1.22.0 + minimum_go_version=go1.23.0 if [[ "${minimum_go_version}" != $(echo -e "${minimum_go_version}\n${go_version[2]}" | sort -s -t. -k 1,1 -k 2,2n -k 3,3n | head -n1) && "${go_version[2]}" != "devel" ]]; then cat < sigs.k8s.io/cluster-api v1.9.4 diff --git a/internal/controller/component_customizer.go b/internal/controller/component_customizer.go index 5165450b..255b374e 100644 --- a/internal/controller/component_customizer.go +++ b/internal/controller/component_customizer.go @@ -145,7 +145,8 @@ func customizeDeployment(dSpec *operatorv1.DeploymentSpec, mSpec *operatorv1.Man func customizeDeploymentSpec(dSpec operatorv1.DeploymentSpec, d *appsv1.Deployment) { if dSpec.Replicas != nil { - d.Spec.Replicas = ptr.To(int32(*dSpec.Replicas)) + replicas := int32(*dSpec.Replicas) //nolint:gosec + d.Spec.Replicas = ptr.To(replicas) } if dSpec.Affinity != nil { diff --git a/internal/controller/genericprovider_controller.go b/internal/controller/genericprovider_controller.go index 65636fe8..478bbc96 100644 --- a/internal/controller/genericprovider_controller.go +++ b/internal/controller/genericprovider_controller.go @@ -182,7 +182,7 @@ func (r *GenericProviderReconciler) reconcile(ctx context.Context, provider gene if err != nil { var pe *PhaseError if errors.As(err, &pe) { - conditions.Set(provider, conditions.FalseCondition(pe.Type, pe.Reason, pe.Severity, err.Error())) + conditions.Set(provider, conditions.FalseCondition(pe.Type, pe.Reason, pe.Severity, "%s", err.Error())) } } @@ -214,7 +214,7 @@ func (r *GenericProviderReconciler) reconcileDelete(ctx context.Context, provide if err != nil { var pe *PhaseError if errors.As(err, &pe) { - conditions.Set(provider, conditions.FalseCondition(pe.Type, pe.Reason, pe.Severity, err.Error())) + conditions.Set(provider, conditions.FalseCondition(pe.Type, pe.Reason, pe.Severity, "%s", err.Error())) } } diff --git a/internal/controller/oci_source.go b/internal/controller/oci_source.go index 0dfaecb0..608ce76e 100644 --- a/internal/controller/oci_source.go +++ b/internal/controller/oci_source.go @@ -125,7 +125,7 @@ func (m mapStore) Exists(ctx context.Context, target ocispec.Descriptor) (bool, // Fetch implements oras.Target. func (m mapStore) Fetch(ctx context.Context, target ocispec.Descriptor) (io.ReadCloser, error) { - return nil, nil + return nil, nil //nolint:nilnil } // Push implements oras.Target. diff --git a/internal/controller/preflight_checks.go b/internal/controller/preflight_checks.go index ba345647..ee482584 100644 --- a/internal/controller/preflight_checks.go +++ b/internal/controller/preflight_checks.go @@ -73,7 +73,7 @@ func preflightChecks(ctx context.Context, c client.Client, provider genericprovi operatorv1.PreflightCheckCondition, operatorv1.IncorrectCoreProviderNameReason, clusterv1.ConditionSeverityError, - fmt.Sprintf(incorrectCoreProviderNameMessage, provider.GetName(), configclient.ClusterAPIProviderName), + "%s", fmt.Sprintf(incorrectCoreProviderNameMessage, provider.GetName(), configclient.ClusterAPIProviderName), )) return ctrl.Result{}, fmt.Errorf("incorrect CoreProvider name: %s, it should be %s", provider.GetName(), configclient.ClusterAPIProviderName) @@ -129,7 +129,7 @@ func preflightChecks(ctx context.Context, c client.Client, provider genericprovi operatorv1.PreflightCheckCondition, operatorv1.InvalidGithubTokenReason, clusterv1.ConditionSeverityError, - invalidGithubTokenMessage, + "%s", invalidGithubTokenMessage, )) return ctrl.Result{}, fmt.Errorf("failed to validate provided github token: %w", err) @@ -187,7 +187,7 @@ func preflightChecks(ctx context.Context, c client.Client, provider genericprovi operatorv1.PreflightCheckCondition, operatorv1.WaitingForCoreProviderReadyReason, clusterv1.ConditionSeverityInfo, - waitingForCoreProviderReadyMessage, + "%s", waitingForCoreProviderReadyMessage, )) return ctrl.Result{RequeueAfter: preflightFailedRequeueAfter}, nil @@ -213,7 +213,7 @@ func checkProviderVersion(ctx context.Context, providerVersion string, provider operatorv1.PreflightCheckCondition, operatorv1.IncorrectVersionFormatReason, clusterv1.ConditionSeverityError, - err.Error(), + "%s", err.Error(), )) return fmt.Errorf("version contains invalid value for provider %q", provider.GetName()) @@ -231,7 +231,7 @@ func checkProviderVersion(ctx context.Context, providerVersion string, provider operatorv1.PreflightCheckCondition, operatorv1.UnsupportedProviderDowngradeReason, clusterv1.ConditionSeverityError, - fmt.Sprintf(unsupportedProviderDowngradeMessage, provider.GetName()), + "%s", unsupportedProviderDowngradeMessage, )) return fmt.Errorf("downgrade is not supported for provider %q", provider.GetName()) diff --git a/netlify.toml b/netlify.toml index f82f4750..0bcd6db8 100644 --- a/netlify.toml +++ b/netlify.toml @@ -4,7 +4,7 @@ publish = "docs/book/book" [build.environment] - GO_VERSION = "1.22.11" + GO_VERSION = "1.23.0" # Standard Netlify redirects [[redirects]] diff --git a/test/go.mod b/test/go.mod index c9c160be..a4f8d1bf 100644 --- a/test/go.mod +++ b/test/go.mod @@ -1,8 +1,6 @@ module sigs.k8s.io/cluster-api-operator/test -go 1.22.0 - -toolchain go1.22.11 +go 1.23.0 replace sigs.k8s.io/cluster-api-operator => ../