GOVERSION=$(brew list go | head -n 1 | cut -d '/' -f 6) export GOROOT=$(brew --prefix)/Cellar/go/$GOVERSION/libexec
libexec, as suggested by @solidfox in the comments.
- Update 2:
GOROOT variable should not be necessary in newer versions of go. If you really want to, use:
export GOROOT=$(go env GOROOT)