[已解决!]Import "google/protobuf/descriptor.proto" was not found or had errors.

解决步骤:
1:先在IDE访问google/protobuf/descriptor.proto将其copy
2:创建类似结构

-gopath
      -src
          -google
                  -protobuf
                        -descriptor.proto

3.将copy的文件赋值到descriptor.proto中(或不需要创建直接下载 https://github.com/protocolbuffers/protobuf 将src/goole文件夹直接移动到GOPATH/src下)
4.执行shell命令生成.proto文件
$ protoc --go_out=plugins=grpc:. -I=${GOPATH}/src -I=. *.proto

亲测有效 适用于MAC

posted @ 2020-06-07 17:44  Binb  阅读(14491)  评论(1编辑  收藏  举报