It's reasonable to consider calling a command with a flag that is not defined an error (whether that flag is -help or -verbose or -whatever). It is common to return non 0 on error.
On Wednesday, 19 July 2017 11:31:42 UTC-7, Philippe Modard wrote: > > Hey go-nuts, > > I realize than running `mybinary --help` returns a nice help message along > with a exit status 2. > What is the reason it doesn't return 0? > > I fixed it by manually adding a help flag: > ``` > var help = flag.Bool("help", false, "Print the help message") > [...] > if *help { > flag.PrintDefaults() > return > } > ``` > > But I'm still confused why the default behavior is returning an error > along with the right message. > > Cheers, > Philmod > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.