dongqian5569 2018-07-11 13:52
浏览 1112
已采纳

文件不在使用proto_path指定的任何路径内

I am testing out importing .proto file from another directory.

$GOPATH/src/A/A.proto

syntax = "proto3"; 
package A;
 message SomeMsg {
     string  msg = 2;
     int64   id  = 3;
 }

$GOPATH/src/B/B.proto

syntax = "proto3"; 
package B; import "A/A.proto";
 message Msg {
     SomeMsg s = 1;
 }

I'm doing this: in folder A:

protoc A.proto --go_out=.

and then in folder B:

protoc B.proto --go_out=. --proto_path=$GOPATH/

But I will get this error:

B.proto: File does not reside within any path specified using --proto_path (or -I). You must specify a --proto_path which encompasses this file. Note that the proto_path must be an exact prefix of the .proto file names -- protoc is too dumb to figure out when two paths (e.g. absolute and relative) are equivalent (it's harder than you think).

  • 写回答

1条回答 默认 最新

  • douyingtai6662 2018-07-11 15:37
    关注

    Error seems clear enough to me, it is saying that you need to specify the exact directory that B.proto is in

    protoc B.proto --go_out=. --proto_path=$GOPATH/src/B 
    

    or if you are in folder B already,

    protoc B.proto --go_out=.
    

    The protoc guys are funny it's harder than you think!!! Lol, why am I fighting the desire to say "That's what she said!" Lol

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog