cmd/link: failed to set variable at build time if variable value is result from method call #26042
Comments
I think that fixing this would require a completely different and less efficient approach to the implementation of the linker's |
@ianlancetaylor Can you please explain more details about current implementation? Or just give me link to linker code which cause this problem. |
Every global variable has memory allocated in the data section of the program. The contents of the data section are set to the initial value of the variable. For a variable initialized with a function call, the variable's value is set by an initialization function. The The implementation of |
@ianlancetaylor Thanks. I went through those codes already but don't fully understand them. /me will send the CL this morning |
Change https://golang.org/cl/120935 mentions this issue: |
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?go version go1.10.3 linux/amd64
Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (
go env
)?What did you do?
https://play.golang.org/p/M9xGmognyrl
run as:
What did you expect to see?
What did you see instead?
The text was updated successfully, but these errors were encountered: