Skip to content
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

cmd/go: Test exports should be visible to tests in other packages #11198

Closed
willfaught opened this issue Jun 13, 2015 · 5 comments
Closed

cmd/go: Test exports should be visible to tests in other packages #11198

willfaught opened this issue Jun 13, 2015 · 5 comments

Comments

@willfaught
Copy link
Contributor

My particular scenario is exporting a test suite (like from testify) per package, so they can be run individually as unit tests, but also aggregated together for integration tests.

@ianlancetaylor ianlancetaylor changed the title Test exports should be visible to tests in other packages cmd/go: Test exports should be visible to tests in other packages Jun 13, 2015
@ianlancetaylor ianlancetaylor added this to the Unplanned milestone Jun 13, 2015
@minux
Copy link
Member

minux commented Jun 14, 2015 via email

@willfaught
Copy link
Contributor Author

Perhaps test binaries can be cached in $GOPATH/pkg like non-test ones (if they aren't already, I don't know).

@minux
Copy link
Member

minux commented Jun 15, 2015 via email

@willfaught
Copy link
Contributor Author

Thanks for the workaround. This would mean either (1) always using -tags test with go test, which isn't obvious, or (2) always using a make file to test. Neither are great for obvious reasons. Ideally this would be possible through a plain "go test" command.

@rsc
Copy link
Contributor

rsc commented Jun 5, 2017

Test exports should not be visible to tests in other packages. This is by design. What you expose for your own tests might be very different from what you want to expose for other clients, even clients writing tests.

Put another way, tests are only for the package author. Anything used by other packages is public API.

@rsc rsc closed this as completed Jun 5, 2017
@golang golang locked and limited conversation to collaborators Jun 5, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants