From 6f2fe33bc0f16608a83bfd501263609d8aed6526 Mon Sep 17 00:00:00 2001 From: Yann Hamon Date: Sun, 15 Nov 2020 10:06:42 +0100 Subject: [PATCH] better example --- examples/main.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/examples/main.go b/examples/main.go index b7613cb..bb0e498 100644 --- a/examples/main.go +++ b/examples/main.go @@ -19,8 +19,11 @@ func main() { v := validator.New(nil, validator.Opts{Strict: true}) 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.Valid && res.Status != validator.Empty { - log.Fatalf("resource %d in file %s is not valid: %d, %s", i, filepath, res.Status, res.Err) + if res.Status == validator.Invalid { + log.Fatalf("resource %d in file %s is not valid: %s", i, filepath, res.Err) + } + if res.Status == validator.Error { + log.Fatalf("error while processing resource %d in file %s: %s", i, filepath, res.Err) } } }