From 805a22daa7b99c607ed1ffbbfb633a3bb9c3c891 Mon Sep 17 00:00:00 2001 From: Martin Schuppert Date: Wed, 16 Apr 2025 15:44:09 +0200 Subject: [PATCH 1/2] bump to golang 1.22 * bump in go.mod (base and api) * bump go-toolset in Dockerfile * bump in github jobs ('.github/workflows') * Bump the golangci-lint version in the .pre-commit-config.yaml to v1.63.4 * Bump build_root_image in .ci-operator.yaml to ci-build-root-golang-1.22-sdk-1.31 Jira: OSPRH-12935 Signed-off-by: Martin Schuppert --- .ci-operator.yaml | 2 +- .github/workflows/build-neutron-operator.yaml | 2 +- .pre-commit-config.yaml | 2 +- Dockerfile | 2 +- Makefile | 5 +++-- api/go.mod | 2 +- go.mod | 2 +- 7 files changed, 9 insertions(+), 8 deletions(-) diff --git a/.ci-operator.yaml b/.ci-operator.yaml index 810dbb511..9b97140cd 100644 --- a/.ci-operator.yaml +++ b/.ci-operator.yaml @@ -1,4 +1,4 @@ build_root_image: name: tools namespace: openstack-k8s-operators - tag: ci-build-root-golang-1.21-sdk-1.31 + tag: ci-build-root-golang-1.22-sdk-1.31 diff --git a/.github/workflows/build-neutron-operator.yaml b/.github/workflows/build-neutron-operator.yaml index 03bce9842..d0c9c7671 100644 --- a/.github/workflows/build-neutron-operator.yaml +++ b/.github/workflows/build-neutron-operator.yaml @@ -15,7 +15,7 @@ jobs: uses: openstack-k8s-operators/openstack-k8s-operators-ci/.github/workflows/reusable-build-operator.yaml@main with: operator_name: neutron - go_version: 1.21.x + go_version: 1.22.x operator_sdk_version: 1.31.0 secrets: IMAGENAMESPACE: ${{ secrets.IMAGENAMESPACE }} diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 096904292..6fae598f1 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -79,7 +79,7 @@ repos: # E012: here doc didn't end before EOF - repo: https://github.com/golangci/golangci-lint - rev: v1.59.1 + rev: v1.63.4 hooks: - id: golangci-lint-full args: ["-v"] diff --git a/Dockerfile b/Dockerfile index 4d45e30f0..13f174d22 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ # Build the manager binary -ARG GOLANG_BUILDER=registry.access.redhat.com/ubi9/go-toolset:1.21 +ARG GOLANG_BUILDER=registry.access.redhat.com/ubi9/go-toolset:1.22 ARG OPERATOR_BASE_IMAGE=registry.access.redhat.com/ubi9/ubi-minimal:latest FROM $GOLANG_BUILDER AS builder diff --git a/Makefile b/Makefile index 981809e2c..b1fc4d456 100644 --- a/Makefile +++ b/Makefile @@ -56,7 +56,7 @@ IMG ?= quay.io/openstack-k8s-operators/neutron-operator:latest ENVTEST_K8S_VERSION = 1.29 # Set minimum Go version -GOTOOLCHAIN_VERSION ?= go1.21.0 +GOTOOLCHAIN_VERSION ?= go1.22.0 # Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set) ifeq (,$(shell go env GOBIN)) @@ -119,9 +119,10 @@ tidy: ## Run go mod tidy on every mod file in the repo go mod tidy cd ./api && go mod tidy +GOLANGCI_LINT_VERSION ?= v1.63.4 .PHONY: golangci-lint golangci-lint: - test -s $(LOCALBIN)/golangci-lint || curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.59.1 + test -s $(LOCALBIN)/golangci-lint || curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s $(GOLANGCI_LINT_VERSION) $(LOCALBIN)/golangci-lint run --fix PROCS?=$(shell expr $(shell nproc --ignore 2) / 2) diff --git a/api/go.mod b/api/go.mod index 802589125..b2b17e991 100644 --- a/api/go.mod +++ b/api/go.mod @@ -1,6 +1,6 @@ module github.com/openstack-k8s-operators/neutron-operator/api -go 1.21 +go 1.22 require ( github.com/openstack-k8s-operators/infra-operator/apis v0.6.1-0.20250416140801-46d35b7999b2 diff --git a/go.mod b/go.mod index 3d1b8fa18..45dbe8949 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/openstack-k8s-operators/neutron-operator -go 1.21 +go 1.22 require ( github.com/go-logr/logr v1.4.2 From e96a7dd1e52d2a0da03891f40171d478682cfe01 Mon Sep 17 00:00:00 2001 From: Martin Schuppert Date: Wed, 16 Apr 2025 15:46:07 +0200 Subject: [PATCH 2/2] fix golangci reported issues Signed-off-by: Martin Schuppert --- controllers/neutronapi_controller.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/controllers/neutronapi_controller.go b/controllers/neutronapi_controller.go index 98b1b1166..afc88951b 100644 --- a/controllers/neutronapi_controller.go +++ b/controllers/neutronapi_controller.go @@ -487,7 +487,7 @@ func (r *NeutronAPIReconciler) reconcileInit( condition.TLSInputReadyCondition, condition.RequestedReason, condition.SeverityInfo, - fmt.Sprintf(condition.TLSInputReadyWaitingMessage, instance.Spec.TLS.CaBundleSecretName))) + condition.TLSInputReadyWaitingMessage, instance.Spec.TLS.CaBundleSecretName)) return ctrl.Result{}, nil } instance.Status.Conditions.Set(condition.FalseCondition( @@ -512,7 +512,7 @@ func (r *NeutronAPIReconciler) reconcileInit( condition.TLSInputReadyCondition, condition.RequestedReason, condition.SeverityInfo, - fmt.Sprintf(condition.TLSInputReadyWaitingMessage, err.Error()))) + condition.TLSInputReadyWaitingMessage, err.Error())) return ctrl.Result{}, nil } instance.Status.Conditions.Set(condition.FalseCondition( @@ -537,7 +537,7 @@ func (r *NeutronAPIReconciler) reconcileInit( condition.TLSInputReadyCondition, condition.RequestedReason, condition.SeverityInfo, - fmt.Sprintf(condition.TLSInputReadyWaitingMessage, err.Error()))) + condition.TLSInputReadyWaitingMessage, err.Error())) return ctrl.Result{}, nil } instance.Status.Conditions.Set(condition.FalseCondition(