Skip to content

Commit

Permalink
extra validation to shut down the linter
Browse files Browse the repository at this point in the history
Signed-off-by: Francesco Romani <[email protected]>
  • Loading branch information
ffromani committed Nov 28, 2024
1 parent 5dbc2c1 commit 6dca932
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions pkg/config/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,20 @@ Special targets:
}

params := flags.Args()
extraConfigPath, err := validateConfigRootPath(configPath)
if err != nil {
return DefaultConfigRoot, LegacyExtraConfigPath, err
}

if len(params) > 1 {
return DefaultConfigRoot, configPath, fmt.Errorf("too many config roots given (%d), currently supported up to 1", len(params))
return DefaultConfigRoot, extraConfigPath, fmt.Errorf("too many config roots given (%d), currently supported up to 1", len(params))
}
if len(params) == 0 {
return DefaultConfigRoot, configPath, nil
return DefaultConfigRoot, extraConfigPath, nil
}
configRoot, err := validateConfigRootPath(params[0])
if err != nil {
return DefaultConfigRoot, LegacyExtraConfigPath, err
}
return params[0], FixExtraConfigPath(params[0]), nil
return configRoot, FixExtraConfigPath(configRoot), nil
}

0 comments on commit 6dca932

Please sign in to comment.