我怎么知道go项目中缺少哪些依赖项?
现在我知道的唯一方法是运行 go build
命令并按照错误消息进行操作。
但是有没有更有效的方法来做到这一点,例如:
./a.out 项目
返回可能是这样的:
缺少依赖项:
github.com/go-sql-driver/mysql
github.com/foo/bar
....
go build
支持这个功能吗?
最佳答案
由于 Go 是编译型语言,因此要查看您的代码是否有错误或缺少依赖项,可以通过编译您的代码。
您可以使用 go get
代替 go build
来查看缺少的依赖项。
一些引用来自 doc
Go compiles quickly to machine code yet has the convenience of garbage collection and the power of run-time reflection. It's a fast, statically typed, compiled language that feels like a dynamically typed, interpreted language.
关于go - 如何检查golang中缺少的依赖项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41588508/