From dc2c9cfd3832050c09b22a7f08ffe99cc8d1af5e Mon Sep 17 00:00:00 2001 From: David Farrell Date: Tue, 10 Mar 2020 01:32:41 -0700 Subject: [PATCH] Sets GOENV_ROOT early, exports after finding goenv --- plugins/available/goenv.plugin.bash | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/plugins/available/goenv.plugin.bash b/plugins/available/goenv.plugin.bash index b32b73b9..ae18a441 100644 --- a/plugins/available/goenv.plugin.bash +++ b/plugins/available/goenv.plugin.bash @@ -1,21 +1,23 @@ cite about-plugin about-plugin 'Init goenv, if installed. Plays nicely with package managers' +# Use a reasonable default to ensure variable is always present +# NOTE: This (currently) matches goenv's built-in default +# NOTE: We don't export it yet, since we might still bail +GOENV_ROOT="${GOENV_ROOT:-${HOME}/.goenv}" + # Look for goenv command if ! _command_exists goenv ; then # Add it to the path if we find it, bail otherwise if [ -n "${GOENV_ROOT}" ] && [ -x "${GOENV_ROOT}/bin/goenv" ] ; then pathmunge "${GOENV_ROOT}/bin" - elif [ -x "${HOME}/.goenv/bin/goenv" ]; then - pathmunge "${HOME}/.goenv/bin" else return fi fi -# Use a reasonable default to ensure variable is always present -# NOTE: This (currently) matches goenv's built-in default -export GOENV_ROOT="${GOENV_ROOT:-${HOME}/.goenv}" +# Since we didn't bail, export the value +export GOENV_ROOT # Initialize goenv # NOTE: In the off-chance that goenv has already been initialized,