You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When I switch between versions the go env variables are out of sync.
This causes issues when running commands such as go install or go test
❯ go install github.com/vektra/mockery/v2@v2.20.0
# internal/goarch
compile: version "go1.19.9" does not match go tool version "go1.20.5"
❯ go test ./...
# internal/cpu
compile: version "go1.19.9" does not match go tool version "go1.20.5"
Expected behavior
For the go env variables to all be updated pointing to the current asdf version
In the go env output above the problematic variables are:
GOMODCACHE
GOPATH
GOROOT
GOTOOLDIR
Additional context
❯ asdf version
v0.11.3
❯ fish --version
fish, version 3.6.1
In my config.fish I have
source ~/.asdf/plugins/golang/set-env.fish
set -gx GOROOT (go env GOROOT)
set -gx GOPATH (go env GOPATH)
I get the expected behaviour by adding a line to this to manually update the go env
source ~/.asdf/plugins/golang/set-env.fish
go env -w GOPATH=(asdf where golang)/packages
set -gx GOROOT (go env GOROOT)
set -gx GOPATH (go env GOPATH)
Am I doing something wrong? If not could we extend the set-env functions to update the GOPATH as well as GOROOT?
The text was updated successfully, but these errors were encountered:
I'm a newbie on asdf and go but forcing to export the GOPATH always solved my problem, because I have a specific GOPATH in my .zshrc was not being rewriting it and I couldn't install another gopls version.
I know there is the option file $HOME/.default-golang-pkgs , but I wanted to be able to install things at demand.
I don't know if it's a good idea, I understand there will be people that doesn't want that behavior and always want to install into his original GOPATH. For me, is useful, since I want to be able to use the specific gopls. The only drawback is when I set my system version again, I need to remove the shims in order to use the original GOPATH bin.
Maybe, you know another ways? I don't know if I'm breaking something else.
diff --git a/bin/exec-env b/bin/exec-env
index a363908..2691fd5 100755
--- a/bin/exec-env+++ b/bin/exec-env@@ -5,7 +5,5 @@ if [ "${ASDF_INSTALL_VERSION}" != 'system' ] ; then
export GOROOT=$ASDF_INSTALL_PATH/go
fi
- if [[ "unset" == "${GOPATH:-unset}" ]] ; then- export GOPATH=$ASDF_INSTALL_PATH/packages- fi+ export GOPATH=$ASDF_INSTALL_PATH/packages
fi
Describe the bug
When I switch between versions the
go env
variables are out of sync.This causes issues when running commands such as
go install
orgo test
To Reproduce
Steps to reproduce the behavior:
Expected behavior
For the
go env
variables to all be updated pointing to the current asdf versionIn the
go env
output above the problematic variables are:GOMODCACHE
GOPATH
GOROOT
GOTOOLDIR
Additional context
In my
config.fish
I haveI get the expected behaviour by adding a line to this to manually update the
go env
Am I doing something wrong? If not could we extend the
set-env
functions to update the GOPATH as well as GOROOT?The text was updated successfully, but these errors were encountered: