File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -43,10 +43,11 @@ To ensure the Golang environment variables are correctly set when using the `asd
4343 source (echo $ASDF_DATA_DIR | if test -z $it; echo $HOME/.asdf; else echo $it; end)/plugins/golang/set-env.fish
4444 ```
4545
46- - ** Nushell (` env .nu` ):**
46+ - ** Nushell (` config .nu` ):**
4747
4848 ``` nu
49- source (if ($env.ASDF_DATA_DIR | empty?) { echo $nu.env.HOME/.asdf } { echo $env.ASDF_DATA_DIR })/plugins/golang/set-env.nu
49+ const asdf_data_dir = '~/.asdf' | path expand # this variable should be already set in your configuration as it is used to configure asdf itself
50+ source ([$asdf_data_dir plugins golang set-env.nu] | path join)
5051 ```
5152
5253## When using ` go get ` or ` go install `
Original file line number Diff line number Diff line change 1- $env . GOROOT = (asdf which go | path split | drop 2 | path join)
1+ def --env asdf-update-golang-env [] {
2+ let go_path = asdf which go | complete
3+ if $go_path.exit_code == 0 {
4+ let root = ($go_path.stdout | str trim | path split | drop 2 | path join )
5+ if $root != $env .GOROOT ? {
6+ $env .GOROOT = $root
7+ $env .GOPATH = ($root | path dirname | path join packages )
8+ $env .GOBIN = ($root | path dirname | path join bin )
9+ }
10+ }
11+ }
12+
13+ asdf-update-golang-env
14+
15+ $env .config.hooks.env_change.PWD = (
16+ $env .config.hooks.env_change | get - o PWD | default [] | append {|| asdf-update-golang-env }
17+ )
You can’t perform that action at this time.
0 commit comments