HiveBrain v1.2.0
Get Started
← Back to all entries
patterngoCritical

Where does go get install packages?

Submitted by: @import:stackoverflow-api··
0
Viewed 0 times
installwherepackagesdoesget

Problem

I've been given instructions to run go get which seems to succeed, but it's not clear to me where the package was installed to so I can run an executable from it.

Per https://golang.org/doc/code.html#remote it seems it will be installed in $GOPATH/bin but $GOPATH isn't defined in my shell (though the go get command seems to work fine). Go is installed via Homebrew.

Solution

I found the missing clue by running brew info go, which says:

==> Caveats
A valid GOPATH is required to use the `go get` command.
If $GOPATH is not specified, $HOME/go will be used by default:
  https://golang.org/doc/code.html#GOPATH


From that I found the executable in question at $HOME/go/bin.

Code Snippets

==> Caveats
A valid GOPATH is required to use the `go get` command.
If $GOPATH is not specified, $HOME/go will be used by default:
  https://golang.org/doc/code.html#GOPATH

Context

Stack Overflow Q#50633092, score: 117

Revisions (0)

No revisions yet.