From 6c82c83b3ab7f7664048f70c79b302cc6f7c1475 Mon Sep 17 00:00:00 2001 From: Simon Croome Date: Mon, 22 Mar 2021 15:58:07 +0000 Subject: [PATCH] Wrap validation error instead of recreating Signed-off-by: Simon Croome --- pkg/lint/rules/template.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/lint/rules/template.go b/pkg/lint/rules/template.go index 826a31bfa..c1c2ed84f 100644 --- a/pkg/lint/rules/template.go +++ b/pkg/lint/rules/template.go @@ -215,7 +215,7 @@ func validateMetadataName(obj *K8sYamlStruct) error { allErrs = append(allErrs, field.Invalid(field.NewPath("metadata").Child("name"), obj.Metadata.Name, msg)) } if len(allErrs) > 0 { - return fmt.Errorf("object name does not conform to Kubernetes naming requirements: %q (%s)", obj.Metadata.Name, allErrs.ToAggregate().Error()) + return errors.Wrapf(allErrs.ToAggregate(), "object name does not conform to Kubernetes naming requirements: %q", obj.Metadata.Name) } return nil }