Open gskll opened 1 year ago
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
@gskll @dobleme Kindly try out this goenv: https://github.com/ankitcharolia/goenv
Describe the bug When I switch between versions the
go env
variables are out of sync. This causes issues when running commands such asgo 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 version In thego 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?