获取Go中所有已安装的软件包的列表

huangapple go评论85阅读模式
英文:

Get a list of all installed packages in Go

问题

我如何通过goinstall列出所有已安装的软件包?我需要将一个计算机上安装的所有软件包重新安装到另一台计算机上。

英文:

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

答案1

得分: 12

这里大多数的答案都是针对早期的Go 1.0版本的,这已经是几年前的事情了,这些答案已经不适用于当前的Go安装。

简单的答案是go list ...(就像其他go子命令一样,三个句点表示匹配所有的包)。这将列出系统上的每个包。查看go list -h以了解这个多功能命令的其他用法。

Dave Cheney还有一篇相关的博文:go list, 你的瑞士军刀

英文:

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.

答案2

得分: 3

有一个列表在$GOROOT/goinstall.log下面
如果你想在另一台电脑上安装所有的包,只需复制该文件并运行

goinstall -a

goinstall将读取该文件并安装其中列出的所有包。

英文:

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.

答案3

得分: 0

我不确定是否有通过goinstall来完成这个操作的方法,但是在$GOROOT/goinstall.log下应该有一个列表。

英文:

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

huangapple
  • 本文由 发表于 2011年7月6日 07:36:18
  • 转载请务必保留本文链接:https://go.coder-hub.com/6590054.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定