go - 提交 `vendor` 目录是最佳实践吗?

标签 go

我正在使用 dep 来处理我的 Go 依赖项。将 vendor 目录也提交到版本控制中是最佳做法吗?还是在 checkout 存储库后始终执行 dep ensure 的最佳做法是?

最佳答案

dep 工具的常见问题解答 answers这个:

Should I commit my vendor directory?

It's up to you:

Pros

  • It's the only way to get truly reproducible builds, as it guards against upstream renames, deletes and commit history overwrites.
  • You don't need an extra dep ensure step to sync vendor/ with Gopkg.lock after most operations, such as go get, cloning, getting latest, merging, etc.

Cons

  • Your repo will be bigger, potentially a lot bigger, though prune can help minimize this problem.
  • PR diffs will include changes for files under vendor/ when Gopkg.lock is modified, however files in vendor/ are hidden by default on GitHub.

关于go - 提交 `vendor` 目录是最佳实践吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47346607/

相关文章:

go - 获取 Go 中传输的连接数

go - 如何在 Go 语言中为 init 声明两个变量?

go - 在 Go 问题中获取 URL 参数

google-app-engine - App Engine 数据存储区查询,对许多索引

go - 尝试将文件发送到 IPFS 时出现 "Command not found"

xml-parsing - golang 中的多类型解码器

file - 读取文件作为模板,执行并写回

http - 在 Go 中使用表单值发出 HTTP GET

go - 如何详细打印结构并隐藏一些字段?

GoLang printf 什么都不显示,即使在使用 time.Sleep 之后