From e439302e6eaf9c2fc397d4ee5e0ea5d77d3046d4 Mon Sep 17 00:00:00 2001 From: Brandon Palm Date: Tue, 17 Dec 2024 13:33:14 -0600 Subject: [PATCH] idms: adjust return consistency --- pkg/idms/idms.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pkg/idms/idms.go b/pkg/idms/idms.go index f60d6ae12..d3ade0be3 100644 --- a/pkg/idms/idms.go +++ b/pkg/idms/idms.go @@ -63,6 +63,8 @@ func NewBuilder(apiClient *clients.Settings, name string, mirror configv1.ImageD glog.V(100).Infof("The name of the imagedigestmirrorset is empty") builder.errorMsg = "imagedigestmirrorset 'name' cannot be empty" + + return builder } return builder @@ -264,13 +266,13 @@ func (builder *Builder) validate() (bool, error) { if builder.Definition == nil { glog.V(100).Infof("The %s is undefined", resourceCRD) - builder.errorMsg = msg.UndefinedCrdObjectErrString(resourceCRD) + return false, fmt.Errorf(msg.UndefinedCrdObjectErrString(resourceCRD)) } if builder.apiClient == nil { glog.V(100).Infof("The %s builder apiclient is nil", resourceCRD) - builder.errorMsg = fmt.Sprintf("%s builder cannot have nil apiClient", resourceCRD) + return false, fmt.Errorf("%s builder cannot have nil apiClient", resourceCRD) } if builder.errorMsg != "" {