g icon indicating copy to clipboard operation
g copied to clipboard

Support go env as fallback for setting GOPATH and GOROOT in env

Open avorima opened this issue 3 years ago • 1 comments

Sorry, I opened a PR without reading the contributing guidelines.

I'm proposing to support using go env as fallback for explicitly setting GOPATH and GOROOT. Go will read those values from a config file, e.g. ~/.config/go/env`, and thus setting them in the environment is not required.

avorima avatar Dec 21 '21 14:12 avorima

Hi @avorima I was reviewing your PR, but I need to understand the use-case first.

This would be to drop the g file somewhere in your path and have it rely on a previous golang installation?

If that's the case, I'm concerned it would require root rights, as most golang installations (from package managers, official golang guides, etc) use system paths like /usr/local. Also if a user follows the proposed "Manual Installation" guide and has go1.12 installed from their package manager, go env -w would fail confusing the user. Alongside to have to run g with sudo every time.

I generally advise against using g with previous golang installations, but g could support this use-case unofficially.

stefanmaric avatar Mar 13 '22 13:03 stefanmaric

Closing because of lack of response. Feel free to re-open if still interested.

stefanmaric avatar Jan 18 '23 16:01 stefanmaric