Get a list of all installed packages in Go
Asked Answered
D

3

5

How can I list all installed packages via goinstall? I need this to reinstall all packages installed on one computer to a different computer.

Doubleton answered 5/7, 2011 at 23:36 Comment(2)
Note goinstall was only pre-Go 1.0 and hasn't existed for years; many of these answer are no longer applicible.Biblicist
Yea, might want to re-accept the other answer nowadays...Outvote
N
3

There is a list under $GOROOT/goinstall.log If you want to install all the packages on an different computer just copy the file across and run,

goinstall -a

and goinstall will read this file and install all packages listed in it.

Nuncupative answered 6/7, 2011 at 4:22 Comment(2)
Upvote for both a good answer and an awesome feature I didn't know aboutWrithen
"feature" seems like a stretchJealous
B
12

Most answers here are for pre-Go 1.0 which is several years old and the answers are no longer applicable to working Go installations.

The simple answer is go list ... (as with other go sub-commands three literal periods match all packages). That will list every package on the system. See go list -h for other uses of this versatile command.

Dave Cheney also has a related blog article: go list, your Swiss army knife.

Biblicist answered 22/5, 2015 at 16:35 Comment(5)
I had to quote the three dots go list '...' for it to work.Disproportionation
Not sure if this was always the case or if it was added later, but go list all also works in place of .... See go help packages for how to specify package names such as all, ..., std, etc.Biblicist
How to know which all external packages I have installed manually? @DaveCSized
for me "go list all" returns: go: warning: "all" matched no packagesWeakminded
@Weakminded I think all as a package name changed meaning with modules. See go help packages: ""all" expands to all packages found in all the GOPATH trees. When using modules, "all" expands to all packages in the main module and their dependencies, including dependencies needed by tests of any of those."Biblicist
N
3

There is a list under $GOROOT/goinstall.log If you want to install all the packages on an different computer just copy the file across and run,

goinstall -a

and goinstall will read this file and install all packages listed in it.

Nuncupative answered 6/7, 2011 at 4:22 Comment(2)
Upvote for both a good answer and an awesome feature I didn't know aboutWrithen
"feature" seems like a stretchJealous
R
0

I'm not sure there's a way to do it through goinstall, but there should be a list under $GOROOT/goinstall.log.

Roundy answered 6/7, 2011 at 3:38 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.