Skip to content

[golang] bump to golang 1.22 #340

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .ci-operator.yaml
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion .github/workflows/build-swift-operator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
uses: openstack-k8s-operators/openstack-k8s-operators-ci/.github/workflows/reusable-build-operator.yaml@main
with:
operator_name: swift
go_version: 1.21.x
go_version: 1.22.x
operator_sdk_version: 1.31.0
secrets:
IMAGENAMESPACE: ${{ secrets.IMAGENAMESPACE }}
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ repos:
- id: go-mod-tidy

- repo: https://github.com/golangci/golangci-lint
rev: v1.59.1
rev: v1.63.4
hooks:
- id: golangci-lint-full
args: ["-v"]
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
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

# Build the manager binary
Expand Down
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ IMG ?= $(DEFAULT_IMG)
ENVTEST_K8S_VERSION = 1.29.0

# Set minimum Go version
GOTOOLCHAIN_VERSION ?= go1.21.0
GOTOOLCHAIN_VERSION ?= go1.22.0

GINKGO ?= $(LOCALBIN)/ginkgo

Expand Down Expand Up @@ -121,9 +121,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 --verbose

PROCS?=$(shell expr $(shell nproc --ignore 2) / 2)
Expand Down
2 changes: 1 addition & 1 deletion api/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/openstack-k8s-operators/swift-operator/api

go 1.21
go 1.22

require (
github.com/onsi/ginkgo/v2 v2.20.1
Expand Down
4 changes: 2 additions & 2 deletions controllers/swiftproxy_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ func (r *SwiftProxyReconciler) Reconcile(ctx context.Context, req ctrl.Request)
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(
Expand All @@ -236,7 +236,7 @@ func (r *SwiftProxyReconciler) Reconcile(ctx context.Context, req ctrl.Request)
condition.TLSInputReadyCondition,
condition.RequestedReason,
condition.SeverityInfo,
fmt.Sprintf(condition.TLSInputReadyWaitingMessage, err.Error())))
"%s", fmt.Sprintf(condition.TLSInputReadyWaitingMessage, err.Error())))
return ctrl.Result{}, nil
}
instance.Status.Conditions.Set(condition.FalseCondition(
Expand Down
2 changes: 1 addition & 1 deletion controllers/swiftring_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ func (r *SwiftRingReconciler) reconcileNormal(ctx context.Context, instance *swi
condition.ReadyCondition,
condition.ErrorReason,
condition.SeverityWarning,
err.Error()))
"%s", err.Error()))
return ctrl.Result{}, err
}

Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/openstack-k8s-operators/swift-operator

go 1.21
go 1.22

require (
github.com/go-logr/logr v1.4.2
Expand All @@ -15,7 +15,6 @@ require (
github.com/openstack-k8s-operators/lib-common/modules/common v0.6.1-0.20250419062702-0acec6a591c8
github.com/openstack-k8s-operators/lib-common/modules/openstack v0.6.1-0.20250419062702-0acec6a591c8
github.com/openstack-k8s-operators/swift-operator/api v0.3.1-0.20240523121736-379011b2cfac
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56
k8s.io/api v0.29.15
k8s.io/apimachinery v0.29.15
k8s.io/client-go v0.29.15
Expand Down Expand Up @@ -61,6 +60,7 @@ require (
github.com/spf13/pflag v1.0.5 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.27.0 // indirect
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect
golang.org/x/net v0.28.0 // indirect
golang.org/x/oauth2 v0.18.0 // indirect
golang.org/x/sys v0.23.0 // indirect
Expand Down
3 changes: 1 addition & 2 deletions pkg/swiftring/funcs.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,10 @@ import (
"encoding/json"
"fmt"
"path/filepath"
"slices"
"sort"
"strings"

"golang.org/x/exp/slices"

corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/types"
Expand Down