Skip to content
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

set-env.bash ? #138

Closed
asmodehn opened this issue May 23, 2024 · 4 comments · Fixed by #147
Closed

set-env.bash ? #138

asmodehn opened this issue May 23, 2024 · 4 comments · Fixed by #147

Comments

@asmodehn
Copy link

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)...

@ikuwow
Copy link
Contributor

ikuwow commented Jul 10, 2024

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

@LionyxML
Copy link

LionyxML commented Aug 9, 2024

This should SO be in the Readme

@samusz
Copy link

samusz commented Sep 19, 2024

This should become set-env.bash!

@ikuwow
Copy link
Contributor

ikuwow commented Sep 20, 2024

Thanks for 👍 and ❤️
I created pr #147

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

4 participants