Go itself knows the Homebrew-defined GOROOT because it’s built with it.  I like doing it this way because it essentially delegates $GOROOT to the path that is defined by Homebrew at build time.

**Background:**
Most of the time, a call to **go get** should install things in $GOPATH/bin.  $GOPATH is like a “workspace” area of the filesystem that Go expects you to have set up.  However, **these** deprecated commands (mentioned in the existing caveat) install to $GOROOT/bin — probably as some kind of legacy of the fact that they used to be tools that were available with the **go** CLI command and are still in some sense regarded as “core” to Go.  IDK the reasoning.  Just did this PR b/c after updating to Go 1.2, I followed **go get <godoc stuff>** and the **godoc** command wasn’t in my path and it was annoying to have to go track down why. :-)

On Dec 28, 2013, at 2:44 PM, Mike McQuaid <notifications@github.com> wrote:

> In Library/Formula/go.rb:
> 
> > @@ -75,6 +75,10 @@ def caveats; <<-EOS.undent
> >      To get `go vet` and `go doc` run:
> >        go get code.google.com/p/go.tools/cmd/godoc
> >        go get code.google.com/p/go.tools/cmd/vet
> > +
> > +    Add the GOROOT-based install location to your path
> > +      export GOROOT=`go env GOROOT`
> > +      export PATH=$PATH:$GOROOT/bin
> Does GOROOT need to be set other than for the PATH? You should just run go env GOROOT yourself and show the users what value to set, probably.
> 
> —
> Reply to this email directly or view it on GitHub.
>