Last active
September 5, 2016 14:41
-
-
Save olebedev/8328941 to your computer and use it in GitHub Desktop.
This file contains 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
MAIN_GOPATH=/usr/local/Cellar/go/1.2/workspace | |
export GOPATH=$MAIN_GOPATH | |
MAIN_PATH=$PATH:$GOPATH/bin | |
export PATH=$MAIN_PATH | |
# goenv functions | |
activate(){ | |
export GOPATH="$(cd "$(dirname "${BASH_SOURCE[0]}" )" && pwd)" | |
export OLDPS1=$PS1 | |
export PS1="(go:$(basename $GOPATH)) $PS1" | |
mkdir -p $GOPATH/bin | |
mkdir -p $GOPATH/pkg | |
mkdir -p $GOPATH/src/$(basename $GOPATH) | |
export PATH=$GOPATH/bin:$PATH | |
alias gcd="cd $GOPATH/src/$(basename $GOPATH)" | |
deactivate() { | |
echo "Goodbye! =)" | |
cd $GOPATH | |
echo "Now, you in \`$(pwd)\` directory." | |
export PS1=$OLDPS1 | |
export GOPATH=$MAIN_GOPATH | |
export PATH=$MAIN_PATH | |
unset OLDPS1 | |
unalias gcd | |
unset deactivate | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment