Skip to content
This repository was archived by the owner on Jun 2, 2025. It is now read-only.

Commit d284803

Browse files
authored
Upgrade to Go 1.22 (#415)
* Upgrade to Go 1.22 Signed-off-by: Dale Haiducek <[email protected]> * Fix Go 1.22 linting issues Signed-off-by: Dale Haiducek <[email protected]> --------- Signed-off-by: Dale Haiducek <[email protected]>
1 parent 5e1eee9 commit d284803

File tree

23 files changed

+23
-34
lines changed

23 files changed

+23
-34
lines changed

.github/workflows/go-postsubmit.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88

99
env:
1010
# Common versions
11-
GO_VERSION: '1.21'
11+
GO_VERSION: '1.22'
1212
GO_REQUIRED_MIN_VERSION: ''
1313
GOPATH: '/home/runner/work/multicloud-operators-subscription/multicloud-operators-subscription/go'
1414
defaults:

.github/workflows/go-presubmit.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88

99
env:
1010
# Common versions
11-
GO_VERSION: '1.21'
11+
GO_VERSION: '1.22'
1212
GO_REQUIRED_MIN_VERSION: ''
1313
GOPATH: '/home/runner/work/multicloud-operators-subscription/multicloud-operators-subscription/go'
1414
defaults:

.github/workflows/go-release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66
- 'v*.*.*'
77
env:
88
# Common versions
9-
GO_VERSION: '1.21'
9+
GO_VERSION: '1.22'
1010
GO_REQUIRED_MIN_VERSION: ''
1111
GOPATH: '/home/runner/work/multicloud-operators-subscription/multicloud-operators-subscription/go'
1212
GITHUB_REF: ${{ github.ref }}

build/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM registry.ci.openshift.org/stolostron/builder:go1.21-linux AS plugin-builder
1+
FROM registry.ci.openshift.org/stolostron/builder:go1.22-linux AS plugin-builder
22
ENV POLICY_GENERATOR_TAG=v1.16.0
33

44
WORKDIR /go/src/github.com/open-cluster-management/multicloud-operators-subscription

build/Dockerfile.prow

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM registry.ci.openshift.org/stolostron/builder:go1.21-linux AS builder
1+
FROM registry.ci.openshift.org/stolostron/builder:go1.22-linux AS builder
22
ENV POLICY_GENERATOR_TAG=v1.16.0
33

44
WORKDIR /go/src/github.com/stolostron/multicluster-operators-subscription

build/Dockerfile.rhtap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM brew.registry.redhat.io/rh-osbs/openshift-golang-builder:rhel_8_1.21 AS plugin-builder
1+
FROM brew.registry.redhat.io/rh-osbs/openshift-golang-builder:rhel_9_1.22 AS plugin-builder
22
ENV POLICY_GENERATOR_TAG=v1.16.0
33

44
WORKDIR /go/src/github.com/open-cluster-management/multicloud-operators-subscription

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module open-cluster-management.io/multicloud-operators-subscription
22

3-
go 1.21
3+
go 1.22.10
44

55
require (
66
github.com/Masterminds/semver/v3 v3.2.1

pkg/controller/appsubsummary/appsubsummary_controller.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -286,9 +286,6 @@ func (r *ReconcileAppSubSummary) cleanManagedClusterViewPerApp(appsubName, appsu
286286
continue
287287
}
288288

289-
// reassign the iteration variable inside the loop to avoid the sonarcloud warning - "Implicit memory aliasing in for loop"
290-
managedClusterView := managedClusterView
291-
292289
if err = r.Delete(context.TODO(), &managedClusterView); err != nil {
293290
klog.Errorf("Error deleting managedClusterView :%v/%v, err:%v", managedClusterView.Namespace, managedClusterView.Name, err)
294291
}

pkg/controller/mcmhub/ansiblejob.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ func findLastAnsibleJob(clt client.Client, subIns *subv1.Subscription, hookType
7373

7474
klog.Infof("total prehook/posthook ansible jobs num: %v", len(ansibleJobList.Items))
7575

76-
for i := 0; i < len(ansibleJobList.Items); i++ {
77-
hostingAppsub, ok := ansibleJobList.Items[i].Annotations[subv1.AnnotationHosting]
76+
for _, ansibleJob := range ansibleJobList.Items {
77+
hostingAppsub, ok := ansibleJob.Annotations[subv1.AnnotationHosting]
7878

7979
if !ok {
8080
continue
@@ -84,7 +84,7 @@ func findLastAnsibleJob(clt client.Client, subIns *subv1.Subscription, hookType
8484
continue
8585
}
8686

87-
curHookType, ok := ansibleJobList.Items[i].Annotations[subv1.AnnotationHookType]
87+
curHookType, ok := ansibleJob.Annotations[subv1.AnnotationHookType]
8888

8989
if !ok {
9090
continue
@@ -94,7 +94,7 @@ func findLastAnsibleJob(clt client.Client, subIns *subv1.Subscription, hookType
9494
continue
9595
}
9696

97-
hookTpl, ok := ansibleJobList.Items[i].Annotations[subv1.AnnotationHookTemplate]
97+
hookTpl, ok := ansibleJob.Annotations[subv1.AnnotationHookTemplate]
9898

9999
if !ok {
100100
continue
@@ -104,7 +104,7 @@ func findLastAnsibleJob(clt client.Client, subIns *subv1.Subscription, hookType
104104
continue
105105
}
106106

107-
lastAnsibleJob := ansibleJobList.Items[i].DeepCopy()
107+
lastAnsibleJob := ansibleJob.DeepCopy()
108108

109109
klog.Infof("last ansible job: %v/%v, hookType: %v, hookTemplate: %v", lastAnsibleJob.Namespace, lastAnsibleJob.Name, hookType, jobKey.String())
110110

pkg/controller/mcmhub/gitrepo_sync.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,7 @@ func (r *ReconcileSubscription) subscribeKustomizations(sub *appv1.Subscription,
263263
for _, kustomizeDir := range kustomizeDirs {
264264
klog.Info("Applying kustomization ", kustomizeDir)
265265

266+
//nolint:copyloopvar
266267
relativePath := kustomizeDir
267268

268269
if len(strings.SplitAfter(kustomizeDir, baseDir+"/")) > 1 {

0 commit comments

Comments
 (0)