From 9f07a48cc15500700926b3837089b00a806087f1 Mon Sep 17 00:00:00 2001 From: Renato Oliveira Date: Tue, 23 May 2023 22:13:26 -0300 Subject: [PATCH] Add dynamic GOROOT setting for fish (#103) --- README.md | 3 +++ set-env.fish | 8 ++++++++ 2 files changed, 11 insertions(+) create mode 100644 set-env.fish diff --git a/README.md b/README.md index 3980cd9..9ebba10 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/set-env.fish b/set-env.fish new file mode 100644 index 0000000..2a9782b --- /dev/null +++ b/set-env.fish @@ -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 \ No newline at end of file