ensure go and goenv play well together
parent
4365fa8d69
commit
a683039a72
|
|
@ -9,5 +9,5 @@
|
|||
# gocomplete -install
|
||||
|
||||
if _command_exists gocomplete && _command_exists go ; then
|
||||
complete -C "${GOBIN}"/gocomplete go
|
||||
complete -C gocomplete go
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -0,0 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
if _command_exists goenv && [[ -r "$GOENV_ROOT/completions/goenv.bash" ]] ; then
|
||||
source "$GOENV_ROOT/completions/goenv.bash"
|
||||
fi
|
||||
|
|
@ -1,9 +1,14 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
cite about-plugin
|
||||
about-plugin 'go environment variables & path configuration'
|
||||
|
||||
command -v go &>/dev/null || return
|
||||
# Load late to ensure goenv runs first, if enabled
|
||||
# BASH_IT_LOAD_PRIORITY: 275
|
||||
|
||||
_command_exists go || return 0
|
||||
|
||||
# If using goenv, make sure it can find go
|
||||
go version &>/dev/null
|
||||
[[ $? -eq 0 ]] || return 0
|
||||
|
||||
function _go_pathmunge_wrap() {
|
||||
IFS=':' local -a 'a=($1)'
|
||||
|
|
|
|||
|
|
@ -8,13 +8,15 @@ about-plugin 'load goenv, if you are using it'
|
|||
_command_exists goenv ||
|
||||
[[ -n "$GOENV_ROOT" && -x "$GOENV_ROOT/bin/goenv" ]] ||
|
||||
[[ -x "$HOME/.goenv/bin/goenv" ]] ||
|
||||
return
|
||||
return 0
|
||||
|
||||
# Set GOENV_ROOT, if not already set
|
||||
export GOENV_ROOT="${GOENV_ROOT:-$HOME/.goenv}"
|
||||
|
||||
# Add GOENV_ROOT/bin to PATH, if that's where it's installed
|
||||
! _command_exists goenv && [[ -x "$GOENV_ROOT/bin/goenv" ]] && pathmunge "$GOENV_ROOT/bin"
|
||||
if ! _command_exists goenv && [[ -x "$GOENV_ROOT/bin/goenv" ]] ; then
|
||||
pathmunge "$GOENV_ROOT/bin"
|
||||
fi
|
||||
|
||||
# Initialize goenv
|
||||
eval "$(goenv init - bash)"
|
||||
|
|
|
|||
Loading…
Reference in New Issue