From 101a9c7a7735b84cd3b5de78800fd0ebdfdbe366 Mon Sep 17 00:00:00 2001 From: Loic Nageleisen Date: Tue, 14 Oct 2014 15:21:12 +0200 Subject: [PATCH] better go support --- shell/go | 10 ++++++---- shell/homebrew | 3 +++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/shell/go b/shell/go index a9cc524..0b34b7a 100644 --- a/shell/go +++ b/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 diff --git a/shell/homebrew b/shell/homebrew index 186d967..bdbae83 100755 --- a/shell/homebrew +++ b/shell/homebrew @@ -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