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: distinguish between cmd/go variables and runtime variables in 'go help environment' #37004

Open
perillo opened this issue Feb 3, 2020 · 2 comments

Comments

@perillo
Copy link

@perillo perillo commented Feb 3, 2020

I'm not sure if this an issue with go env or with go help environment, but the latter mentions the GODEBUG variable in the first section General purpose environment variables.

However go env -w GODEBUG=gctrace=1 returns an error.

Since, as far as I know, GODEBUG is not used by the go command, go help environment is probably wrong and GODEBUG should be removed.

It may be better, however, to move GODEBUG and the other runtime environment variable in a new section Runtime specific environment variables with the other variables GOGC, GOMAXPROCS, GORACE and GOTRACEBACK.

@bcmills

This comment has been minimized.

Copy link
Member

@bcmills bcmills commented Feb 4, 2020

This is an issue with go help environment. The documentation there currently does not distinguish between “environment variables processed by the go command” and “environment variables processed by programs built by the go command”, and it arguably should.

@bcmills bcmills added the NeedsFix label Feb 4, 2020
@bcmills bcmills added this to the Backlog milestone Feb 4, 2020
@bcmills bcmills changed the title cmd/go: go env does not recognize runtime environment variables cmd/go: distinguish between cmd/go variables and runtime variables in 'go help environment' Feb 4, 2020
@perillo

This comment has been minimized.

Copy link
Author

@perillo perillo commented Feb 4, 2020

I have compared the variables listed in go help environment with KnowEnv in internal/cfg/cfg.go.

All the environment variables listed in go help environment are in KnowEnv, with the exception of GODEBUG and the variables listed in the section Special-purpose environment variables.

On the other hand, GOMOD is not listed in KnowEnv and GO111MODULE is not listed in go help environment.

There are 50 variables in KnowEnv and 49 variables in go help environment (excluding the special-purpose environment variables.

I think the Special-purpose section should remain, and a new section should be added to document the runtime environment variables.
In alternative, go help environment should add a note to see go doc runtime for additional environment variables.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.