Home >Backend Development >Golang >Where Do Packages Installed by `go get` Go?

Where Do Packages Installed by `go get` Go?

Barbara Streisand
Barbara StreisandOriginal
2024-11-23 08:52:13799browse

Where Do Packages Installed by `go get` Go?

Locating Packages Installed by go get

When running go get , where are the packages installed? This common question arises when attempting to execute executables from installed packages.

According to the Go documentation, packages are expected to be installed in $GOPATH/bin. However, if $GOPATH is not set, Go will default to $HOME/go as the installation directory.

To verify this behavior, you can check the output of brew info go, which confirms the use of $HOME/go if $GOPATH is not defined. This explains why the go get command works even though $GOPATH is not explicitly set in your shell environment.

Consequently, the executable in question can be found in $HOME/go/bin. This is also where you will find any other executables installed using go get.

The above is the detailed content of Where Do Packages Installed by `go get` Go?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn