当安装依赖项时,如何修复”go get ./…”的问题?

huangapple go评论107阅读模式
英文:

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.

huangapple
  • 本文由 发表于 2017年3月24日 07:04:03
  • 转载请务必保留本文链接:https://go.coder-hub.com/42988557.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定