Sets GOENV_ROOT early, exports after finding goenv
parent
d24ab02be5
commit
dc2c9cfd38
|
|
@ -1,21 +1,23 @@
|
||||||
cite about-plugin
|
cite about-plugin
|
||||||
about-plugin 'Init goenv, if installed. Plays nicely with package managers'
|
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
|
# Look for goenv command
|
||||||
if ! _command_exists goenv ; then
|
if ! _command_exists goenv ; then
|
||||||
# Add it to the path if we find it, bail otherwise
|
# Add it to the path if we find it, bail otherwise
|
||||||
if [ -n "${GOENV_ROOT}" ] && [ -x "${GOENV_ROOT}/bin/goenv" ] ; then
|
if [ -n "${GOENV_ROOT}" ] && [ -x "${GOENV_ROOT}/bin/goenv" ] ; then
|
||||||
pathmunge "${GOENV_ROOT}/bin"
|
pathmunge "${GOENV_ROOT}/bin"
|
||||||
elif [ -x "${HOME}/.goenv/bin/goenv" ]; then
|
|
||||||
pathmunge "${HOME}/.goenv/bin"
|
|
||||||
else
|
else
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Use a reasonable default to ensure variable is always present
|
# Since we didn't bail, export the value
|
||||||
# NOTE: This (currently) matches goenv's built-in default
|
export GOENV_ROOT
|
||||||
export GOENV_ROOT="${GOENV_ROOT:-${HOME}/.goenv}"
|
|
||||||
|
|
||||||
# Initialize goenv
|
# Initialize goenv
|
||||||
# NOTE: In the off-chance that goenv has already been initialized,
|
# NOTE: In the off-chance that goenv has already been initialized,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue