Skip to content

Commit

Permalink
Create set-env.bash (#147)
Browse files Browse the repository at this point in the history
* Create set-env.bash
* Update README.md
  • Loading branch information
ikuwow authored Sep 25, 2024
1 parent 159af62 commit d4f1d65
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ To set `GOROOT` in your shell's initialization add the following:
Add this to your env.nu
`source ('~/.asdf/plugins/golang/set-env.nu')`

**bash shell**
Add this to your .bashrc:
`. ~/.asdf/plugins/golang/set-env.bash`

## When using `go get` or `go install`

After using `go get` or `go install` to install a package you need to run `asdf reshim golang` to get any new shims.
Expand Down
17 changes: 17 additions & 0 deletions set-env.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
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

0 comments on commit d4f1d65

Please sign in to comment.
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy