Skip to content
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

Update Go version in go.mod to 1.22 (Go 1.22: 2/3) #1439

Merged
merged 2 commits into from
Dec 11, 2024
Merged
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:
namespace: openshift
name: release
tag: golang-1.21
tag: golang-1.22
2 changes: 1 addition & 1 deletion Dockerfiles/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Build the manager binary
ARG GOLANG_VERSION=1.21
ARG GOLANG_VERSION=1.22

################################################################################
FROM registry.access.redhat.com/ubi8/toolbox as manifests
Expand Down
2 changes: 1 addition & 1 deletion Dockerfiles/toolbox.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM registry.fedoraproject.org/fedora-toolbox:38

ARG GOLANG_VERSION=1.21
ARG GOLANG_VERSION=1.22.10
ARG OPERATOR_SDK_VERSION=1.31.0

ENV GOLANG_VERSION=$GOLANG_VERSION \
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ catalog-build: opm ## Build a catalog image.
catalog-push: ## Push a catalog image.
$(MAKE) image-push IMG=$(CATALOG_IMG)

TOOLBOX_GOLANG_VERSION := 1.21
TOOLBOX_GOLANG_VERSION := 1.22.10

# Generate a Toolbox container for locally testing changes easily
.PHONY: toolbox
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ Additionally installing `Authorino operator` & `Service Mesh operator` enhances

#### Pre-requisites

- Go version **go1.21**
- Go version **go1.22**
- operator-sdk version can be updated to **v1.31.1**

#### Download manifests
Expand Down
2 changes: 1 addition & 1 deletion controllers/secretgenerator/secret.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ func generateSecretValue(secret *Secret) error {
switch secret.Type {
case "random":
randomValue := make([]byte, secret.Complexity)
for i := 0; i < secret.Complexity; i++ {
for i := 0; i < secret.Complexity; i++ { //nolint: intrange
num, err := rand.Int(rand.Reader, big.NewInt(int64(len(letterRunes))))
if err != nil {
return err
Expand Down
2 changes: 1 addition & 1 deletion controllers/secretgenerator/secret_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func TestNewSecret(t *testing.T) {
}

for name, tc := range cases {
tc := tc
tc := tc //nolint: copyloopvar
t.Run(name, func(t *testing.T) {
secret, err := secretgenerator.NewSecretFrom(tc.annotations)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/opendatahub-io/opendatahub-operator/v2

go 1.21
go 1.22

require (
github.com/blang/semver/v4 v4.0.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ func TestRenderResourcesWithCacheAction(t *testing.T) {

render.RenderedResourcesTotal.Reset()

for i := int64(0); i < 3; i++ {
for i := int64(0); i < 3; i++ { //nolint: intrange
d := componentApi.Dashboard{}

if i >= 1 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ func TestRenderTemplateWithCache(t *testing.T) {
},
}

for i := int64(0); i < 3; i++ {
for i := int64(0); i < 3; i++ { //nolint: intrange
d := componentApi.Dashboard{
ObjectMeta: metav1.ObjectMeta{
Name: ns,
Expand Down
4 changes: 2 additions & 2 deletions pkg/upgrade/uninstallation.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
}

for _, namespace := range generatedNamespaces.Items {
namespace := namespace
namespace := namespace //nolint: copyloopvar

Check warning on line 51 in pkg/upgrade/uninstallation.go

View check run for this annotation

Codecov / codecov/patch

pkg/upgrade/uninstallation.go#L51

Added line #L51 was not covered by tests
if namespace.Status.Phase == corev1.NamespaceActive {
if err := cli.Delete(ctx, &namespace); err != nil {
return fmt.Errorf("error deleting namespace %v: %w", namespace.Name, err)
Expand Down Expand Up @@ -95,7 +95,7 @@

var multiErr *multierror.Error
for _, dsciInstance := range instanceList.Items {
dsciInstance := dsciInstance
dsciInstance := dsciInstance //nolint: copyloopvar

Check warning on line 98 in pkg/upgrade/uninstallation.go

View check run for this annotation

Codecov / codecov/patch

pkg/upgrade/uninstallation.go#L98

Added line #L98 was not covered by tests
if err := cli.Delete(ctx, &dsciInstance); !k8serr.IsNotFound(err) {
multiErr = multierror.Append(multiErr, err)
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/upgrade/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@
}

for _, item := range list.Items {
item := item
item := item //nolint: copyloopvar

Check warning on line 316 in pkg/upgrade/upgrade.go

View check run for this annotation

Codecov / codecov/patch

pkg/upgrade/upgrade.go#L316

Added line #L316 was not covered by tests
v, ok, err := unstructured.NestedString(item.Object, res.Path...)
if err != nil {
return fmt.Errorf("failed to get field %v for %s %s/%s: %w", res.Path, res.Gvk.Kind, res.Namespace, item.GetName(), err)
Expand Down Expand Up @@ -345,7 +345,7 @@
multiErr = multierror.Append(multiErr, err)
}
items := reflect.ValueOf(resourceType).Elem().FieldByName("Items")
for i := 0; i < items.Len(); i++ {
for i := 0; i < items.Len(); i++ { //nolint: intrange

Check warning on line 348 in pkg/upgrade/upgrade.go

View check run for this annotation

Codecov / codecov/patch

pkg/upgrade/upgrade.go#L348

Added line #L348 was not covered by tests
item := items.Index(i).Addr().Interface().(client.Object) //nolint:errcheck,forcetypeassert
for _, name := range resourceList {
if name == item.GetName() {
Expand Down Expand Up @@ -376,7 +376,7 @@
}

for _, servicemonitor := range servicemonitors.Items {
servicemonitor := servicemonitor
servicemonitor := servicemonitor //nolint: copyloopvar

Check warning on line 379 in pkg/upgrade/upgrade.go

View check run for this annotation

Codecov / codecov/patch

pkg/upgrade/upgrade.go#L379

Added line #L379 was not covered by tests
for _, name := range resourceList {
if name == servicemonitor.Name {
log.Info("Attempting to delete " + servicemonitor.Name + " in namespace " + namespace)
Expand Down
6 changes: 3 additions & 3 deletions tests/e2e/helper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ func getCSV(ctx context.Context, cli client.Client, name string, namespace strin
}

// do not use range Items to avoid pointer to the loop variable
for i := 0; i < len(csvList.Items); i++ {
for i := 0; i < len(csvList.Items); i++ { //nolint: intrange
csv := &csvList.Items[i]
if isMatched(csv, name) {
return csv, nil
Expand Down Expand Up @@ -416,15 +416,15 @@ func ensureServicemeshOperators(t *testing.T, tc *testContext) error { //nolint:
c := make(chan error)

for _, op := range ops {
op := op // to avoid loop variable in the closures
op := op //nolint: copyloopvar
t.Logf("Ensuring %s is installed", op)
go func(op string) {
err := ensureOperator(tc, op, servicemeshNamespace)
c <- err
}(op)
}

for i := 0; i < len(ops); i++ {
for i := 0; i < len(ops); i++ { //nolint: intrange
err := <-c
errors = multierror.Append(errors, err)
}
Expand Down
2 changes: 1 addition & 1 deletion tests/envtestutil/cleaner.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func CreateCleaner(c client.Client, config *rest.Config, timeout, interval time.

func (c *Cleaner) DeleteAll(ctx context.Context, objects ...client.Object) {
for _, obj := range objects {
obj := obj
obj := obj //nolint: copyloopvar
Expect(client.IgnoreNotFound(c.client.Delete(ctx, obj))).Should(Succeed())

if ns, ok := obj.(*corev1.Namespace); ok {
Expand Down
Loading