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
./pkgflag -b=hello is working, package B and package main can get the value hello of B.B
What did you see instead?
$ ./pkgflag -b=hello
flag provided but not defined: -b
Usage of ./pkgflag:
-a string
-a2 string
$ ./pkgflag -h
Usage of ./pkgflag:
-a string
-a2 string
The text was updated successfully, but these errors were encountered:
You can call flag.Parse in init if you like, although it's not a good idea for a number of reasons. But the important point is that your program should call it only once. And the best place is at the start of your main function.
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
What did you expect to see?
./pkgflag -b=hello is working, package B and package main can get the value
hello
of B.BWhat did you see instead?
The text was updated successfully, but these errors were encountered: