1
0
Fork 0
mirror of https://github.com/gocsaf/csaf.git synced 2025-12-22 18:15:42 +01:00

Fallback to default config files if no config file was given.

This commit is contained in:
Sascha L. Teichmann 2023-07-25 10:53:18 +02:00
parent 9697e99d86
commit 1bdaf5854a

View file

@ -73,7 +73,9 @@ func (p *Parser[C]) Parse() ([]string, *C, error) {
// Do we have a config file explicitly given by command line? // Do we have a config file explicitly given by command line?
if p.ConfigLocation != nil { if p.ConfigLocation != nil {
path = p.ConfigLocation(&cmdLineOpts) path = p.ConfigLocation(&cmdLineOpts)
} else { }
// Fallback to defaults if we have not found any.
if path == "" && len(p.DefaultConfigLocations) > 0 {
path = findConfigFile(p.DefaultConfigLocations) path = findConfigFile(p.DefaultConfigLocations)
} }