Last active
August 29, 2015 14:01
-
-
Save dimfeld/8721fe9cb8145184e797 to your computer and use it in GitHub Desktop.
Bash function to easily set the GOPATH from any subdirectory thereof.
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
# Embed this function inside your .bashrc or equivalent. | |
function setgopath() { | |
# Assume we're in the src directory, and strip off src and everything after it. | |
DIR=${PWD/src*/} | |
if [ -d "$DIR/src" -a -d "$DIR/bin" -a -d "$DIR/pkg" ]; then | |
export GOPATH=$DIR | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment