cmd/link: linker gives misleading advice on new -ldflags option when option contains spaces #12338
Labels
Milestone
Comments
@ae6rt Thanks for figuring out the proper quoting. Having warnings of each flag for all 30 go binaries being built on our CI box was a bit verbose. |
Thanks to Ian Taylor for responding to a user on go-nuts list. That's where I found the solution, and wanted to capture it here for a fix for posterity. |
It's not possible to guess what quoting you need. The linker doesn't know. We could make the message less specific by saying
but that's much less helpful. At least with the specifics you can try to grep for the name or value to find where it came from. |
The quoting issue makes changing the error difficult. I propose we do nothing about this for Go 1.6 and then remove the old format entirely in Go 1.7. Then the warning will be gone too. |
This was referenced Feb 17, 2016
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I am migrating from Go 1.4 to Go 1.5. When I build my app, the compiler emits a warning that my -ldflags syntax is likely to be deprecated, and offers a misleading suggestion to correct the warning. My use case is a -X -ldflags value that contains spaces.
If I take a variant of the warning advice, I get
Fiddling around with the quotes, I find this invocation works, which the warning did not help me arrive at:
The text was updated successfully, but these errors were encountered: