cmd/go: go test links and runs tests for packages with no tests #26242
Labels
FrozenDueToAge
NeedsDecision
Feedback is required from experts, contributors, and/or the community before a change can be made.
release-blocker
Milestone
If asked to run "go test" on a directory with no *_test.go files, I expect "go test" not to build and run a test binary. Go 1.10 and earlier did not. But the current Go 1.11 tree does. Surprise!
If you run 'go test -badflag' then you can see the difference quite clearly: if the test doesn't run, nothing detects the bad flag, so it succeeds.
A more reasonable example is if you have a test helper library you use for all your tests that defines some common flag. It used to work to run
assuming that all your tests imported the library defining -my.flag. But now if any packages in that tree have no tests at all, a dummy test binary gets run that of course does not know about -my.flag
This was originally reported as a bug against vgo in #26214.
The text was updated successfully, but these errors were encountered: