Kratos generate时提示Import “google/protobuf/descriptor.proto“ was not found or had errors.错误

错误提示如下:

google/protobuf/descriptor.proto: File not found.
kratos/api/annotations.proto:9:1: Import "google/protobuf/descriptor.proto" was not found or had errors.
kratos/api/annotations.proto:11:8: "google.protobuf.EnumOptions" is not defined.
helloworld.proto:5:1: Import "kratos/api/annotations.proto" was not found or had errors.
exit status 1
wire: helloworld/cmd/helloworld: wrote C:\Users\dkzhang\go\src\github.com\dkzhang\helloworld\cmd\helloworld\wire_gen.go

 

解决办法:

下载https://github.com/protocolbuffers/protobuf源代码,提取src/goole文件夹,复制到$GOPATH下/src路径下,重新generate即可通过。


版权声明:本文为dkzhang原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。