Skip to content

Instantly share code, notes, and snippets.

@jalandis
Created January 15, 2019 23:29
Show Gist options
  • Save jalandis/41aa4a564744ac6788ee86ec32192d29 to your computer and use it in GitHub Desktop.
Save jalandis/41aa4a564744ac6788ee86ec32192d29 to your computer and use it in GitHub Desktop.
Project specific GOPATH
# 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