go get和go install有什么区别? [英] What is the difference between go get and go install?

查看:478
本文介绍了go get和go install有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用go工具一段时间后,看起来像go get:

After playing with the go tool for a while, it looks like go get:

  1. (可选)下载,
  2. 编译,
  3. 并安装

一款软件,而go install只是

  1. 编译
  2. 并安装

它.在这种情况下,为什么go install命令存在,因为go get取代了它?

it. In this case, why does the go install command exist, since go get supersedes it?

推荐答案

go install在本地工作时是工作流程的一部分.假设您要使用库,但是由于某些原因需要进行更改.您会这​​样做:

go install is part of the workflow when working locally. Say you want to use a library, but for some reason a change is required. You would do:

  • go get -d library,仅下载它;
  • 对下载的软件包进行更改;
  • go install library以安装本地版本.
  • go get -d library, which only downloads it;
  • make the change on the downloaded package;
  • go install library to install the local version.

据我所知,go get没有标志来指示不应下载 ,因此在这里不能替换go install.

As far as I know go get has no flags to indicate it should not download, so it can't replace go install here.

从头开始开发新程序包时,将使用相同的工作流程.

The same workflow is used when you develop a new package from scratch.

这篇关于go get和go install有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆