From d5472c10ff297eaadcef9afa9de1eaabd7301c62 Mon Sep 17 00:00:00 2001 From: Richard Hagen Date: Wed, 8 Nov 2023 12:49:00 +0100 Subject: [PATCH] surface error from printRA --- cmd/validate.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/cmd/validate.go b/cmd/validate.go index cd67f8b..6e0769c 100644 --- a/cmd/validate.go +++ b/cmd/validate.go @@ -55,7 +55,10 @@ var validateCmd = &cobra.Command{ } if printfile { - printRA(ra) + err = printRA(ra) + if err != nil { + return err + } } err = radixvalidators.IsRadixApplicationValid(ra) @@ -68,14 +71,14 @@ var validateCmd = &cobra.Command{ }, } -func printRA(ra *radixv1.RadixApplication) { +func printRA(ra *radixv1.RadixApplication) error { b, err := yaml.Marshal(ra) if err != nil { - fmt.Fprint(os.Stderr, err) - return + return err } fmt.Fprintf(os.Stdout, "%s\n", b) + return nil } func init() {