使用protoc-gen-go创建一个.pb.go,导入google / golang,但找不到包 [英] Using protoc-gen-go creates a .pb.go that imports google/golang but can't find package
问题描述
我使用原始发行版来编译 C
Protocol Buffers
转换为 Golang
几乎可以去安装
这个软件包,但是我得到这个错误:
找不到软件包 google / protobuf
但我无法在任何地方找到这个软件包进行下载,有谁可以告诉我该怎么做?感谢。
我按照以下所有步骤从这里
然后运行 protoc --go_out =。 * .proto
,我得到我所有的文件,但是错误的 proto
import
as @poopoothegoriall说,请使用github中的protobuf,而不是code-google。生成的.pb.go文件将导入github.com/golang/protobuf/proto
更新
这是我的步骤:
-
make install
项目 https://github.com/google/protobuf.git -
去获取
https:// github。 com / golang / protobuf - 通过
protoc --go_out =生成go源文件。 xxx.proto
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
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:
make install
project https://github.com/google/protobuf.gitgo get
https://github.com/golang/protobuf- generate the go source by
protoc --go_out=. xxx.proto
这篇关于使用protoc-gen-go创建一个.pb.go,导入google / golang,但找不到包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!