Created
July 11, 2013 11:53
-
-
Save boopathi/5974801 to your computer and use it in GitHub Desktop.
Set Golang environment before you start compiling go code
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 | |
### | |
# | |
# @usage `source set_env.sh` | |
# @desc Sets the environment for developers | |
# @install Put this file into the GO Workspace directory | |
# | |
# bash-$ ls workspace/go/ | |
# - set_env.sh* | |
# - bin/ | |
# - src/ | |
# - tmp/ | |
# - pkg/ | |
# | |
### | |
#Get the script's own directory instead of where it's being called from | |
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | |
# Set PATH | |
if [[ "$PATH" != ?(*:)"$DIR/bin"?(:*) ]]; then | |
export PATH=$PATH:$DIR/bin | |
fi | |
# Set GOPATH - used by GO | |
if [[ -z "$GOPATH" ]]; then | |
export GOPATH=$DIR | |
fi | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment