go get 和 go install 区别

1. go get

  1. download
  2. compile
  3. install

2. install

  1. compile
  2. install

3. 为什么要存在 go install? go get 不是够用了么?

因为 go get 第一步就是 download 远程的库,如果就就想要使用本地的版本,go get 是办不到的,所以如果你不需要 download 你需要就可以使用 go install
go install 是有应用场景的

参考:https://stackoverflow.com/questions/24878737/what-is-the-difference-between-go-get-and-go-install

提示:在新版本的 go 1.15 go install 如果本地没有 package 会自动从远程下载包,所以是十分方便的

4. 推荐做法

  1. go get 即将废弃,
  2. go get -d(后面将默认参数 d,只是下载 download)
  3. 推荐使用 go install

go install, with or without a version suffix (as described above), is now the recommended way to build and install packages in module mode. go get should be used with the -d flag to adjust the current module’s dependencies without building packages, and use of go get to build and install packages is deprecated. In a future release, the -d flag will always be enabled.
参考: https://tip.golang.org/doc/go1.16#modules

  • 6
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

JarvanStack

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值