-
Notifications
You must be signed in to change notification settings - Fork 248
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
DOCS: Confusing config for managing $GOROOT #233
Comments
I have the same thoughts. And for a user with no default Go install these lines result in the PATH containing two extra |
I'm seeing this also I think. I'm using goenv 2.0.2 installed via Homebrew on a Mac with zsh, and the GOPATH and GOROOT env vars are not being updated when switching go versions:
Notice that when I cd into the I have only this at the tail end of my .zshrc:
|
That Now here's what I was thinking at some point as an idea. If you're familiar with Terraform and
Thoughts? |
This may have been fixed in the latest release of goenv. We had a PR that was merged to move goenv's shims to the end of the path definition instead of the beginning. Hope that helps! |
If you have to type a command manually to properly switch go version, then it kinda invalidates this whole project. It needs to be automatic, maybe a lightweight shell function executed from PROMPT_COMMAND? |
I get that, you would want something that detects if the go version is different than the local/global and then re-executes the eval, otherwise it can become expensive. You would also need to auto install if the expected version doesn't exist locally. I would put this behind an env var feature flag, (e.g. GOENV_AUTO_SWITCH) because not everyone necessarily wants this behavior. |
btw. you can also use tenv that support Terraform as well as OpenTofu (and Terragrunt :) ) in one tool. It allow you to simplify version management and can do much more, than tfswitch. |
In ./INSTALL.md, it says:
For
GOPATH
, this makes sense. But on my machine,$GOROOT
is/Users/jrandom/.goenv/versions/1.18.0
. This matches the value ofgoenv global
when the shell was created, but if I change that,$GOROOT
doesn't change, nor does$PATH
. Also, this doesn't respectgoenv local
in any case.What makes this additionally confusing is that goenv works fine despite that. Probably through the inclusion of
/Users/jrandom/.goenv/shims
in the path, the correct versions of go are found and used. But since that works, what is the GOROOT entry doing? Isn't it completely superfluous?I'd appreciate the docs being clarified on this point. And/or changed, if it actually is superfluous and the recommendation is no longer correct.
The text was updated successfully, but these errors were encountered: