Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
proposal: allow imports of _test.go functions and types in different packages. #39565
What version of Go are you using (
It seems to me that using a common package is the right approach.
Presumably when we import a package we don't normally want to be able to refer to testing functions. Even from test code, we normally want to use the standard package API, not a testing API. So if we were to support this, we would need some additional mechanism to say "import the testing API for package foo". But few people would ever use that mechanism.
Since the need is unusual, and there is a way to do it by using a shared package, I don't see a compelling reason to add this feature.