gpt4 book ai didi

gogo.proto : File not found

转载 作者:IT王子 更新时间:2023-10-29 01:12:51 31 4
gpt4 key购买 nike

协议(protocol) --gogofaster_out=。图片.proto

我收到此错误消息

/home/abc/src/github.com/gogo/protobuf/gogoproto/gogo.proto: File not found.

image.proto: Import "/home/abc/src/github.com/gogo/protobuf/gogoproto/gogo.proto" was not found or had errors.

文件肯定在那里。我可以从错误中报告的路径到达它。

我的原型(prototype)文件是这样的:

package image;

import "/home/abc/src/github.com/gogo/protobuf/gogoproto/gogo.proto";

message Frame {
required bool fragment = 1;
required int32 fragmentID = 2;
required bool lastFragment = 3;
required bytes data = 4;
}

我在原始文件所在的目录中有一个Makefile。看起来像这样:

regenerate:
--proto_path=../../github.com/gogo/protobuf/gogoproto:../../github.com/gogo/protobuf/protobuf/google/protobuf:. --gogofaster_out=. *.proto

如何解决路径错误?

最佳答案

作为in this issue ,您可以尝试仅导入相对路径:

import "github.com/gogo/protobuf/gogoproto/gogo.proto";

首先确保GOPATH设置为/home/abc

我提到 protobuf PR 241 ,其中 makefile 定义了要使用的 PATH:

regenerate: 
protoc-min-version --version="3.0.0"
--proto_path=$(GOPATH)/src/image:
$(GOPATH)/src/github.com/go‌​go/protobuf/protobuf‌​:
$(GOPATH)/src/githu‌​b.com/gogo/protobuf/‌​protobuf/google/prot‌​obuf:
. --gogo_out=. *.proto

OP 提及 this thread ,它指出:

The dependencies call other dependencies in "google/protobuf/", so these need to be in the path correctly also.
The errors are pretty misleading

Also when using gogoproto extensions you should use gogofast_out.
gofast_out is only for when you are not using any extensions, but want some extra speed.
gogofast_out / gofast_out has no side effects.
gogofaster_out makes most fields nullable=false.

关于gogo.proto : File not found,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43026449/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com