Skip to content
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/go: go env does not show GODEBUG #65777

Closed
mvdan opened this issue Feb 18, 2024 · 7 comments
Closed

cmd/go: go env does not show GODEBUG #65777

mvdan opened this issue Feb 18, 2024 · 7 comments
Labels
GoCommand cmd/go NeedsFix The path to resolution is known, but the work has not been done. release-blocker
Milestone

Comments

@mvdan
Copy link
Member

mvdan commented Feb 18, 2024

Go version

go version devel go1.23-86a32d6d9c 2024-02-17 06:03:15 +0000 linux/amd64

Output of go env in your module/workspace:

GO111MODULE=''
GOARCH='amd64'
GOBIN=''
GOCACHE='/home/mvdan/.cache/go-build'
GOENV='/home/mvdan/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/home/mvdan/go/pkg/mod'
GONOPROXY='github.com/cue-unity'
GONOSUMDB='github.com/cue-unity'
GOOS='linux'
GOPATH='/home/mvdan/go'
GOPRIVATE='github.com/cue-unity'
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/home/mvdan/tip'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/home/mvdan/tip/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='devel go1.23-86a32d6d9c 2024-02-17 06:03:15 +0000'
GCCGO='gccgo'
GOAMD64='v3'
AR='ar'
CC='gcc'
CXX='g++'
CGO_ENABLED='1'
GOMOD='/dev/null'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build1777333942=/tmp/go-build -gno-record-gcc-switches'

What did you do?

Set GODEBUG and expect go env or go env GODEBUG to show me. Particularly now that its value can change the behavior of the standard library, e.g. GODEBUG=gotypesalias=1.

What did you see happen?

$ export GODEBUG=gotypesalias=1
$ go env | grep GODEBUG
$ go env GODEBUG

$ 

What did you expect to see?

$ export GODEBUG=gotypesalias=1
$ go env | grep GODEBUG
GODEBUG=gotypesalias=1
$ go env GODEBUG
gotypesalias=1
$ 
@mvdan
Copy link
Member Author

mvdan commented Feb 18, 2024

cc @bcmills @matloob

@gopherbot
Copy link

Change https://go.dev/cl/565095 mentions this issue: cmd/go/internal/envcmd, internal/cfg: show GODEBUG for command 'go env'

@seankhliao seankhliao added NeedsFix The path to resolution is known, but the work has not been done. GoCommand cmd/go labels Feb 18, 2024
@bcmills bcmills added this to the Go1.23 milestone Feb 20, 2024
@bcmills
Copy link
Contributor

bcmills commented Feb 20, 2024

I think this was an oversight from #56986, which made GODEBUG much more prominent (and gave it quite a bit more official support).

@gopherbot
Copy link

Change https://go.dev/cl/566097 mentions this issue: cmd/go/internal/envcmd: show GODEBUG in 'go env' output

@rsc
Copy link
Contributor

rsc commented Mar 1, 2024

It seems like go env should support printing GODEBUG, since it is relevant to debugging problems with go generally. But since GODEBUG is a runtime setting, not a build-time setting, go env -w GODEBUG=foo should not work, since it would be writing the setting into a file the runtime does not read. (Nor should every Go program read that file on startup.)

@mvdan
Copy link
Member Author

mvdan commented Mar 1, 2024

That makes sense to me. Thanks for the fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
GoCommand cmd/go NeedsFix The path to resolution is known, but the work has not been done. release-blocker
Projects
None yet
5 participants