mirror of
https://github.com/yannh/kubeconform.git
synced 2026-02-18 17:37:03 +00:00
fix: change flag parse error handling to return errors instead of exiting
Having ExitOnError in combination with SetOutput to a buffer instead of stdout/stderr means flags.Parse output is swallowed and kubeconform silently exits directly with exit code 2 instead of returning the error. Setting ContinueOnError instead returns the error, and writes usage help to the buffer, so error handling code in main is reached.
This commit is contained in:
parent
b5f34caa70
commit
27a3ddeca2
1 changed files with 1 additions and 1 deletions
|
|
@ -56,7 +56,7 @@ func splitCSV(csvStr string) map[string]struct{} {
|
|||
func FromFlags(progName string, args []string) (Config, string, error) {
|
||||
var schemaLocationsParam, ignoreFilenamePatterns arrayParam
|
||||
var skipKindsCSV, rejectKindsCSV string
|
||||
flags := flag.NewFlagSet(progName, flag.ExitOnError)
|
||||
flags := flag.NewFlagSet(progName, flag.ContinueOnError)
|
||||
var buf bytes.Buffer
|
||||
flags.SetOutput(&buf)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue