go - 我应该在生产中使用 go 模块吗

标签 go go-modules godeps

<分区>

我正在使用 dep,但我非常喜欢内置的 Go Modules在 Go 1.11 中

在文档中,它说:

Go 1.11 includes preliminary support for versioned modules as proposed here. Modules are an experimental opt-in feature in Go 1.11, with the plan of incorporating feedback and finalizing the feature for Go 1.13. Even though some details may change, future releases will support modules defined using Go 1.11 or 1.12.

尽管如此,Go Modules 似乎已被社区广泛使用,并且运行良好。

那么,对于一个新项目,我应该使用 Go Modules 还是应该坚持使用 dep ?我需要帮助才能做出决定。

最佳答案

在我看来,你应该在开始一个新项目时切换到模块。 Go 1.13 将于 8 月发布(大约 2 个月后),全面支持模块,包括默认使用 Go 模块镜像和校验和数据库。

引自preliminary Go 1.13 release docs :

Go 1.13 is expected to be released in August 2019.

As of Go 1.13, the go command by default downloads and authenticates modules using the Go module mirror and Go checksum database run by Google. See https://proxy.golang.org/privacy for privacy information about these services and the go command documentation for configuration details including how to disable the use of these servers or use different ones.

我看到越来越多的存储库添加了 go.mod 文件,这意味着它们已经过测试并且可以毫无问题地使用模块,即使它们没有 go。 mod 文件,这并不意味着它们不能与模块一起使用,但可能需要手动调整依赖项或 vendor

另外不要忘记:即使您现在不在新项目中开始使用模块,您也可以在将来的任何时候切换到模块,没有人会阻止这一点。但是,如果您在第一天就开始使用模块,您就会为自己节省一些工作。

关于go - 我应该在生产中使用 go 模块吗,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56700443/

相关文章:

go - 如何下载支持简历的文件?

html - 模板中的 bson.ObjectId

go - 当使用没有设置 GOPATH 的模块时,go 将导入放在哪里?

go - 错误: "build flag -mod=vendor only valid when using modules" when building Go project

git - 去 dep 去生成

go - 如何更新 https ://github. com/hashicorp/terraform.git for terraform 的 vendor 文件夹

go - 如何从 Golang 中的嵌套结构中获取值

go - Go中 slice 的最大长度

Go 项目不从 github 中提取导入更新

go build 找不到包源