Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
cmd/go: poor error message when non-test Go file is in a xx_test package other than the directory name #24895
What version of Go are you using?
Does this issue reproduce with the latest release?
I guess this is the latest release.
What operating system and processor architecture are you using?
What did you do?
Using the ginkgo cli tool, I created a test suite bootstrap. The folder name is
I changed the package name in all files to
I ran both
What did you expect to see?
What did you see instead?
Just to proof that all packages are named
What solved the issue?
A file in a xx_test package should always be named yy_test.go. The go tool decides which files are in a test based on the name of the file, not on the package clause.
Since you had a non test file, the go tool expected it to have a package clause that matched the directory name. But I agree that the error message could perhaps be clearer.