diff --git a/README.md b/README.md index 2330d10..c9bcff6 100644 --- a/README.md +++ b/README.md @@ -78,6 +78,14 @@ verifying checksum checksum verified ``` +## `GOROOT` and `GOPATH` Overrides + +By default, `$GOROOT` and `$GOPATH` are set to the selected version's +`.../go` and `.../packages` dirs, and unset if the selected version is +`system`. Set the `$ASDF_GOLANG_DISABLE_GOROOT` and/or +`$ASDF_GOLANG_DISABLE_GOPATH` environment variables to `1` to disable +this behavior for the respective variables. + ## Contributing Feel free to create an issue or pull request if you find a bug. diff --git a/bin/exec-env b/bin/exec-env index 093d7d0..7ff1c06 100755 --- a/bin/exec-env +++ b/bin/exec-env @@ -1,8 +1,11 @@ #!/usr/bin/env bash if [ "${ASDF_INSTALL_VERSION}" = 'system' ] ; then - unset -v GOROOT GOPATH + [ "${ASDF_GOLANG_DISABLE_GOROOT-}" = '1' ] || unset -v GOROOT + [ "${ASDF_GOLANG_DISABLE_GOPATH-}" = '1' ] || unset -v GOPATH else - export GOROOT=$ASDF_INSTALL_PATH/go - export GOPATH=$ASDF_INSTALL_PATH/packages + [ "${ASDF_GOLANG_DISABLE_GOROOT-}" = '1' ] || + export GOROOT=$ASDF_INSTALL_PATH/go + [ "${ASDF_GOLANG_DISABLE_GOPATH-}" = '1' ] || + export GOPATH=$ASDF_INSTALL_PATH/packages fi