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

proposal: cmd/go: change default $GOPATH to $XDG_CACHE_HOME/go when modules are enabled by default #26549

Closed
nhooyr opened this issue Jul 23, 2018 · 4 comments

Comments

Projects
None yet
5 participants
@nhooyr
Copy link
Contributor

commented Jul 23, 2018

At the moment, the default $GOPATH is ~/go which is fine given how $GOPATH is frequently accessed by the user because it holds the source of all their go code.

However, with vgo, it isn't necessary for a user to head into $GOPATH often because its only going to store the cache of their dependencies. Thus it shouldn't clutter their home directory. $GOPATH should instead go into $XDG_CACHE_HOME/go. $XDG_CACHE_HOME is the standard directory for user related cached data. See https://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html

This will ensure it doesn't clutter a user's home directory unless they want it to as $XDG_CACHE_HOME defaults to ~/.cache.

@gopherbot gopherbot added this to the Proposal milestone Jul 23, 2018

@gopherbot gopherbot added the Proposal label Jul 23, 2018

@bcmills bcmills changed the title proposal: change default $GOPATH to $XDG_CACHE_HOME/go when vgo becomes default proposal: change default $GOPATH to $XDG_CACHE_HOME/go when modules are enabled by default Jul 23, 2018

@bcmills bcmills changed the title proposal: change default $GOPATH to $XDG_CACHE_HOME/go when modules are enabled by default proposal: cmd/go change default $GOPATH to $XDG_CACHE_HOME/go when modules are enabled by default Jul 23, 2018

@bcmills bcmills changed the title proposal: cmd/go change default $GOPATH to $XDG_CACHE_HOME/go when modules are enabled by default proposal: cmd/go: change default $GOPATH to $XDG_CACHE_HOME/go when modules are enabled by default Jul 23, 2018

@bcmills bcmills added the modules label Jul 23, 2018

@bcmills

This comment has been minimized.

Copy link
Member

commented Jul 23, 2018

XDG_CACHE_HOME is explicitly for “non-essential” data, but the module cache is kind of a grey area: it might not be possible in general for a user to re-download missing module source at any given time (for example, if they are working on a laptop disconnected from the network), but Go builds should continue to work unless the user takes some explicit step to clean them up.

@nhooyr

This comment has been minimized.

Copy link
Contributor Author

commented Jul 23, 2018

I agree, lets change this proposal to make the default $GOPATH $XDG_DATA_HOME/go because $XDG_DATA_HOME is for user specific essential data. It'll be safer like you said.

@rsc

This comment has been minimized.

Copy link
Contributor

commented Jul 23, 2018

The default GOPATH is already set. Let's not change it. I don't want to see my files in $HOME/.local/share.

@rsc rsc closed this Jul 23, 2018

@ELLIOTTCABLE

This comment has been minimized.

Copy link

commented Aug 3, 2018

👍 here; at least on macOS, having additional directories cluttering up ~/ is non-idiomatic (and honestly, quite annoying.) This is a horrible default; something based on $XDG_DATA_HOME (and thus, by default, something in a hidden-by-default dot-directory) is much more end-user friendly.

I'd love to see this reopened!

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