Skip to content

🌱 Bump golang to 1.23 #473

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

Merged
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 .github/workflows/ocm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
repository_dispatch:
types: [ocm_changes]
env:
GO_VERSION: '1.22'
GO_VERSION: '1.23'

jobs:
e2e-test:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
name: Create Release

env:
GO_VERSION: "1.22"
GO_VERSION: "1.23"

jobs:
build:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
branches: [ main, release-* ]

env:
GO_VERSION: '1.22'
GO_VERSION: '1.23'

jobs:
verify:
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ clean: clean-test clean-e2e

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

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 open-cluster-management.io/clusteradm

go 1.22.6
go 1.23

require (
github.com/briandowns/spinner v1.23.0
Expand Down
13 changes: 6 additions & 7 deletions pkg/cmd/create/sampleapp/exec_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import (
clusterapiv1 "open-cluster-management.io/api/cluster/v1"
"open-cluster-management.io/clusteradm/pkg/cmd/addon/enable"
hubaddonscenario "open-cluster-management.io/clusteradm/pkg/cmd/install/hubaddon/scenario"
installscenario "open-cluster-management.io/clusteradm/pkg/cmd/install/hubaddon/scenario"
"open-cluster-management.io/clusteradm/pkg/version"
)

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

err = r.Apply(installscenario.Files, ao.values, files...)
err = r.Apply(hubaddonscenario.Files, ao.values, files...)
gomega.Expect(err).ToNot(gomega.HaveOccurred(), "install addon error")

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

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

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

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

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

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

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

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

Expand Down
18 changes: 10 additions & 8 deletions pkg/helpers/check/check.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@
package check

import (
"errors"
"fmt"
"k8s.io/apimachinery/pkg/api/errors"

k8serrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
clusterclient "open-cluster-management.io/api/client/cluster/clientset/versioned"
operatorclient "open-cluster-management.io/api/client/operator/clientset/versioned"
Expand All @@ -23,8 +25,8 @@ func CheckForHub(client clusterclient.Interface) error {

list, err := client.Discovery().ServerResourcesForGroupVersion(clusterv1.GroupVersion.String())
if err != nil {
if errors.IsNotFound(err) {
return fmt.Errorf(msg)
if k8serrors.IsNotFound(err) {
return errors.New(msg)

}
return fmt.Errorf("failed to list GroupVersion %s: %s", clusterv1.GroupVersion.String(), err)
Expand All @@ -34,7 +36,7 @@ func CheckForHub(client clusterclient.Interface) error {
if flag {
return nil
}
return fmt.Errorf(msg)
return errors.New(msg)
}

func CheckForKlusterletCRD(client operatorclient.Interface) error {
Expand All @@ -48,16 +50,16 @@ func CheckForKlusterletCRD(client operatorclient.Interface) error {
if flag {
return nil
}
return fmt.Errorf(msg)
return errors.New(msg)
}

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

list, err := client.Discovery().ServerResourcesForGroupVersion(clusterv1alpha1.GroupVersion.String())
if err != nil {
if errors.IsNotFound(err) {
return fmt.Errorf(msg)
if k8serrors.IsNotFound(err) {
return errors.New(msg)

}

Expand All @@ -67,7 +69,7 @@ func CheckForManagedCluster(client clusterclient.Interface) error {
if flag {
return nil
}
return fmt.Errorf(msg)
return errors.New(msg)
}

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