flag.go
func (f *FlagSet) Parse(allowIntersperse bool, arguments []string) error {
	f.parsed = true
	f.procArgs = arguments
	f.procFlag = ""
	f.args = nil
	f.allowIntersperse = allowIntersperse
	for {
		name, long, finished, err := f.parseOne()
		if !finished {
			if name != "" {
				finished, err = f.parseFlagArg(name, long)
			}
		}
		if err != nil {
			switch f.errorHandling {
			case ContinueOnError:
				return err
			case ExitOnError:
				os.Exit(2)
			case PanicOnError:
				panic(err)
			}
		}
		if !finished {
			continue
		}
		if err == nil {
			break
		}
	}
	return nil
}
func (f *FlagSet) Parse(allowIntersperse bool, arguments []string) error {
	f.parsed = true
	f.procArgs = arguments
	f.procFlag = ""
	f.args = nil
	f.allowIntersperse = allowIntersperse
	for {
		name, long, finished, err := f.parseOne()
		if !finished {
			if name != "" {
				finished, err = f.parseFlagArg(name, long)
			}
		}
		if err != nil {
			switch f.errorHandling {
			case ContinueOnError:
				return err
			case ExitOnError:
				os.Exit(2)
			case PanicOnError:
				panic(err)
			}
		}
		if !finished {
			continue
		}
		if err == nil {
			break
		}
	}
	return nil
}
// Parse parses flag definitions from the argument list, which should not
// include the command name.  Must be called after all flags in the FlagSet
// are defined and before flags are accessed by the program.
// The return value will be ErrHelp if --help or -h was set but not defined.
// If allowIntersperse is set, arguments and flags can be interspersed, that
// is flags can follow positional arguments.