* Ben Hoyt <benh...@gmail.com> [171213 09:45]:
> > One minor thing may be that instead of using os.Args, I would use the 
> > flag's package.
> 
> Good call.

If you like the Plan 9 convention of -short style options, the standard
library's flag package is good and simple.  If you want the GNU
-l/--long-option convention, you will need to search for one of the many
other third-party flag packages, as the standard library flag package
doesn't support this.

For projects that only require simple argument parsing, but you want to
be able to use --long-option style, there is nothing wrong with ignoring
the existing packages and writing your own ParseArgs function.  For
simple cases with a few options, a robust implementation that allows
-l value, --long-option=value, and --long-option value is only about
30-40 lines of code.  For me, the trade-off between 40 loc and reliance
on a third-party package leans heavily toward the 40 loc.

...Marvin

-- 
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.

Reply via email to