prow/pod-utils/options/load.go
func Load(loader OptionLoader) error {
	if jsonConfig, provided := os.LookupEnv(loader.ConfigVar()); provided {
		if err := loader.LoadConfig(jsonConfig); err != nil {
			return fmt.Errorf("could not load config from JSON var %s: %v", loader.ConfigVar(), err)
		}
		return nil
	}

	fs := flag.NewFlagSet(os.Args[0], flag.ExitOnError)
	loader.AddFlags(fs)
	fs.Parse(os.Args[1:])
	loader.Complete(fs.Args())

	return nil
}
func Load(loader OptionLoader) error {
	if jsonConfig, provided := os.LookupEnv(loader.ConfigVar()); provided {
		if err := loader.LoadConfig(jsonConfig); err != nil {
			return fmt.Errorf("could not load config from JSON var %s: %v", loader.ConfigVar(), err)
		}
		return nil
	}

	fs := flag.NewFlagSet(os.Args[0], flag.ExitOnError)
	loader.AddFlags(fs)
	fs.Parse(os.Args[1:])
	loader.Complete(fs.Args())

	return nil
}
func Load ( loader OptionLoader ) error { if jsonConfig , provided := os . LookupEnv ( loader . ConfigVar ( ) ) ; provided { if err := loader . LoadConfig ( jsonConfig ) ; err != nil { return fmt . Errorf ( " " , loader . ConfigVar ( ) , err ) } return nil } fs := flag . NewFlagSet ( os . Args [ 0 ] , flag . ExitOnError ) loader . AddFlags ( fs ) fs . Parse ( os . Args [ 1 : ] ) loader . Complete ( fs . Args ( ) ) return nil }
// Load loads the set of options, preferring to use
// JSON config from an env var, but falling back to
// command line flags if not possible.
Load loads the set of options preferring to use JSON config from an env var but falling back to command line flags if not possible .