diff --git a/gopath/.gitignore b/gopath/.gitignore new file mode 100644 index 00000000..882d4499 --- /dev/null +++ b/gopath/.gitignore @@ -0,0 +1,2 @@ +bin/ +pkg/ diff --git a/gopath/src b/gopath/src new file mode 120000 index 00000000..9c39cc9f --- /dev/null +++ b/gopath/src @@ -0,0 +1 @@ +../vendor \ No newline at end of file diff --git a/misc/go b/misc/go new file mode 100755 index 00000000..7e612698 --- /dev/null +++ b/misc/go @@ -0,0 +1,12 @@ +#!/bin/bash +# hack around stupid $GOPATH semantics, with ~/bin/go helper +# thanks to Nilium in #go-nuts for 1/3 of the idea +[ -z "$GOPATH" ] && echo '$GOPATH is not set!' && exit 1 +GO="$(which -a go | sed -e '2q;d')" # TODO: pick /usr/bin/go in a better way +# the idea is to have $project/gopath/src/ be a symlink to ../vendor but you put +# all of your vendored things in vendor/ but with this gopath can be per project +if [ -d "$PWD/vendor/" ] && [ -d "$PWD/gopath/" ] && [ "`readlink $PWD/gopath/src`" = "../vendor" ] ; then + GOPATH="$PWD/gopath/:$GOPATH" $GO "$@" +else + $GO "$@" +fi