Closed anantn closed 8 years ago
Hi @anantn
If my memory is correct, the test_helpers
where named like that to avoid being considered as tests by the go compiler when running go test
. But I might be wrong, please correct me if I'm wrong. Please also note that I'm open to rename it!
@oleiade It's safe to have a test file that has no tests in it (like helpers_test.go
). The problem is when you have a file that imports the testing
package but isn't recognized as a test by Go.
All of the flags introduced by the testing package now leak into your main package (and everyone who depends on it!).
So my point is that you actually do want Go to recognize the helpers as a test file, not as a regular file that's part of your package (because you call import testing
inside it).
Sounds reasonable to me then! Thanks for the info, I learned something today :-) Let's merge that baby. Cheers
This avoids polluting the flags of all packages that depend on this one.
STR: Run this program before and after this change:
Before:
After: