英文:
How can I fix "go get ./..." when installing dependencies?
问题
当我输入"go get ./..."时,我得到以下错误信息:
./main.go:191: undefined: sendgrid.NewSendGridClientWithApiKey
./main.go:192: undefined: sendgrid.NewMail
./main.go:222: undefined: sendgrid.NewSendGridClientWithApiKey
./main.go:223: undefined: sendgrid.NewMail
我该如何修复这个错误?或者我该如何调试它?
这是针对较旧版本的Go(1.5.2)...如果这有帮助的话。
请告诉我是否可以提供其他信息。我真的不知道从哪里开始,因为在本地运行正常。提前谢谢。
英文:
When I type
"go get ./..." I get back:
./main.go:191: undefined: sendgrid.NewSendGridClientWithApiKey
./main.go:192: undefined: sendgrid.NewMail
./main.go:222: undefined: sendgrid.NewSendGridClientWithApiKey
./main.go:223: undefined: sendgrid.NewMail
How can I fix this error? Or how can I debug this?
It is for an older version of go...version 1.5.2..if that helps.
Please let me know if I can provide other information. I really do not know where to start as it works fine locally as is. Thanks in advance.
答案1
得分: 2
Sendgrid最近对其API进行了一些更改*。
之所以在本地工作正常,几乎可以确定是因为您的GOPATH中有旧版本的go库...在本地使用go get -v -u ./...
(更新依赖项)可能会导致本地出现问题。
您可以通过更新您的代码以匹配新的API,或通过将旧版本作为依赖项进行维护来修复它。
英文:
Sendgrid changed their API somewhat recently *.
The reason it works locally is almost certainly because you had the old version of the go library in your GOPATH... using go get -v -u ./...
(updating the dependencies) locally will probably break it locally too.
You can fix it either by updating your code to match the new API, or by fixing your dependencies by vendoring the old version.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论