Using protoc-gen-go creates a .pb.go that imports google/golang but can't find package

隐身守侯 提交于 2019-12-04 04:27:07

问题


I'm using protoc-gen-go to compile C Protocol Buffers into Golang which works great and I can almost go install the package but I get this error:

cannot find package "google/protobuf"

but I cannot find this package anywhere to download, can anybody tell me what I should do with this? Thanks.

I'm following all steps to doing it from here

then I run protoc --go_out=. *.proto and I get all my files, but the wrong proto import


回答1:


as @poopoothegoriall said, please use the protobuf from github, other than code-google. the generated .pb.go file will import "github.com/golang/protobuf/proto"

UPDATE this is my steps:

  1. make install project https://github.com/google/protobuf.git
  2. go get https://github.com/golang/protobuf
  3. generate the go source by protoc --go_out=. xxx.proto


来源:https://stackoverflow.com/questions/33930028/using-protoc-gen-go-creates-a-pb-go-that-imports-google-golang-but-cant-find-p

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!