Skip to content

Instantly share code, notes, and snippets.

@rekby
Created June 24, 2015 07:09
Show Gist options
  • Save rekby/87857ccd9215ed0baed4 to your computer and use it in GitHub Desktop.
Save rekby/87857ccd9215ed0baed4 to your computer and use it in GitHub Desktop.
switch gopath in fly (bash script)
#!/bin/bash
CURRENT="$PWD"
while [ `basename $CURRENT` != "src" -a "$CURRENT" != "/" -a -n "$CURRENT" ]; do
CURRENT=`dirname "$CURRENT"`
#echo "'$CURRENT'"
done
if [ `basename "$CURRENT"` == "src" ]; then
export GOPATH=`dirname "$CURRENT"`
fi
if [ "$GOROOT" == "" ]; then
export GOROOT="$HOME/bin/go-1.3.3"
fi
"$GOROOT/bin/go" "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment