-
Notifications
You must be signed in to change notification settings - Fork 17.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
testing: _test package runs init() in the containing folder #58823
Comments
From
While Closing as both working as intended and documented |
@seankhliao I have read your comment twice, and I'm getting even more confused than before I wrote this issue. What
There's nothing in the above that suggests the current surprising behaviour – and I'm not thrilled that my issue is brushed off so lightly. |
The test binary is constructed in the context of |
I'm having problems finding good documentation about the expected behaviour of the
_test
package, but as I was bitten/surprised by this, it should warrant at least a searchable issue.See the project and failing test in https://github.com/bep/gotestpackageinit/blob/main/pkga/int_test.go#L1
The test fails because the
init()
func inpkga
panics (which is a little constructed, I agree).My understanding is that
pkga_test
would be compiled as a separate package and that I could only access pkga's exported identifiers and only with an explicit import of that package.In my case I had a great and working integration test of a feature that failed mysteriously in the production binary because the
init()
was never called.gohugoio/hugo#10774
The text was updated successfully, but these errors were encountered: