-
Notifications
You must be signed in to change notification settings - Fork 18k
cmd/go: env -changed misses CGO_LDFLAGS, others #69994
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
Comments
Thanks report. |
Change https://go.dev/cl/621995 mentions this issue: |
Change https://go.dev/cl/621996 mentions this issue: |
Change https://go.dev/cl/621997 mentions this issue: |
Thanks again for your report, I rechecked the implementation. |
For #69994 Change-Id: I7db39074f6a055efb29c1cbd0db4c286864a5da6 Reviewed-on: https://go-review.googlesource.com/c/go/+/621996 LUCI-TryBot-Result: Go LUCI <[email protected]> Reviewed-by: bcd a <[email protected]> Reviewed-by: Sam Thanawalla <[email protected]> Reviewed-by: Carlos Amedee <[email protected]> Auto-Submit: Sam Thanawalla <[email protected]>
When other environment variables are set to default values, we will not print it in go env -changed, GOCACHE should do the same. For #69994 Change-Id: I16661803cf1f56dd132b4db1c2d5cb4823fc0e58 Reviewed-on: https://go-review.googlesource.com/c/go/+/621997 Reviewed-by: Sean Liao <[email protected]> Auto-Submit: Sean Liao <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]> Reviewed-by: Michael Matloob <[email protected]> Reviewed-by: Dmitri Shuralyov <[email protected]>
The default value is the value obtained when no environment variables are set and go env -w is not used. In the past, we used the current value (may be modified by an environment variable to a non-default value), error was used as the default value. For #69994 Change-Id: Iead3a6cacd04dc51a094ffb9f7bb7553320fcd78 Reviewed-on: https://go-review.googlesource.com/c/go/+/621995 Reviewed-by: Michael Matloob <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]> Reviewed-by: Michael Matloob <[email protected]> Reviewed-by: Cherry Mui <[email protected]>
Change https://go.dev/cl/671635 mentions this issue: |
Go version
go version go1.23.2 darwin/arm64
Output of
go env
in your module/workspace:What did you do?
Change the default value of
CGO_LDFLAGS
:Then check what values have changed:
What did you see happen?
No output
What did you expect to see?
I expected the output to be:
When most env variables are overridden in this way, they correctly show up in the output. Since
CGO_LDFLAGS
is one of the values that shows up in the output ofgo env
without any flags, I would also expect it to be reflected withgo env -changed
when the value was non-default.I have tested this with a few other cases and found inconsistent results, including:
CGO_ENABLED
,GOPATH
,GOPRIVATE
, andCGO_CFLAGS
are respectedCGO_LDFLAGS
andGCCGO
are not respected. It might literally be just these two, but I only tested a handfulgo env -changed
does not seem to report a value if the corresponding environment variable is exported. To reproduce:I could not find anything in the original proposal (#34208) or in the docs (
go help env
) that would suggest why this would be the expected behavior.The text was updated successfully, but these errors were encountered: