-
Notifications
You must be signed in to change notification settings - Fork 18k
cmd/go: Duplicate symbols with more than one main package in -coverpkg #34114
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
Comments
Also, it works without problem in 1.12.9 |
I am seeing this same issue with go 1.13 in darwin |
I also see the same problem with go version go1.13 linux/amd64 |
We're also seeing this on go1.13 linux/amd64, though I can't get it to reproduce outside our build machine. Deleting .cache/go-build had no effect, other than to change the error output to this -- I haven't been able to find who sets $WORK, but there are no _pkg_.a or _go_.o files on disk:
|
Don't know if it can help, but this problem appeared systematically in one repo with vendor/ directory and so built with -mod vendor + code coverage enabled. Converting it to go.mod (still with code coverage enabled) fixed the problem. |
I'm seeing the same problem here (no problem with Go <= 1.12.x). After the comment from @maxatome I made some tests on our private project.
Didn't try replicating this behavior on an example repo, might try doing so in the following days if time permits. |
I've managed to create a very small repo that reproduces the issue: https://github.com/emiguens/go-cover-fail. After cloning the repo just run $ go test ./... -coverprofile=coverage.out -coverpkg=./... -count=1
? github.com/emiguens/go-cover-fail [no test files]
# github.com/emiguens/go-cover-fail/pkg1.test
2019/09/10 19:27:09 duplicate symbol main.main (types 1 and 1) in main and /Users/emiguens/Library/Caches/go-build/24/24691ab861edac4f0767346c8d02eb886ed269874dacb9e5f27dc53368bb053c-d(_go_.o)
FAIL github.com/emiguens/go-cover-fail/pkg1 [build failed]
# github.com/emiguens/go-cover-fail/pkg2.test
2019/09/10 19:27:09 duplicate symbol main.main (types 1 and 1) in main and /Users/emiguens/Library/Caches/go-build/24/24691ab861edac4f0767346c8d02eb886ed269874dacb9e5f27dc53368bb053c-d(_go_.o)
FAIL github.com/emiguens/go-cover-fail/pkg2 [build failed]
FAIL If I remove the Another scenarios:
All in all it seems to be something related with using a Hope this helps =D |
@gopherbot please open a backport issue for Go 1.13, this looks like a possible regression without a workaround. /cc @bcmills @jayconrod |
Backport issue(s) opened: #34223 (for 1.13). Remember to create the cherry-pick CL(s) as soon as the patch is submitted to master, according to https://golang.org/wiki/MinorReleases. |
I've further reduced the test case, now it fails without having any external dependencies (only using the standard library). Just a main package with a subpackage with one function, so no vendor directory either. After running Just in case, you can see the commit history in the linked project to see how the test case evolved. |
This has the same root cause as #30907, but it affects packages built in GOPATH mode. Previously, I believed this bug only affected build info for modules, so the fix was pretty narrow. I'll send a CL that broadens the fix to cover this case. |
Change https://golang.org/cl/195279 mentions this issue: |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
go test ./... -coverpkg=./...
What did you expect to see?
Tests running OK.
What did you see instead?
2019/09/05 11:57:31 duplicate symbol main.main (types 1 and 1) in main and /Users/rtoledo/Library/Caches/go-build/ee/ee28c25020a2b94486bc9068230305877cfb8f0f08d992d0c5a33faa6bdea84c-d(go.o)
This might be a regression for #32150. Sorry I cannot provide a working example, the bug is kinda esoteric to me and I cannot create a shareable project where this happens.
Edit: How to reproduce
#34114 (comment)
The text was updated successfully, but these errors were encountered: