-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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 with more than one main package in -coverpkg #32150
Comments
CC @jayconrod |
@imsodin I was able to reproduce this with 1.12.5 but not with tip. I believe this was fixed in CL 176558 as a fix for #31946. That's a slightly different bug from #30374. I didn't realize it affected 1.12. I'll need to verify 176558 would actually fix this on 1.12.5. If it does, I'll backport to 1.12. If not, I'll investigate this as a new issue. I'm at a conference right now, so it may take a few days though. |
@imsodin Thanks for reporting this, both here and in #30374. I've confirmed that https://golang.org/cl/176558 fixes the issue when cherry-picked onto 1.12.5. #32295 will track the cherry-pick onto 1.12. |
Change https://golang.org/cl/179677 mentions this issue: |
…uilt as libraries This fixes TestScript/cover_pkgall_multiple_mains, which started failing after CL 174657. When compiling main packages with coverage instrumentation (e.g., for -coverpkg all), we now pass -p with the full import path instead of '-p main'. This avoids link errors 'duplicate symbol main.main (types 1 and 1)'. Fixes #32295 Updates #31946 Updates #32150 Change-Id: Id147527b1dbdc14bb33ac133c30d50c250b4365c Reviewed-on: https://go-review.googlesource.com/c/go/+/176558 Run-TryBot: Jay Conrod <jayconrod@google.com> Reviewed-by: Cherry Zhang <cherryyz@google.com> Reviewed-by: Bryan C. Mills <bcmills@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> (cherry picked from commit 3b8c804) Reviewed-on: https://go-review.googlesource.com/c/go/+/179677
experimenting this issue on circleci with 1.11.5 and 1.11.12 (not on 1.12.7):
strangely enough it happened after adding a new main package, but we still had multiple ones before and never encountered the issue. I'm not sure if 1.11 was also affected and the fix was never backported to 1.11 or it is something else, do I have to open a new ticket? |
@andreasph, the fix was not (and is not planned to be) backported to 1.11. The workaround, if needed, is to upgrade to the latest patch release of 1.12, or wait for 1.13 (scheduled to go out soon) and upgrade to that. |
@bcmills fair enough, we will bump to 1.12.7. just one curiosity: is it somehow a floating behaviour in the affected versions? because we already had multiple main packages but the bug emerged only after adding a new one |
@andreasph This was a subtle bug that had to be fixed and reopened a couple times as more cases were discovered. I believe there were cases where multiple main packages didn't trigger the bug. In any case, all the fixes were backported to 1.12, so it should be resolved there. |
still happens on 1.13.1 when running:
Changing to Removing the coverpkg flag also prevents the issue. Maybe this should be reopen? |
@caarlos0, the fix in 1.13 turned out to be incomplete (didn't cover The fix for GOPATH mode is slated to go out in 1.13.2. In the meantime, please try |
I have been told by @bcmills in #30374 (comment) to create a new issue. This report is essentially the same as #30374 (comment):
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Didn't try.
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Running all tests with
-coverpkg
on all packages and using-coverprofile
like this:What did you expect to see?
No errors.
What did you see instead?
Errors like previously reported in the linked issue:
The same also happens with just
./...
. I cleaned out~/.cache/go-build
for good measure, didn't change anything.To make sure it isn't some weird local problem of mine I also ran it on Syncthing's CI and reproduced the issue there as well: https://build.syncthing.net/viewLog.html?buildId=39242&buildTypeId=Syncthing_Coverage&tab=buildLog
The text was updated successfully, but these errors were encountered: