Questions tagged [flag-go]

Use for any question relating to flag-go, a golang package for working with command line flags.

flag-go is a golang package for working with command line flags.

Documentation:

3 questions
24
votes
3 answers

Defining Independent FlagSets in GoLang

The Go documentation (http://golang.org/pkg/flag/) says: The FlagSet type allows one to define independent sets of flags, such as to implement subcommands in a command-line interface. I need this functionality but I can't figure out how to…
chowey
  • 9,138
  • 6
  • 54
  • 84
5
votes
1 answer

How to provide the command line args first and then the flags in golang?

Golang's flag package reads the command line flags and args properly if the input provided is of the form : go run main.go -o filename.txt arg1 arg2 But if I try to provide the input like : go run main.go arg1 arg2 -o filename.txt, everything after…
Mohit
  • 75
  • 1
  • 6
2
votes
3 answers

golang: How can I use pflag with other packages that use flag?

How does one use pflag while also using other packages that use flag? Some of these packages define flags for the flag package (e.g. in their init functions) - and require flag.Parse() to be called. Defining flags using the pflag package, require…
Ziffusion
  • 8,779
  • 4
  • 29
  • 57