Skip to content

Instantly share code, notes, and snippets.

@saml
Created July 29, 2015 18:54
Show Gist options
  • Select an option

  • Save saml/32416edc86d2861e0db1 to your computer and use it in GitHub Desktop.

Select an option

Save saml/32416edc86d2861e0db1 to your computer and use it in GitHub Desktop.
#!/bin/bash
if [[ -z ${ORIGINALGOPATH+x} ]]
then
ORIGINALGOPATH="$GOPATH"
GOPATH="$(pwd):$ORIGINALGOPATH"
echo "Activating..."
echo "GOPATH = $GOPATH"
deactivate() {
export GOPATH="$ORIGINALGOPATH"
echo "Deactivating..."
echo "GOPATH = $GOPATH"
unset -v ORIGINALGOPATH
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