Add dynamic GOROOT setting for fish (#103)

This commit is contained in:
Renato Oliveira 2023-05-23 22:13:26 -03:00 committed by GitHub
parent 3c3674a10c
commit 9f07a48cc1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 0 deletions

View File

@ -32,6 +32,9 @@ To set `GOROOT` in your shell's initialization add the following:
**zsh shell**
`. ~/.asdf/plugins/golang/set-env.zsh`
**fish shell**
`. ~/.asdf/plugins/golang/set-env.fish`
## 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.

8
set-env.fish Normal file
View File

@ -0,0 +1,8 @@
function asdf_update_golang_env --on-event fish_prompt
set --local go_path (asdf which go)
if test -n "$go_path"
set --local full_path (builtin realpath "$go_path")
set -gx GOROOT (dirname (dirname "$full_path"))
end
end