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: documentation doesn't mention GOENV=off #46840

Closed
mdempsky opened this issue Jun 20, 2021 · 4 comments
Closed

cmd/go: documentation doesn't mention GOENV=off #46840

mdempsky opened this issue Jun 20, 2021 · 4 comments
Labels
Documentation NeedsFix
Milestone

Comments

@mdempsky
Copy link
Member

@mdempsky mdempsky commented Jun 20, 2021

The documentation at https://golang.org/cmd/go/#hdr-Environment_variables doesn't mention that GOENV=off is a special case for disabling the use of a Go environment configuration file. It probably should, and maybe to mention GOENV=./off is a workaround if they actually want to use a file named "off" in the current directory.

@mdempsky mdempsky added the NeedsFix label Jun 20, 2021
@ianlancetaylor
Copy link
Contributor

@ianlancetaylor ianlancetaylor commented Jun 22, 2021

Perhaps also worth noting that

GOENV=off go env GOENV

just prints a newline. It does not print off. I can't tell whether this is a bug or not.

@jayconrod jayconrod added this to the Go1.18 milestone Jul 12, 2021
@tpaschalis
Copy link
Contributor

@tpaschalis tpaschalis commented Nov 16, 2021

I think the reason why GOENV=off go env GOENV prints a newline instead of 'off' is that in EnvFile we handle this case by returning an empty string and an error; the empty string is eventually printed out and the error is discarded during the go env invocation.

I'm not the best person to point out if this is a bug or not, but for my 2¢, a) the fact that it returns an empty string is utilized in updateEnvFile, and b) returning off instead of this empty string would be weird (returning both a valid value and an error), so to me, the current implementation feels okay.

I can drop a small documentation CL for this; hopefully it's innocuous enough to fit in this cycle.

@odeke-em
Copy link
Member

@odeke-em odeke-em commented Jan 15, 2022

Please go ahead @tpaschalis with the documentation CL, this issue is meant for Go1.18 :-)

@gopherbot
Copy link

@gopherbot gopherbot commented Jan 28, 2022

Change https://golang.org/cl/381894 mentions this issue: cmd/go: document that GOENV=off disables the default config file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation NeedsFix
Projects
None yet
Development

No branches or pull requests

6 participants