如何列出安装的软件包 [英] How to list installed go packages
问题描述
据我所知 go distribution
带有某种包管理器
。在之后去1.4.1
安装我已经运行了 go help
以便找到任何能够本地列出的子命令安装了 go packages
,但遗憾的是没有。
那怎么办? b
goinstall
现在是历史记录
goinstall
被替换为 go get
。 go get
用于管理外部/第三方库(例如下载它们,更新它们,安装它们等)。
键入 go help获取
以查看命令行帮助,或者查看这些页面:
关于go命令 (博客文章)
如果您想列出已安装的软件包,可以使用 go list
命令执行此操作:
h2>
要在工作区中列出软件包,请转至工作区文件夹并运行以下命令:
go list。/ ...
执行 列出所有软件包,包括标准库的软件包,其次是外部库。 如果你还想看到每个包所导入的包,你可以试试这个自定义格式: 如果您想查看所有依赖递归地(递归地依赖于导入的包),您可以使用这个自定义格式: To my knowledge So how to do it? Type About the go command (blog post) If you want to list installed packages, you can do that with the To list packages in your workspace, go to your workspace folder and run this command: Executing in any folder lists all the packages, including packages of the standard library first followed by external libraries in your go workspace. If you also want to see the imported packages by each package, you can try this custom format: If you want to see all the dependencies recursively (dependencies of imported packages recursively), you can use this custom format: But usually this is a long list and just the single imports ( 这篇关于如何列出安装的软件包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋! ./
告诉从当前文件夹开始,
...
告诉递归下去。当然,这可以在任何其他文件夹中使用,而不仅仅是在您的工作区中(但通常这就是您感兴趣的内容)。
列出所有软件包
去列表...
包和它们的依赖关系
go list -f{{.ImportPath}} {{.Imports}}。/ ...
-f
指定列表的替代格式,使用包 模板
。可以通过 go帮助列表
命令打印其可以引用字段的结构。
go list -f{{.ImportPath}} {{.Deps}}。/ ...
<但通常这是一个很长的列表,并且每个包的单个导入(>
)就是您想要的。go distribution
comes with some sort of package manager
. After go 1.4.1
installation I've run go help
in order to find any sub-command capable of listing locally installed go packages
, but unfortunately got none.goinstall
is now historygoinstall
was replaced by go get
. go get
is used to manage external / 3rd party libraries (e.g. to download them, update them, install them etc).go help get
to see command line help, or check out these pages:go list
command:Listing Packages
go list ./...
./
tells to start from the current folder, ...
tells to go down recursively. Of course this works in any other folders not just in your go workspace (but usually that is what you're interested in).List All Packages
go list ...
Packages and their Dependencies
go list -f "{{.ImportPath}} {{.Imports}}" ./...
-f
specifies an alternate format for the list, using the syntax of package template
. The struct whose fields can be referenced can be printed by the go help list
command.go list -f "{{.ImportPath}} {{.Deps}}" ./...
"{{.Imports}}"
) of each package is what you want.