mirror of
https://github.com/gocsaf/csaf.git
synced 2025-12-22 18:15:42 +01:00
Fix crash if remote validator is not configured. Small cosmetics.
This commit is contained in:
parent
adf98736cc
commit
6a60e8d8ce
1 changed files with 15 additions and 13 deletions
|
|
@ -41,7 +41,7 @@ func main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(files) == 0 {
|
if len(files) == 0 {
|
||||||
log.Println("No domains given.")
|
log.Println("No files given.")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -86,21 +86,23 @@ func run(opts *options, files []string) error {
|
||||||
fmt.Printf(" * %s\n", vErr)
|
fmt.Printf(" * %s\n", vErr)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
fmt.Printf("%s passes the schema validation.\n", file)
|
fmt.Printf("%q passes the schema validation.\n", file)
|
||||||
}
|
}
|
||||||
// Validate against remote validator.
|
// Validate against remote validator.
|
||||||
validate, err := validator.Validate(doc)
|
if validator != nil {
|
||||||
if err != nil {
|
validate, err := validator.Validate(doc)
|
||||||
return fmt.Errorf("remote validation of %q failed: %w",
|
if err != nil {
|
||||||
file, err)
|
return fmt.Errorf("remote validation of %q failed: %w",
|
||||||
|
file, err)
|
||||||
|
}
|
||||||
|
var passes string
|
||||||
|
if validate {
|
||||||
|
passes = "passes"
|
||||||
|
} else {
|
||||||
|
passes = "does not pass"
|
||||||
|
}
|
||||||
|
fmt.Printf("%q %s remote validation.\n", file, passes)
|
||||||
}
|
}
|
||||||
var passes string
|
|
||||||
if validate {
|
|
||||||
passes = "passes"
|
|
||||||
} else {
|
|
||||||
passes = "does not pass"
|
|
||||||
}
|
|
||||||
fmt.Printf("%q %s remote validation.\n", file, passes)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue