英文:
What does the `...` mean in go get
问题
在这种情况下,...
表示通配符,用于匹配指定路径下的所有子包。执行go get github.com/constabulary/gb/...
命令将会下载并安装github.com/constabulary/gb
包及其所有子包。
英文:
I wanted to install gb
The installation steps says to execute the command:
go get github.com/constabulary/gb/...
What does the ...
mean in this case?
答案1
得分: 37
...
(省略号)告诉go get
命令还要获取包的子包/依赖项。
根据go help packages
的说明:
如果导入路径包含一个或多个“...”通配符,则它是一个模式,每个通配符可以匹配任何字符串,包括空字符串和包含斜杠的字符串。这样的模式会扩展为在GOPATH树中找到的与模式匹配的所有包目录。作为一个特例,x/...也会匹配x及其子目录。例如,net/...会扩展为net以及其子目录中的包。
关于如何使用它的示例,请参考这个答案。
英文:
The ...
(ellipsis) tells go get
to also fetch the package's subpackages/dependencies.
From go help packages
:
> An import path is a pattern if it includes one or more "..."
> wildcards, each of which can match any string, including the empty
> string and strings containing slashes. Such a pattern expands to all
> package directories found in the GOPATH trees with names matching the
> patterns. As a special case, x/... matches x as well as x's
> subdirectories. For example, net/... expands to net and packages in
> its subdirectories.
For an example of how you'd use it, check out this answer.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论