Created
October 7, 2015 14:56
-
-
Save saml/90ed8b4a61aae3168353 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
#!/bin/bash | |
if [[ -z ${ORIGINALGOPATH+x} ]] | |
then | |
ORIGINALGOPATH="$GOPATH" | |
ORIGINALPS1="$PS1" | |
GOPATH="${PWD}/vendor:${PWD}:$ORIGINALGOPATH" | |
PROJDIR="${PWD##*/}" | |
PS1="${ORIGINALPS1}GO($PROJDIR)> " | |
echo "Activating..." | |
echo "GOPATH = $GOPATH" | |
deactivate() { | |
export GOPATH="$ORIGINALGOPATH" | |
export PS1="$ORIGINALPS1" | |
echo "Deactivating..." | |
echo "GOPATH = $GOPATH" | |
unset -v ORIGINALGOPATH | |
unset -v ORIGINALPS1 | |
unset -f deactivate | |
} | |
else | |
echo "Already activated. You may deactivate" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment