Home > Backend Development > Golang > Where Do Go Packages Installed with 'go get' Go?

Where Do Go Packages Installed with 'go get' Go?

DDD
Release: 2024-11-12 17:54:02
Original
363 people have browsed it

Where Do Go Packages Installed with 'go get' Go?

Locating Packages Installed by 'go get'

When using the go get command to install packages, it's crucial to know their installation location to access their executables. This article explores where packages are installed and provides a solution for users who encounter difficulties locating them.

According to the Go documentation, packages retrieved via go get are typically installed in $GOPATH/bin. However, this environment variable may not be explicitly defined in your shell. If $GOPATH is not set, Go will default to using $HOME/go as the installation directory.

The user in our case used Homebrew to install Go. By running brew info go, they discovered the following caveat:

==> 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
Copy after login

This clue led them to search for the executable in $HOME/go/bin, where it was successfully located. Therefore, for Homebrew users who encounter missing $GOPATH issues, they should check the installation directory at $HOME/go/bin to find their installed packages.

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

source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template