From 37bff705bf5106881f1f0747aca5fc6d058aeb4a Mon Sep 17 00:00:00 2001 From: 1gtm <1gtm@appscode.com> Date: Sat, 17 Aug 2024 06:44:57 +0000 Subject: [PATCH] Use Go 1.23 Signed-off-by: 1gtm <1gtm@appscode.com> Signed-off-by: Tamal Saha --- .github/workflows/ci.yml | 8 ++++---- Makefile | 4 ++-- .../clusterbinding/clusterbinding_controller.go | 4 ++-- .../cluster/clusterbinding/clusterbinding_reconcile.go | 2 +- .../cluster/serviceexport/serviceexport_controller.go | 2 +- .../cluster/serviceexport/spec/spec_reconcile.go | 6 +++--- .../cluster/serviceexport/status/status_controller.go | 10 +++++----- .../cluster/serviceexport/status/status_reconcile.go | 6 +++--- 8 files changed, 21 insertions(+), 21 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b18d7a64..43ed1cbe 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,10 +20,10 @@ jobs: steps: - uses: actions/checkout@v2 - - name: Set up Go 1.22 + - name: Set up Go 1.23 uses: actions/setup-go@v1 with: - go-version: '1.22' + go-version: '1.23' id: go - name: Set up QEMU @@ -47,10 +47,10 @@ jobs: steps: - uses: actions/checkout@v1 - - name: Set up Go 1.22 + - name: Set up Go 1.23 uses: actions/setup-go@v1 with: - go-version: '1.22' + go-version: '1.23' id: go - name: Create Kubernetes ${{ matrix.k8s }} cluster diff --git a/Makefile b/Makefile index 5a10ce6f..c3f3cb16 100644 --- a/Makefile +++ b/Makefile @@ -76,9 +76,9 @@ TAG := $(VERSION)_$(OS)_$(ARCH) TAG_PROD := $(TAG) TAG_DBG := $(VERSION)-dbg_$(OS)_$(ARCH) -GO_VERSION ?= 1.22 +GO_VERSION ?= 1.23 BUILD_IMAGE ?= ghcr.io/appscode/golang-dev:$(GO_VERSION) -CHART_TEST_IMAGE ?= quay.io/helmpack/chart-testing:v3.5.1 +CHART_TEST_IMAGE ?= quay.io/helmpack/chart-testing:v3.11.0 OUTBIN = bin/$(BIN)-$(OS)-$(ARCH) ifeq ($(OS),windows) diff --git a/pkg/konnector/controllers/cluster/clusterbinding/clusterbinding_controller.go b/pkg/konnector/controllers/cluster/clusterbinding/clusterbinding_controller.go index f4d71c32..78975af3 100644 --- a/pkg/konnector/controllers/cluster/clusterbinding/clusterbinding_controller.go +++ b/pkg/konnector/controllers/cluster/clusterbinding/clusterbinding_controller.go @@ -116,7 +116,7 @@ func NewController( return provider, nil } } - return nil, fmt.Errorf(fmt.Sprintf("no provider registered for cluster id: %s in ClusterBinding controller", clusterID)) + return nil, fmt.Errorf("no provider registered for cluster id: %s in ClusterBinding controller", clusterID) }, getProviderSecret: func(provider *konnectormodels.ProviderInfo) (*corev1.Secret, error) { cb, err := provider.BindInformer.KubeBind().V1alpha1().ClusterBindings().Lister().ClusterBindings(provider.Namespace).Get("cluster") @@ -145,7 +145,7 @@ func NewController( func(ns string) committer.Patcher[*v1alpha1.ClusterBinding] { providerInfo, err := konnectormodels.GetProviderInfoWithProviderNamespace(providerInfos, ns) if err != nil { - klog.Warningf(err.Error()) + klog.Warningln(err) return nil } return providerInfo.BindClient.KubeBindV1alpha1().ClusterBindings(ns) diff --git a/pkg/konnector/controllers/cluster/clusterbinding/clusterbinding_reconcile.go b/pkg/konnector/controllers/cluster/clusterbinding/clusterbinding_reconcile.go index adce5205..c4c98b24 100644 --- a/pkg/konnector/controllers/cluster/clusterbinding/clusterbinding_reconcile.go +++ b/pkg/konnector/controllers/cluster/clusterbinding/clusterbinding_reconcile.go @@ -94,7 +94,7 @@ func (r *reconciler) ensureRightScopedServiceBinding(ctx context.Context, bindin sb.Spec.Providers[i].ClusterUID = binding.Status.Provider.ClusterUID sb.Spec.Providers[i].ClusterName = binding.Status.Provider.ClusterName if err = r.updateServiceBinding(ctx, &sb); err != nil { - klog.Errorf(err.Error()) + klog.Errorln(err) return err } break diff --git a/pkg/konnector/controllers/cluster/serviceexport/serviceexport_controller.go b/pkg/konnector/controllers/cluster/serviceexport/serviceexport_controller.go index c232cc8e..e105ebd5 100644 --- a/pkg/konnector/controllers/cluster/serviceexport/serviceexport_controller.go +++ b/pkg/konnector/controllers/cluster/serviceexport/serviceexport_controller.go @@ -99,7 +99,7 @@ func NewController( func(ns string) committer.Patcher[*v1alpha1.APIServiceExport] { provider, err := konnectormodels.GetProviderInfoWithProviderNamespace(providerInfos, ns) if err != nil { - klog.Errorf(fmt.Sprintf("failed to get any provider with namespace: %s", ns)) + klog.Errorf("failed to get any provider with namespace: %s", ns) return nil } return provider.BindClient.KubeBindV1alpha1().APIServiceExports(ns) diff --git a/pkg/konnector/controllers/cluster/serviceexport/spec/spec_reconcile.go b/pkg/konnector/controllers/cluster/serviceexport/spec/spec_reconcile.go index 053ee77a..9bcb0691 100644 --- a/pkg/konnector/controllers/cluster/serviceexport/spec/spec_reconcile.go +++ b/pkg/konnector/controllers/cluster/serviceexport/spec/spec_reconcile.go @@ -57,7 +57,7 @@ func (r *reconciler) reconcile(ctx context.Context, obj *unstructured.Unstructur return err } - klog.Infof(fmt.Sprintf("reconciling object %s/%s for provider %s", obj.GetNamespace(), obj.GetName(), provider.ClusterID)) + klog.Infof("reconciling object %s/%s for provider %s", obj.GetNamespace(), obj.GetName(), provider.ClusterID) ns := obj.GetNamespace() if ns != "" { @@ -104,7 +104,7 @@ func (r *reconciler) reconcile(ctx context.Context, obj *unstructured.Unstructur } if obj, err = r.ensureDownstreamFinalizer(ctx, obj); err != nil { - klog.Errorf(err.Error()) + klog.Errorln(err) return err } @@ -151,7 +151,7 @@ func (r *reconciler) reconcile(ctx context.Context, obj *unstructured.Unstructur // just in case, checking for finalizer if obj, err = r.ensureDownstreamFinalizer(ctx, obj); err != nil { - klog.Errorf(err.Error()) + klog.Errorln(err) return err } diff --git a/pkg/konnector/controllers/cluster/serviceexport/status/status_controller.go b/pkg/konnector/controllers/cluster/serviceexport/status/status_controller.go index b8911a32..ff6fbfab 100644 --- a/pkg/konnector/controllers/cluster/serviceexport/status/status_controller.go +++ b/pkg/konnector/controllers/cluster/serviceexport/status/status_controller.go @@ -201,7 +201,7 @@ func NewController( if _, err = kmc.CreateOrPatch(ctx, consumerKubeClient, consumerSecret, func(_ client.Object, _ bool) client.Object { return consumerSecret }); err != nil && !strings.Contains(err.Error(), errorAlreadyExists) { - klog.Errorf(err.Error()) + klog.Errorln(err) return "", err } @@ -437,7 +437,7 @@ func (c *controller) processNextWorkItem(ctx context.Context) bool { if err := c.process(ctx, key); err != nil { runtime.HandleError(fmt.Errorf("%q controller failed to sync %q, err: %w", controllerName, key, err)) - klog.Errorf(err.Error()) + klog.Errorln(err) c.queue.AddRateLimited(key) return true } @@ -450,7 +450,7 @@ func splitMetaNamespaceKeyWithClusterID(key string) (clusterId, namespace, name switch len(parts) { case 1: // name only, no namespace - return "", "", "", fmt.Errorf(fmt.Sprintf("unexpected object key format: %q", key)) + return "", "", "", fmt.Errorf("unexpected object key format: %q", key) case 2: // cluster id and name return parts[0], "", parts[1], nil @@ -473,7 +473,7 @@ func (c *controller) process(ctx context.Context, key string) error { provider, err := konnectormodels.GetProviderInfoWithClusterID(c.providerInfos, clusterID) if err != nil { - klog.Errorf(err.Error()) + klog.Errorln(err) return err } @@ -489,7 +489,7 @@ func (c *controller) process(ctx context.Context, key string) error { }) if err != nil && !errors.IsNotFound(err) && !strings.Contains(err.Error(), errorContextDeadlineExceeded) { - klog.Errorf(err.Error()) + klog.Errorln(err) return err } else if err != nil && (errors.IsNotFound(err) || strings.Contains(err.Error(), errorContextDeadlineExceeded)) { logger.V(2).Info("Upstream object disappeared") diff --git a/pkg/konnector/controllers/cluster/serviceexport/status/status_reconcile.go b/pkg/konnector/controllers/cluster/serviceexport/status/status_reconcile.go index fa0eb47e..df385db3 100644 --- a/pkg/konnector/controllers/cluster/serviceexport/status/status_reconcile.go +++ b/pkg/konnector/controllers/cluster/serviceexport/status/status_reconcile.go @@ -97,17 +97,17 @@ func (r *reconciler) reconcile(ctx context.Context, obj *unstructured.Unstructur if found { newSecretRefName, err := r.ensureStatusSecret(ctx, provider, obj.DeepCopy(), downstream, newStatus, ns) if err != nil { - klog.Errorf(err.Error()) + klog.Errorln(err) return err } if err := unstructured.SetNestedField(downstream.Object, newStatus, "status"); err != nil { runtime.HandleError(err) - klog.Errorf(err.Error()) + klog.Errorln(err) return nil // nothing we can do here } if newSecretRefName != "" { if err = unstructured.SetNestedField(downstream.Object, newSecretRefName, "status", "secretRef", "name"); err != nil { - klog.Errorf(err.Error()) + klog.Errorln(err) return err } }