-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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: document how to export unexported identifiers in *_test.go #56995
Comments
To me this sounds like something more for a blog post or a wiki page than the testing package documentation. The export_test.go approach follows from the way that cmd/go works. |
From the cmd/go docs there is
|
The actual format may be different, I think the problem here is there is no official introduction about this, and if I search google I don't really remember how I learned that it is possible to use |
I just realized, dup of #25223 |
It might have some overlaps with #25223, but I think my original intention for opening this issue is about the existence of |
It adds an entire section with examples on using an |
Oh, that's interesting. I thought for exporting purpose, internal members must use the special name
The overall usage is a bit tricky because from the current doc f3a1f92
It is a bit hard to realize the mixture of two kinds of |
@seankhliao Thanks. @changkun Can we improve the comments there? There is nothing special about "export_test.go". The way it behaves just follows from the rules about _test.go files and about the package name. |
Change https://go.dev/cl/454335 mentions this issue: |
While I am trying to introduce the usage of
export_test.go
to someone new to Go, I failed to find a document regarding this feature neither in testing nor in go command, not even in the wiki.I am not sure if I overlooked somewhere, but I would propose documenting this somewhere more visible, such as the testing package's document.
The text was updated successfully, but these errors were encountered: