Am Dienstag, 17. Januar 2017 09:14:26 UTC+1 schrieb alcub...@gmail.com: > > Ah, then my fundamental structure was wrong. Since the code didn't contain > any tests, I had it in a file named init_mock.go, and it was getting pulled > into the binary. So you're saying I should have all test-only code in a > file named *_test.go, including code that doesn't contain any tests? >
The *_test.go files are normal Go source code file and may contain anything. From consts to init functions, helpers, tests, benchmarks, examples and needed mocks. Take a look at how the stdlib does things if unsure. I have to admit I'm unsure why you have mock code but no tests? If these mock stuff is not part of production code put it into mock_test.go and it won't be part of the production build. But it won't do anything as it will be compiled only during `go test` which is a noop if you do not have tests, examples or benchmarks... V. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.