How to list installed packages in Go/Golang?
In this article we will discuss how to list installed packages in Go
With latest versions of GO, we use “go get” to install external/third party modules into your workspace. This feature , like any other package managers, download the source code and save it on your machine.
Check the “help” using
1 2 3 4 | [root@test.test.com ~]# go help get usage: go get [–d] [–f] [–fix] [–insecure] [–t] [–u] [build flags] [packages] |
Get downloads the packages named by the import paths, along with their dependencies. It then installs the named packages, like ‘go install’.
How to List installed packages in GO/GOLANG ?
If you want to list installed packages in go , you can do that with the “go list”
To list installed go packages inside your workspace, use the command
1 2 3 | go list ./... |
To list all installed packages in GO, use the command
1 2 3 | go list ... |
Sample Outputs
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | [root@test.test.com ~]# go list ./… _/root/git/contrib/persistent–https _/root/go/blog/content/context/google _/root/go/blog/content/context/server _/root/go/blog/content/context/userip _/root/go/blog/content/cover _/root/go/doc/articles/wiki _/root/go/doc/codewalk _/root/go/doc/play _/root/go/misc/android _/root/go/misc/cgo/gmp _/root/go/misc/cgo/life _/root/go/misc/cgo/nocgo _/root/go/misc/cgo/stdio _/root/go/misc/cgo/test _/root/go/misc/cgo/test/gcc68255 _/root/go/misc/cgo/test/issue8828 |
This command outputs long list of packages. Packages from the standard library will be listed first followed by external/third party Packages.