-
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
go1.13b1 tool compile -p breaks main packages #33055
Comments
I think -p flag should be honored. (Even in Go 1.12, it is partially honored, e.g. in debug info.) I'm not sure why one would pass -p something-not-main to a main package. cc @jayconrod about bazel. |
Thinking about it, isn't |
No. |
I'm not sure what changed on the compiler / linker side, but from cmd/go, it's important that There are a couple ways that multiple main packages can be linked into a binary. Broad |
In Go 1.13 the compiler honors the -p flag more that before. It uses the -p package path fo symbol names. Before, it is only used in some non-critical places. Ok, -coverpkg is a use case. But it is different in that the "main" packages there are not actually the main package in the executable. And the compiler and the linker are consistent there. So that is fine. Here the compiler sees a non-main package (from -p) whereas it is expected to be linked as the main package. This doesn't work (and should not). I guess we can close this as it is not a bug on the Go side? |
Yeah, I think we can close this. The compiler and linker shouldn't need to do anything differently. The build system (Bazel in this case) should be responsible for setting |
Thanks folks, that was quick ! |
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?
What did you expect to see?
Successful link.
What did you see instead?
Failure to link.
It seems the
-p
package is now honored on files which arepackage main
, which wasn't the case on Go 1.12.This breaks bazel's rules_go on 1.13b1: bazel-contrib/rules_go#2133
The text was updated successfully, but these errors were encountered: