go - 如何检查golang中缺少的依赖项

标签 go

我怎么知道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/

相关文章:

go - 使用 gorethink 在查询之间创建

go - 在 Golang 中使用空接口(interface)泛化并发映射函数

audio - 不输出 Opus 原始音频

go - 服务器发送事件意外行为

go - 关于golang channel 的一些问题

file - 您应该关闭临时创建的文件还是可以直接删除它们?

go - 平方和平方根的整数函数

go - 如何在不使用time.Sleep的情况下等待所有goroutine完成?

戈朗 : convert struct to embedded at offset 0 struct

windows - 使用新的环境变量 fork Windows shell