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: improve 'missing $GOPATH' error message when HOME is unset #29341

Open
bitfield opened this issue Dec 19, 2018 · 1 comment

Comments

@bitfield
Copy link

@bitfield bitfield commented Dec 19, 2018

With reference to #24064, this is a common occurrence when trying to automate the installation of Go programs with tools such as Puppet. System commands are run in an initially empty environment, so a command like:

GO111MODULE=on go get github.com/bitfield/cronrun/cmd/cronrun@v0.3.2

fails with this error:

missing $GOPATH

But this works fine in a 'normal' interactive environment, because GOPATH is inferred from the value of $HOME. What's missing here is not $GOPATH, per se, but $HOME.

Maybe this error message could be improved, along the lines of:

GOPATH not set; unable to default to '$HOME/go' because HOME is not set either. Please set either GOPATH or HOME.

@bcmills bcmills added this to the Go1.13 milestone Dec 19, 2018
@ALTree ALTree changed the title Improve 'missing $GOPATH' error message when HOME is unset cmd/go: improve 'missing $GOPATH' error message when HOME is unset Dec 19, 2018
@bcmills bcmills modified the milestones: Go1.13, Go1.12 Dec 19, 2018
@gopherbot

This comment has been minimized.

Copy link

@gopherbot gopherbot commented Jan 17, 2019

Change https://golang.org/cl/158257 mentions this issue: cmd/go/internal/modload: improve error message when $HOME is unset

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.