Skip to content

Commit 4d9f854

Browse files
authored
🌱 Bump golang to 1.23 (#473)
* Bump golang to 1.23 Signed-off-by: zhujian <[email protected]> * Fix lint errors Signed-off-by: zhujian <[email protected]> --------- Signed-off-by: zhujian <[email protected]>
1 parent b50ec8d commit 4d9f854

File tree

7 files changed

+21
-20
lines changed

7 files changed

+21
-20
lines changed

.github/workflows/ocm.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
repository_dispatch:
66
types: [ocm_changes]
77
env:
8-
GO_VERSION: '1.22'
8+
GO_VERSION: '1.23'
99

1010
jobs:
1111
e2e-test:

.github/workflows/release.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99
name: Create Release
1010

1111
env:
12-
GO_VERSION: "1.22"
12+
GO_VERSION: "1.23"
1313

1414
jobs:
1515
build:

.github/workflows/tests.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99
branches: [ main, release-* ]
1010

1111
env:
12-
GO_VERSION: '1.22'
12+
GO_VERSION: '1.23'
1313

1414
jobs:
1515
verify:

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ clean: clean-test clean-e2e
3636

3737
.PHONY: verify
3838
verify:
39-
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.51.1
39+
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.64.6
4040
go vet ./...
4141
golangci-lint run --timeout=3m --modules-download-mode vendor -E gofmt ./...
4242

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module open-cluster-management.io/clusteradm
22

3-
go 1.22.6
3+
go 1.23
44

55
require (
66
github.com/briandowns/spinner v1.23.0

pkg/cmd/create/sampleapp/exec_test.go

+6-7
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import (
2222
clusterapiv1 "open-cluster-management.io/api/cluster/v1"
2323
"open-cluster-management.io/clusteradm/pkg/cmd/addon/enable"
2424
hubaddonscenario "open-cluster-management.io/clusteradm/pkg/cmd/install/hubaddon/scenario"
25-
installscenario "open-cluster-management.io/clusteradm/pkg/cmd/install/hubaddon/scenario"
2625
"open-cluster-management.io/clusteradm/pkg/version"
2726
)
2827

@@ -158,7 +157,7 @@ var _ = ginkgo.Describe("deploy samepleapp to every managed cluster", func() {
158157
files, err := addonPathWalkDir(appDir)
159158
gomega.Expect(err).ToNot(gomega.HaveOccurred(), "install addon error")
160159

161-
err = r.Apply(installscenario.Files, ao.values, files...)
160+
err = r.Apply(hubaddonscenario.Files, ao.values, files...)
162161
gomega.Expect(err).ToNot(gomega.HaveOccurred(), "install addon error")
163162

164163
fmt.Fprintf(streams.Out, "Installing built-in %s add-on to namespace %s.\n", addon, addonNamespace)
@@ -215,17 +214,17 @@ var _ = ginkgo.Describe("deploy samepleapp to every managed cluster", func() {
215214
)
216215

217216
if _, err = clusterClient.ClusterV1beta1().Placements(testNamespace).Get(context.TODO(), placementResourceName, metav1.GetOptions{}); err != nil {
218-
return fmt.Errorf(fmt.Sprintf("Missing Placement resource \"%s\" in namespace %s", placementResourceName, testNamespace))
217+
return fmt.Errorf("Missing Placement resource \"%s\" in namespace %s", placementResourceName, testNamespace)
219218
}
220219
fmt.Fprintf(streams.Out, "Placement resource \"%s\" created successfully in namespace %s.\n", placementResourceName, testNamespace)
221220

222221
if _, err = clusterClient.ClusterV1beta2().ManagedClusterSets().Get(context.TODO(), managedClusterSetName, metav1.GetOptions{}); err != nil {
223-
return fmt.Errorf(fmt.Sprintf("Missing ManagedClusterSet resource \"%s\"", managedClusterSetName))
222+
return fmt.Errorf("Missing ManagedClusterSet resource \"%s\"", managedClusterSetName)
224223
}
225224
fmt.Fprintf(streams.Out, "ManagedClusterSet resource \"%s\" created successfully.\n", managedClusterSetName)
226225

227226
if _, err = clusterClient.ClusterV1beta2().ManagedClusterSetBindings(testNamespace).Get(context.TODO(), managedClusterSetBindingName, metav1.GetOptions{}); err != nil {
228-
return fmt.Errorf(fmt.Sprintf("Missing ManagedClusterSetBinding resource \"%s\" in namespace %s", managedClusterSetBindingName, testNamespace))
227+
return fmt.Errorf("Missing ManagedClusterSetBinding resource \"%s\" in namespace %s", managedClusterSetBindingName, testNamespace)
229228
}
230229
fmt.Fprintf(streams.Out, "ManagedClusterSetBinding resource \"%s\" created successfully in namespace %s.\n", managedClusterSetBindingName, testNamespace)
231230

@@ -237,7 +236,7 @@ var _ = ginkgo.Describe("deploy samepleapp to every managed cluster", func() {
237236

238237
channelObjlist, _ := dynamicClient.Resource(channelGVR).List(context.TODO(), metav1.ListOptions{})
239238
if !contains(channelObjlist, channelName) {
240-
return fmt.Errorf(fmt.Sprintf("Missing Channel custom resource \"%s\"", channelName))
239+
return fmt.Errorf("Missing Channel custom resource \"%s\"", channelName)
241240
}
242241
fmt.Fprintf(streams.Out, "Channel custom resource \"%s\" created successfully in namespace %s.\n", channelName, testNamespace)
243242

@@ -249,7 +248,7 @@ var _ = ginkgo.Describe("deploy samepleapp to every managed cluster", func() {
249248

250249
subscriptionObjlist, _ := dynamicClient.Resource(subscriptionGVR).List(context.TODO(), metav1.ListOptions{})
251250
if !contains(subscriptionObjlist, subscriptionName) {
252-
return fmt.Errorf(fmt.Sprintf("Missing Subscription custom resource \"%s\"", subscriptionName))
251+
return fmt.Errorf("Missing Subscription custom resource \"%s\"", subscriptionName)
253252
}
254253
fmt.Fprintf(streams.Out, "Subscription custom resource \"%s\" created successfully in namespace %s.\n", subscriptionName, testNamespace)
255254

pkg/helpers/check/check.go

+10-8
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22
package check
33

44
import (
5+
"errors"
56
"fmt"
6-
"k8s.io/apimachinery/pkg/api/errors"
7+
8+
k8serrors "k8s.io/apimachinery/pkg/api/errors"
79
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
810
clusterclient "open-cluster-management.io/api/client/cluster/clientset/versioned"
911
operatorclient "open-cluster-management.io/api/client/operator/clientset/versioned"
@@ -23,8 +25,8 @@ func CheckForHub(client clusterclient.Interface) error {
2325

2426
list, err := client.Discovery().ServerResourcesForGroupVersion(clusterv1.GroupVersion.String())
2527
if err != nil {
26-
if errors.IsNotFound(err) {
27-
return fmt.Errorf(msg)
28+
if k8serrors.IsNotFound(err) {
29+
return errors.New(msg)
2830

2931
}
3032
return fmt.Errorf("failed to list GroupVersion %s: %s", clusterv1.GroupVersion.String(), err)
@@ -34,7 +36,7 @@ func CheckForHub(client clusterclient.Interface) error {
3436
if flag {
3537
return nil
3638
}
37-
return fmt.Errorf(msg)
39+
return errors.New(msg)
3840
}
3941

4042
func CheckForKlusterletCRD(client operatorclient.Interface) error {
@@ -48,16 +50,16 @@ func CheckForKlusterletCRD(client operatorclient.Interface) error {
4850
if flag {
4951
return nil
5052
}
51-
return fmt.Errorf(msg)
53+
return errors.New(msg)
5254
}
5355

5456
func CheckForManagedCluster(client clusterclient.Interface) error {
5557
msg := "managed cluster oriented command should not running against non-managed cluster"
5658

5759
list, err := client.Discovery().ServerResourcesForGroupVersion(clusterv1alpha1.GroupVersion.String())
5860
if err != nil {
59-
if errors.IsNotFound(err) {
60-
return fmt.Errorf(msg)
61+
if k8serrors.IsNotFound(err) {
62+
return errors.New(msg)
6163

6264
}
6365

@@ -67,7 +69,7 @@ func CheckForManagedCluster(client clusterclient.Interface) error {
6769
if flag {
6870
return nil
6971
}
70-
return fmt.Errorf(msg)
72+
return errors.New(msg)
7173
}
7274

7375
func findResource(list *metav1.APIResourceList, resourceName string) bool {

0 commit comments

Comments
 (0)