szaydel
11/17/2013 - 4:37 PM

setupGOROOT.sh

#
# Place this code to your .profile, .bashrc, .bash_profile or whatever
#

function program_exists -d "Check if program is valid"
	type "$1" &> /dev/null ;
end


function setup_goroot
	set GOPATH (which go)
	set GODIR (dirname $GOPATH)
	set GOPATH_BREW_RELATIVE (readlink $GOPATH)
	set GOPATH_BREW (dirname $GOPATH_BREW_RELATIVE)
	set -x GOROOT (cd $GODIR; cd $GOPATH_BREW/..; pwd)
end

setup_goroot