asdf-golang icon indicating copy to clipboard operation
asdf-golang copied to clipboard

set-env.bash ?

Open asmodehn opened this issue 1 year ago • 2 comments

I am using bash but there isnt any set-env script for it ? Any specific reason for it ?

I could write a simple one, but I'm not sure how it is supposed to support the various possible setups (go installed on system via distro packages for instance)...

asmodehn avatar May 23 '24 14:05 asmodehn

F.Y.I (workaround)

I'm using the following lines in my .bashrc:

asdf_update_golang_env() {
  local go_bin_path
  go_bin_path="$(asdf which go 2>/dev/null)"
  if [[ -n "${go_bin_path}" ]]; then
    abs_go_bin_path="$(readlink -f "${go_bin_path}")"

    export GOROOT
    GOROOT="$(dirname "$(dirname "${abs_go_bin_path}")")"

    export GOPATH
    GOPATH="$(dirname "${GOROOT}")/packages"

    export GOBIN
    GOBIN="$(dirname "${GOROOT}")/bin"
  fi
}
asdf_update_golang_env

ikuwow avatar Jul 10 '24 03:07 ikuwow

This should SO be in the Readme

LionyxML avatar Aug 09 '24 16:08 LionyxML

This should become set-env.bash!

samusz avatar Sep 19 '24 23:09 samusz

Thanks for 👍 and ❤️ I created pr #147

ikuwow avatar Sep 20 '24 03:09 ikuwow