From 6cf51c5280682f2406dac9d8d2b5cf332f69f591 Mon Sep 17 00:00:00 2001 From: Artem Bortnikov Date: Thu, 25 Apr 2024 22:47:03 +0300 Subject: [PATCH] fix nilaway lint Signed-off-by: Artem Bortnikov --- internal/controller/factory/builders.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/internal/controller/factory/builders.go b/internal/controller/factory/builders.go index a57d4f90..da1cc719 100644 --- a/internal/controller/factory/builders.go +++ b/internal/controller/factory/builders.go @@ -28,9 +28,12 @@ import ( ) func reconcileOwnedResource(ctx context.Context, c client.Client, resource client.Object) error { + if resource == nil { + return fmt.Errorf("resource cannot be nil") + } gvk, err := apiutil.GVKForObject(resource, c.Scheme()) if err != nil { - return err + return fmt.Errorf("failed to get GVK: %w", err) } logger := log.FromContext(ctx).WithValues("group", gvk.GroupVersion().String(), "kind", gvk.Kind, "name", resource.GetName()) logger.V(2).Info("reconciling owned resource")