Skip to content

Commit 1078daf

Browse files
committed
cmd/validate: print the validation errors
Print out any errors encountered during validation, as suggested by the command help. Signed-off-by: Markus Lehtonen <[email protected]>
1 parent d0e7c3e commit 1078daf

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

cmd/cdi/cmd/validate.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ package cmd
1919
import (
2020
"fmt"
2121
"os"
22+
"strings"
2223

2324
"github.com/spf13/cobra"
2425

@@ -40,6 +41,13 @@ were reported by the registry.`,
4041
return
4142
}
4243

44+
fmt.Printf("CDI Registry has errors:\n")
45+
for path, specErrors := range cdiErrors {
46+
fmt.Printf("Spec file %s:\n", path)
47+
for idx, err := range specErrors {
48+
fmt.Printf(" %2d: %v\n", idx, strings.TrimSpace(err.Error()))
49+
}
50+
}
4351
os.Exit(1)
4452
},
4553
}

0 commit comments

Comments
 (0)