Created
January 15, 2019 23:29
-
-
Save jalandis/41aa4a564744ac6788ee86ec32192d29 to your computer and use it in GitHub Desktop.
Project specific GOPATH
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Setup GOPATH for individual projects | |
function go { | |
path="$HOME/go" | |
cdir=$PWD | |
while [ "$cdir" != "/" ]; do | |
if [ -e "$cdir/.gopath" ]; then | |
path="$cdir" | |
break | |
fi | |
cdir=$(dirname "$cdir") | |
done | |
export GOPATH="$path" | |
command go "$@" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment