From 77850507b1de32b2350bc13a6050f5036e0877c0 Mon Sep 17 00:00:00 2001 From: aalexand Date: Thu, 11 Jul 2024 18:53:49 +0300 Subject: [PATCH] Fix linting --- pkg/sync/manager/controller.go | 4 +--- pkg/sync/parser/parser.go | 3 +-- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/pkg/sync/manager/controller.go b/pkg/sync/manager/controller.go index b600dcd..9317764 100644 --- a/pkg/sync/manager/controller.go +++ b/pkg/sync/manager/controller.go @@ -103,9 +103,7 @@ func (c *SyncController) Reconcile(ctx context.Context, req ctrl.Request) (ctrl. c.ResourceParser.SetBuffer(initialData) for _, res := range instance.Spec.WatchedResources { - var err error - err = c.ResourceParser.Parse(ctx, res) - if err != nil { + if err = c.ResourceParser.Parse(ctx, res); err != nil { log.Error(err, "failed to parse resource", "resource", res) errList = append(errList, err) } diff --git a/pkg/sync/parser/parser.go b/pkg/sync/parser/parser.go index aa88af7..ab656ed 100644 --- a/pkg/sync/parser/parser.go +++ b/pkg/sync/parser/parser.go @@ -15,7 +15,6 @@ package parser import ( "context" "encoding/json" - "errors" "fmt" v1 "github.com/adobe/cluster-registry/pkg/api/registry/v1" registryv1alpha1 "github.com/adobe/cluster-registry/pkg/api/registry/v1alpha1" @@ -60,7 +59,7 @@ func (p *ResourceParser) Parse(ctx context.Context, res registryv1alpha1.Watched h, ok := p.handlers[gvk] if !ok { - return errors.New(fmt.Sprintf("no handler registered for GVK: %s", gvk.String())) + return fmt.Errorf("no handler registered for GVK: %s", gvk.String()) } objects, err := p.getObjectsForResource(ctx, res)