cmd/link: -X not applied if target is the result of a function call #29897
Labels
Milestone
Comments
I'm not sure if this is a bug or a lack of documentation but I couldn't find anything in If I change |
/cc @ianlancetaylor |
The docs (https://golang.org/cmd/link) say "This is only effective if the variable is declared in the source code either uninitialized or initialized to a constant string expression. -X will not work if the initializer makes a function call or refers to other variables." So while this is unfortunate it's a known and documented limitation. |
Ah, it had not occurred to me to check cmd/link instead. Thanks for the pointer! |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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
What did you do?
go build -o main -ldflags "-X main.Version=2 -X main.Time=3" main.go ./main
What did you expect to see?
What did you see instead?
The text was updated successfully, but these errors were encountered: