Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


##概述 flag包提供了一系列解析命令行参数的功能接口


var (
  CommandLine = NewFlagSet(os.Args[0], ExitOnError)
  ErrHelp     = errors.New("flag: help requested")
  Usage       = func() {
    fmt.Fprintf(os.Stderr, "Usage of %s:\n", os.Args[0])


type Flag

type Flag struct {
        Name     string // name as it appears on command line
        Usage    string // help message
        Value    Value  // value as set
        DefValue string // default value (as text); for usage message

type FlagSet

type FlagSet struct {
        Usage func()

type Getter

type Getter interface {
        Get() interface{}

type Value

type Value interface {
        String() string
        Set(string) error