-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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/link: -X does not work on variables with non-constant default values #37369
Comments
Related to #34675. It looks to me that this is the opposite. We used to forward the static initializer of DEFAULT to STAMP at compile time. But then if a -X flag is set on DEFAULT, it won't affect STAMP as STAMP is statically initialized with the old value. For this reason (i.e. #34675), we stopped forwarding the static initializer. Now STAMP is assigned dynamically (to the value of DEFAULT at that time), so it is not affected by link time modification. This or #34675, it seems to me that we can only choose one, at least without a much more complex logic. |
Perhaps this is a separate feature request, but would it make sense for the linker to emit an error when a |
This is a bit harder. The linker has to understand it is initialized dynamically. I don't think we want the linker to walk the init functions to find out this. |
For future reference, it's better to use the release-blocker label in order to ensure an issue is looked at before a release is made. Issues that are labeled Soon may be missed. The Go 1.14 release has already been made, so I'll remove Soon label, because I understand this is no longer time-sensitive. Please update the issue if that isn't the case. |
This can probably go to Backlog. I was initially worried this was an unintentional regression, but it's the result of #34675. |
I was able to reproduce this as well this caused regression for binaries which relied on -X to add versions, what seems to be new approach it is not clear? |
@harshavardhana Until this issue is fixed, if you need to set a variable with -X, either initialize it with a constant or don't initialize it at all. |
- Remove the usage of Selector in minio, kes & mcs. Selector is supposed to be used internally for filtering pods, so there is no need to use selectors. - Update docker image tags for minio, kes & mcs. - Add access privileges as required for certificates and secrets. - Use go 1.13 till golang/go#37369 is addressed. - Fix openAPIV3Schema for mcs and add kes validation. (fixes #125) Co-authored-by: Daniel Valdivia <hola@danielvaldivia.com> Co-authored-by: Harshavardhana <harsha@minio.io>
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
This is a regression in Go 1.14rc1. It does not reproduce in 1.13.8.
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Run the testscript below:
What did you expect to see?
The program should print
STAMP = pass
, and the test should pass.What did you see instead?
The program prints
STAMP = fail
.This only happens when
STAMP
is assigned to another variable. The test passes ifSTAMP
is assigned the value"fail"
instead ofDEFAULT
.Other thoughts
I've milestoned this Go1.14 and added the Soon label because this is a regression. It should be triaged before the 1.14 release.
I don't know if this was intended to work before. If not, feel free to close.
If it was intended to work, I'm not sure whether this should block 1.14.
The text was updated successfully, but these errors were encountered: