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
Here is a simple repo to illustrate the issue. The go test command is appending a -test.timeout flag which causes flag.Parse() to always fail, even when -args is used on go test.
What did you expect to see?
go test -args -f passes -f causing the bool someFlag to be true.
Here is the repo to reproduce this problem. It seems like the automatic appending things onto the arguments line invisibly is confusing and breaks the flag package completely.
What did you see instead?
flag provided but not defined: -test.timeout
Usage of /var/folders/nt/y0clsxwx4wjf7w8b9kcb7wgc0000gn/T/go-build666703793/b001/go-test-bug.test:
-f An example bool flag
exit status 2
FAIL _/Users/ericgreer/git/go-test-bug 0.004s
The text was updated successfully, but these errors were encountered:
Testing flags are now registered in the new Init function, which is invoked by the generated main function for the test. As a result, testing flags are now only registered when running a test binary, and packages that call flag.Parse during package initialization may cause tests to fail.
Yes, this was changed (and documented) in go1.13. See the issue linked above (and the many many issues opened and linked to that one) for more discussion. Closing here.
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
yes, including beta 1.14beta1
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Here is a simple repo to illustrate the issue. The
go test
command is appending a-test.timeout
flag which causesflag.Parse()
to always fail, even when-args
is used ongo test
.What did you expect to see?
go test -args -f
passes-f
causing the boolsomeFlag
to betrue
.Here is the repo to reproduce this problem. It seems like the automatic appending things onto the arguments line invisibly is confusing and breaks the
flag
package completely.What did you see instead?
The text was updated successfully, but these errors were encountered: