I guess it's usage of flag is meant in to behave like parsing flags in Unix/LInux, or Python' argparse:
- after the command you have the flags denoted by '-' - after flags follow rest of command line args where elements can be every character string BR, Roland Am Fr., 9. Okt. 2020 um 07:10 Uhr schrieb Amit Saha <amitsaha...@gmail.com>: > Hi all, I realize that the flag package stops parsing os.Args[] once it > finds a non "-" character. This means, if I invoke my program as: > > $ ./myprog arg1 -d value > > flag.Parse() will stop parsing the moment it sees arg1 and result in > NArg() returning 2 instead of 1. > > Is there a recommended workaround to handle both $./myprog -d value arg1 > and $./myprog arg1 -d value correctly? > > Thanks for any suggestions. > > Thanks, > Amit. > > -- > 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. > To view this discussion on the web visit > https://groups.google.com/d/msgid/golang-nuts/d1399079-4589-454f-91d3-820a60aa239dn%40googlegroups.com > <https://groups.google.com/d/msgid/golang-nuts/d1399079-4589-454f-91d3-820a60aa239dn%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CA%2B8p0G1EdVcShAPDHGp-abCKFwUvLpLEiNUV9Owy03G1m3aSEA%40mail.gmail.com.