From c2c7bbec1204ffee4ce8498c0f3e577482b1ac28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cyrill=20N=C3=A4f?= Date: Thu, 10 Oct 2024 07:37:26 +0200 Subject: [PATCH] Simplify error handling MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Simplify error handling by directly returning the error Co-authored-by: Nic Cope Signed-off-by: Cyrill Näf --- resource/composed/composed.go | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/resource/composed/composed.go b/resource/composed/composed.go index 0cce9e1..b0864d6 100644 --- a/resource/composed/composed.go +++ b/resource/composed/composed.go @@ -63,11 +63,7 @@ func To[T runtime.Object](un *Unstructured, obj T) error { return errors.Errorf("GVK %v is not known by the scheme for the provided object type", un.GetObjectKind().GroupVersionKind()) } - err = runtime.DefaultUnstructuredConverter.FromUnstructured(un.Object, obj) - if err != nil { - return err - } - return nil + return runtime.DefaultUnstructuredConverter.FromUnstructured(un.Object, obj) } // From creates a new unstructured composed resource from the supplied object.