fail early when a broken -schema-location template is given

This commit is contained in:
Yann Hamon 2020-11-15 20:23:37 +01:00
parent 905f5e7417
commit 651d3b2c50
5 changed files with 32 additions and 8 deletions

View file

@ -16,7 +16,10 @@ func main() {
log.Fatalf("failed opening %s: %s", filepath, err)
}
v := validator.New(nil, validator.Opts{Strict: true})
v, err := validator.New(nil, validator.Opts{Strict: true})
if err != nil {
log.Fatalf("failed initializing validator: %s", err)
}
for i, res := range v.Validate(filepath, f) { // A file might contain multiple resources
// File starts with ---, the parser assumes a first empty resource
if res.Status == validator.Invalid {