You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
See https://play.golang.org/p/VOZki0Q4Vmc
Command line arguments are not parsed correctly (at least not according to the documentation) when the non-flag arguments are provided before the flag arguments.
What did you expect to see?
The printout from fmt.Printf("argument passed: %s; Flags passed: %s", flag.Args(), *flgPtr) should be
argument passed: [AnArgument]; Flags passed: AFlag
Sorry, I missed that line.
But, I still think the flag package should handle arguments specified before the flag because in most instances users expect to be able to specify the typically more important argument(s) before the flag.
eg,
find myfile -i
rather than
find -i myfile
The flag package is well-defined and simple, and in this case is working as intended, and the same as traditional Unix tools - try ls file -l. If you want different behavior, there are alternate flag-handling packages to try.
What did you do?
See https://play.golang.org/p/VOZki0Q4Vmc
Command line arguments are not parsed correctly (at least not according to the documentation) when the non-flag arguments are provided before the flag arguments.
What did you expect to see?
The printout from
fmt.Printf("argument passed: %s; Flags passed: %s", flag.Args(), *flgPtr)
should beargument passed: [AnArgument]; Flags passed: AFlag
What did you see instead?
argument passed: [AnArgument -t AFlag]; Flags passed:
System details
The text was updated successfully, but these errors were encountered: