logoalt Hacker News

awesome_dudeyesterday at 9:35 PM1 replyview on HN

The compiler will only use _test.go files in the test build - so not an explicit build tag, but a built in one.


Replies

Groxxyesterday at 9:55 PM

That doesn't give you a way to exclude conflicting code, unfortunately, so you can't provide an optimal one for non-test code with it.

And stuff like `func SetTime(...)` in a _test.go file only works for tests in that same package, because other packages don't compile that _test.go and won't have that function defined.

show 1 reply