英文:
Error module github.com/golang/protobuf is deprecated
问题
我在我的Golang项目中使用命令行go get
或go 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)
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论