Merge pull request #1243 from ezchi/get-default-go-environment-variables-with-go-binary
Use go binary to get default GOROOT and GOPATH
This commit is contained in:
4
plugins/available/go.plugin.bash
Normal file → Executable file
4
plugins/available/go.plugin.bash
Normal file → Executable file
@@ -5,7 +5,7 @@ about-plugin 'go environment variables & path configuration'
|
||||
|
||||
[ ! command -v go &>/dev/null ] && return
|
||||
|
||||
export GOROOT=${GOROOT:-$(go env | grep GOROOT | cut -d'"' -f2)}
|
||||
export GOROOT=${GOROOT:-$(go env GOROOT)}
|
||||
pathmunge "${GOROOT}/bin"
|
||||
export GOPATH=${GOPATH:-"$HOME/go"}
|
||||
export GOPATH=${GOPATH:-$(go env GOPATH)}
|
||||
pathmunge "${GOPATH}/bin"
|
||||
|
||||
Reference in New Issue
Block a user