Determining Installed Package Listings in Go
Retrieving a comprehensive list of installed Go packages is crucial for various scenarios, such as reinstalling packages on a different machine. This article addresses the question of listing installed packages using goinstall, an outdated approach no longer applicable to current Go installations.
Updated Method for Go Versions 1.0 and Above
To obtain a complete list of installed Go packages, utilize the following command:
go list ...
The three literal periods "..." represent a wildcard that matches all packages on the system.
Example Output:
github.com/fvbommel/sortorder github.com/go-delve/delve github.com/golang/glog github.com/google/pprof github.com/ianlancetaylor/demangle github.com/mattn/go-sqlite3 github.com/michielheld/godocrunner github.com/rogpeppe/godef github.com/rogpeppe/goinstall github.com/uber-go/zap
Additional Command Options
The go list command offers extensive options. Refer to go list -h for further details.
Alternative Resources
For further insights into the versatility of the go list command, consult Dave Cheney's blog article: [go list, Your Swiss Army Knife](https://dave.cheney.net/2015/09/01/go-list-your-swiss-army-knife).
The above is the detailed content of How Do I Get a List of Installed Go Packages?. For more information, please follow other related articles on the PHP Chinese website!