mirror of
https://github.com/kennyp/asdf-golang.git
synced 2024-10-05 20:22:06 +08:00
parent
159af6218b
commit
d4f1d65d59
@ -39,6 +39,10 @@ To set `GOROOT` in your shell's initialization add the following:
|
|||||||
Add this to your env.nu
|
Add this to your env.nu
|
||||||
`source ('~/.asdf/plugins/golang/set-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`
|
## 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.
|
After using `go get` or `go install` to install a package you need to run `asdf reshim golang` to get any new shims.
|
||||||
|
17
set-env.bash
Normal file
17
set-env.bash
Normal file
@ -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
|
Loading…
Reference in New Issue
Block a user