Defining Independent FlagSets in GoLang

前端 未结 2 1264
野趣味
野趣味 2020-12-09 16:59

The Go documentation (http://golang.org/pkg/flag/) says:

The FlagSet type allows one to define independent sets of flags, such as to implement subcomm

2条回答
  •  一向
    一向 (楼主)
    2020-12-09 17:22

    Just change these code

    if err := f2.Parse(os.Args[1:]); err == nil {
        fmt.Println(*reset)
    }
    

    to

    f2.Parse(os.Args[1:])
    fmt.Println(*reset)
    

    but the warning is just left on the console.if u wanna remove it ,modify /usr/local/go/src/flag/flag.go and recompile the golang .. or do a copy of flag package.

      →_→ 怀疑的眼神~~

提交回复
热议问题