错误模块 github.com/golang/protobuf 已被弃用。

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

Error module github.com/golang/protobuf is deprecated

问题

我在我的Golang项目中使用命令行go getgo get .时遇到了问题。错误信息是:

go: module github.com/golang/protobuf is deprecated: Use the "google.golang.org/protobuf" module instead.

我已经按照这个网站上的步骤逐步安装了protobuf包,但是问题仍未解决。

英文:

I have a problem with the command line go get or go get . in my Golang project. The error is

go: module github.com/golang/protobuf is deprecated: Use the "google.golang.org/protobuf" module instead.

I have tried step by step install package protobuf in this website enter link description here

but I can't resolve my problem.

答案1

得分: 4

你可以检查你的代码,看看是否在某个地方导入了github.com/golang/protobuf

如果你的代码中没有使用这个导入,可以检查哪个依赖项导入了它:

go mod graph | grep github.com/golang/protobuf

或者

go mod why github.com/golang/protobuf

基本上,你需要通过一些方式消除这个导入,可以通过在代码中删除它,更新你的依赖项,或者甚至消除那个还没有更新到新的protobuf包的依赖项。(最近我不得不这样做,我踢掉了我用于选举的etcd

英文:

You can check your code if you import github.com/golang/protobuf somewhere.

If you don't use the import in your code, check which dependency imports it:

go mod graph | grep github.com/golang/protobuf

or

go mod why github.com/golang/protobuf

Basically you need to eliminate that import somehow either by removing it in your code, updating your dependencies or maybe even eliminate the dependency that hasn't updated to the new protobuf package yet. (Had to do that recently by kicking etcd which I used for election)

huangapple
  • 本文由 发表于 2021年9月29日 19:37:33
  • 转载请务必保留本文链接:https://go.coder-hub.com/69375635.html
匿名

发表评论

匿名网友

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

确定