From 8c5581a52b2b8a91b3874800fd3e020ce32c2f49 Mon Sep 17 00:00:00 2001 From: David Farrell Date: Tue, 10 Mar 2020 01:58:07 -0700 Subject: [PATCH] Simply pathmunge / bail logic --- plugins/available/goenv.plugin.bash | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/plugins/available/goenv.plugin.bash b/plugins/available/goenv.plugin.bash index ae18a441..07e11f80 100644 --- a/plugins/available/goenv.plugin.bash +++ b/plugins/available/goenv.plugin.bash @@ -6,20 +6,18 @@ about-plugin 'Init goenv, if installed. Plays nicely with package managers' # 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" - else - return - fi +# Look for goenv command, adding to path if needbe +if ! _command_exists goenv && [ -n "${GOENV_ROOT}" ] && [ -x "${GOENV_ROOT}/bin/goenv" ] ; then + pathmunge "${GOENV_ROOT}/bin" fi -# Since we didn't bail, export the value -export GOENV_ROOT +# If we found the command, we're good to go +if _command_exists goenv ; then + # Now its safe to export the value + export GOENV_ROOT -# Initialize goenv -# NOTE: In the off-chance that goenv has already been initialized, -# it should be safe to re-initialize -eval "$(goenv init - bash)" + # Initialize goenv + # NOTE: In the off-chance that goenv has already been initialized, + # it should be safe to re-initialize + eval "$(goenv init - bash)" +fi