-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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: duplicate symbols when including two main packages in -coverpkg in module mode #30374
Comments
I found the same regression just a few days ago, but hadn't filed an issue yet. This is impeding my daily development, and I'd consider it a regression introduced in 1.12. The 1.12 release will be out any day now though, so it's probably more realistic to target a backport to 1.12.1. /cc @bcmills @ianlancetaylor @hyangah since this very likely relates to the recent modinfo changes in the cycle. |
This is almost certainly a bad interaction between #23910, Before the fix for #27584, the error (and redefinition) still existed, but because the variable was initialized in an |
Given that we do not currently merge coverage profiles from multiple processes (#28235), I'm not sure why you would want to include two different The workaround for now is to include at most one |
CC @jayconrod |
Seems very similar to the issues I had when Golang 1.11 came out #23910. I guess I'm just disabling -coverpkg on CI for now. |
Depending on the details of your setup that seems like it might be overkill when you can just remove the conflicting |
Same issue on my end https://travis-ci.org/markus-wa/demoinfocs-golang/jobs/499992529 I see the milestone is 1.13, does that mean it won't be fixed in 1.12.x? |
@bcmills I didn't know this was silently broken in 1.11; thanks for pointing this out. I think temporarily working around the issue for now is acceptable, but perhaps we should provide a simple example or one-liner that people could switch to. |
@mvdan , the one-liner is |
Thanks for the tip! If the bug(s) can be fixed in time for 1.13, then the timing with |
@bcmills but with that set to Am I missing something obvious here?
In my case I have a couple of examples for my lib and each of them has it's own |
Change https://golang.org/cl/164877 mentions this issue: |
I was bitten by the same problem: multiple If you're slightly insane, here's a work around:
|
@sjansen You can also use
I'm still a bit bummed to lose coverage on the examples though 😄. |
I've been doing it like this:
|
@gopherbot, please backport to 1.12. This is a significant regression from GOPATH mode and the fix is straightforward. |
Backport issue(s) opened: #30684 (for 1.12). 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 can still reproduce this in 1.12.1:
(Note: I had to run the |
Reproduced. Trying to narrow it down. It's possible this is a new issue. The |
It might be useful to know that this repo has nested modules. |
Change https://golang.org/cl/168200 mentions this issue: |
@gopherbot Please backport to 1.12. This is a more complete fix for an issue that was supposed to be fixed in 1.12.1. |
For posterity, the second backport issue was created manually: #30937 (for 1.12). |
I am encountering errors on go1.12.5 just like previously reported. $ go version go version go1.12.5 linux/amd64
|
@imsodin, please file a separate issue — there may be a similar bug involving the |
Note that I am not sure if this is a bug or expected behaviour, only that this does not happen in the latest stable 1.11 release and does on 1.12rc1.
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Not the latest stable release (1.11.5)
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
I ran the following command:
go1.12rc1 test -race -v -coverpkg gitlab.com/drakonka/gosnaillife/cmd/snaillifecli,gitlab.com/drakonka/gosnaillife/cmd/snaillifesrv, -coverprofile allcoverage-rc.out ./...
Both of the above are
main
packages producing two binaries.What did you expect to see?
I expected the tests to run and pass, with coverage output, as they do on Go 1.11.5
What did you see instead?
The following error:
2019/02/24 11:39:04 duplicate symbol runtime/debug.modinfo (types 30 and 30) in gitlab.com/drakonka/gosnaillife/cmd/snaillifecli and $WORK/b293/_pkg_.a(_go_.o)
I run Go RC and Go 1.11 side by side as part of my CI, which is how I noticed this issue. I am able to reproduce it locally as well. Full logs for the successful run of Go 1.11 and the failure run of Go 1.12rc1 can be found here:
The text was updated successfully, but these errors were encountered: