Go get和Go download命令之间有什么区别?

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

what is the difference between Go get and Go download commands

问题

以下是对Go语言中这些命令的解释:

  1. go get golang.org/dl/go.1.15.6:这个命令用于从远程代码仓库获取并安装指定的包或模块。在这个例子中,它会获取并安装名为golang.org/dl/go.1.15.6的包。

  2. go1.15.6 download:这个命令用于下载指定版本的Go语言工具链。在这个例子中,它会下载版本号为1.15.6的Go语言工具链。

当使用go get命令时,它会执行以下操作:

  • 检查指定的包或模块是否存在于远程代码仓库。
  • 如果存在,它会下载包或模块的源代码。
  • 编译源代码并将生成的可执行文件或库安装到Go语言的工作目录中。

go1.15.6 download命令用于下载指定版本的Go语言工具链。它会从官方源下载Go语言的二进制文件,并将其安装到指定的目录中,以供后续使用。

请注意,以上是对这些命令的一般解释,具体的操作可能会因环境和配置而有所不同。

英文:

could you explain what the following commands on go doing exactly

 go get golang.org/dl/go.1.15.6
 go1.15.6 download

when using go get what exactly happens on the background is it only downloading the go.1.15.6 and what go1.15.6 download doing exactly ?

答案1

得分: 4

命令go get golang.org/dl/go.1.15.6已被弃用。请改用go install golang.org/dl/go.1.15.6

命令go install golang.org/dl/go.1.15.6会下载、构建和安装一个名为go.1.15.6的程序。该程序不包含Go安装。请阅读go install文档以获取更多详细信息。

命令go1.15.6 download会使用前一步安装的程序以download参数运行。以这种方式运行时,该程序会下载相应版本的Go。下载完成后,可以使用go1.15.6程序调用该版本的Go工具子命令。请阅读管理Go安装以获取有关go1.xx.x命令的更多详细信息。

请注意,没有go download子命令。下载是go1.xx.x命令中的一个功能。

英文:

The command go get golang.org/dl/go.1.15.6 is deprecated. Use go install golang.org/dl/go.1.15.6 instead.

The command go install golang.org/dl/go.1.15.6 downloads, builds and installs a program named go.1.15.6. This program does not include the Go installation. Read the go install documentation for more details.

The command go1.15.6 download runs the program installed in the previous step with the download argument. When run this way, the program downloads the associated version of Go. After downloading, the Go tool sub-commands for that version can be invoked using the go1.15.6 program. Read Managing Go installations for more details on the go1.xx.x command.

Note that there is not a go download sub-command. Download is a feature in the go1.xx.x commands.

huangapple
  • 本文由 发表于 2023年2月17日 23:50:31
  • 转载请务必保留本文链接:https://go.coder-hub.com/75486474.html
匿名

发表评论

匿名网友

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

确定