Skip to content

Instantly share code, notes, and snippets.

@shuhei
Forked from ivanzoid/setupGOROOT.sh
Created December 5, 2013 13:07
Show Gist options
  • Save shuhei/7804870 to your computer and use it in GitHub Desktop.
Save shuhei/7804870 to your computer and use it in GitHub Desktop.
As of go 1.2
#
# Place this code to your .profile, .bashrc, .bash_profile or whatever
#
program_exists () {
type "$1" &> /dev/null ;
}
if program_exists go; then
function setupGOROOT()
{
local GOPATH=`which go`
local GODIR=`dirname $GOPATH`
local GOPATH_BREW_RELATIVE=`readlink $GOPATH`
local GOPATH_BREW=`dirname $GOPATH_BREW_RELATIVE`
export GOROOT=`cd $GODIR; cd $GOPATH_BREW/../libexec; pwd`
}
setupGOROOT
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment