mirror of
https://github.com/lloeki/dotfiles.git
synced 2025-12-06 07:24:39 +01:00
better go support
This commit is contained in:
parent
c393dca551
commit
101a9c7a77
2 changed files with 9 additions and 4 deletions
10
shell/go
10
shell/go
|
|
@ -1,4 +1,4 @@
|
|||
go_commands=(go)
|
||||
go_commands=(go vim)
|
||||
|
||||
_go-installed() {
|
||||
which go > /dev/null 2>&1
|
||||
|
|
@ -21,13 +21,13 @@ _within-go-project() {
|
|||
_run-with-gopath() {
|
||||
local go_path
|
||||
if _go-installed && go_path=$(_within-go-project); then
|
||||
GOPATH="$go_path" $@
|
||||
env PATH="$PATH:$go_path/bin" GOPATH="$go_path" "$@"
|
||||
else
|
||||
$@
|
||||
"$@"
|
||||
fi
|
||||
}
|
||||
|
||||
for cmd in ${go_commands[@]}; do
|
||||
for cmd in "${go_commands[@]}"; do
|
||||
eval "function gopath_$cmd () { _run-with-gopath $cmd \$@; }"
|
||||
alias $cmd=gopath_$cmd
|
||||
|
||||
|
|
@ -37,3 +37,5 @@ for cmd in ${go_commands[@]}; do
|
|||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
# vim: ft=sh
|
||||
|
|
|
|||
|
|
@ -6,6 +6,9 @@ NODE_PATH=/usr/local/lib/node
|
|||
export NODE_PATH
|
||||
PATH=$PATH:/usr/local/share/npm/bin
|
||||
|
||||
# go
|
||||
PATH=$PATH:/usr/local/opt/go/libexec/bin
|
||||
|
||||
# no emoji
|
||||
HOMEBREW_NO_EMOJI="you bet"
|
||||
export HOMEBREW_NO_EMOJI
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue