How do I nicely parse a list of program parameters and automate handling \"--help\" and/or \"--version\" (such as \"program [-d value] [--abc] [FILE1]\") in Go?
program [-d value] [--abc] [FILE1]
go-flags is very complete, BSD licensed, and has a clear example.
var opts struct { DSomething string `short:"d" description:"Whatever this is" required:"true"` ABC bool `long:"abc" description:"Something"` } fileArgs, err := flags.Parse(&opts) if err != nil { os.Exit(1) }