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

go/build: confusing error message 'found packages' #57414

Closed
rillig opened this issue Dec 20, 2022 · 1 comment
Closed

go/build: confusing error message 'found packages' #57414

rillig opened this issue Dec 20, 2022 · 1 comment

Comments

@rillig
Copy link
Contributor

rillig commented Dec 20, 2022

What version of Go are you using (go version)?

go version go1.19.4 windows/amd64

What did you do?

echo 'package pkgname_test' > file1_test.go
echo 'package pkgname_test' > file2.go
go test

What did you expect to see?

file2.go:1:9: only test files may declare a package ending in '_test'

What did you see instead?

found packages pkgname (file1_test.go) and pkgname_test (file2.go)

That error message was confusing because file1_test.go does not declare the package pkgname.
The documentation of MultiplePackageError.Files says:

corresponding files: Files[i] declares package Packages[i]

I discovered this constellation while fixing https://github.com/rillig/gobco so that it can handle a mixture of black box and white box tests in the same directory.

@seankhliao
Copy link
Member

Duplicate of #24895

@seankhliao seankhliao marked this as a duplicate of #24895 Dec 20, 2022
@seankhliao seankhliao closed this as not planned Won't fix, can't repro, duplicate, stale Dec 20, 2022
@golang golang locked and limited conversation to collaborators Dec 20, 2023
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

3 participants