首页 >后端开发 >Golang >cosmos-sdk/proto/bank/v1beta1/query.proto 文件编译时错误

cosmos-sdk/proto/bank/v1beta1/query.proto 文件编译时错误

王林
王林转载
2024-02-09 10:00:201145浏览

cosmos-sdk/proto/bank/v1beta1/query.proto 文件编译时错误

php小编西瓜在使用cosmos-sdk/proto/bank/v1beta1/query.proto 文件编译时遇到了错误。这个文件是cosmos-sdk中的一部分,用于查询银行相关的信息。错误的出现可能是因为文件本身存在问题或者编译器的配置有误。解决这个问题需要仔细检查文件内容和编译器的设置,确保它们符合要求。同时,可以寻求社区或开发者的帮助,以便更快地解决这个编译错误。

问题内容

安装协议并保存 cosmos-sdk/proto/bank/v1beta1/query.proto 文件后,此文件显示很多错误,为了确认错误,我运行了此命令 protoc --go_out=。查询.proto

这是问题详细信息:

saiful@saiful-Inspiron-3542:~/Desktop/TestCosmos/cosmos-sdk/proto/cosmos/bank/v1beta1$ protoc --go_out=. query.proto
cosmos/base/query/v1beta1/pagination.proto: File not found.
gogoproto/gogo.proto: File not found.
google/api/annotations.proto: File not found.
cosmos/base/v1beta1/coin.proto: File not found.
cosmos/bank/v1beta1/bank.proto: File not found.
cosmos_proto/cosmos.proto: File not found.
cosmos/query/v1/query.proto: File not found.
amino/amino.proto: File not found.
query.proto:4:1: Import "cosmos/base/query/v1beta1/pagination.proto" was not found or had errors.
query.proto:5:1: Import "gogoproto/gogo.proto" was not found or had errors.
query.proto:6:1: Import "google/api/annotations.proto" was not found or had errors.
query.proto:7:1: Import "cosmos/base/v1beta1/coin.proto" was not found or had errors.
query.proto:8:1: Import "cosmos/bank/v1beta1/bank.proto" was not found or had errors.
query.proto:9:1: Import "cosmos_proto/cosmos.proto" was not found or had errors.
query.proto:10:1: Import "cosmos/query/v1/query.proto" was not found or had errors.
query.proto:11:1: Import "amino/amino.proto" was not found or had errors.
query.proto:135:3: "cosmos.base.v1beta1.Coin" is not defined.
query.proto:147:3: "cosmos.base.query.v1beta1.PageRequest" is not defined.
query.proto:159:12: "cosmos.base.v1beta1.Coin" is not defined.
query.proto:167:3: "cosmos.base.query.v1beta1.PageResponse" is not defined.
query.proto:182:3: "cosmos.base.query.v1beta1.PageRequest" is not defined.
query.proto:191:12: "cosmos.base.v1beta1.Coin" is not defined.
query.proto:199:3: "cosmos.base.query.v1beta1.PageResponse" is not defined.
query.proto:223:3: "cosmos.base.v1beta1.Coin" is not defined.
query.proto:235:3: "cosmos.base.query.v1beta1.PageRequest" is not defined.
query.proto:242:12: "cosmos.base.v1beta1.Coin" is not defined.
query.proto:252:3: "cosmos.base.query.v1beta1.PageResponse" is not defined.
query.proto:264:3: "cosmos.base.v1beta1.Coin" is not defined.
query.proto:273:3: "Params" is not defined.
query.proto:279:3: "cosmos.base.query.v1beta1.PageRequest" is not defined.
query.proto:286:12: "Metadata" is not defined.
query.proto:289:3: "cosmos.base.query.v1beta1.PageResponse" is not defined.
query.proto:302:3: "Metadata" is not defined.
query.proto:313:3: "cosmos.base.query.v1beta1.PageRequest" is not defined.
query.proto:326:3: "cosmos.base.v1beta1.Coin" is not defined.
query.proto:336:3: "cosmos.base.query.v1beta1.PageResponse" is not defined.
query.proto:347:3: "cosmos.base.query.v1beta1.PageRequest" is not defined.
query.proto:354:12: "SendEnabled" is not defined.
query.proto:357:3: "cosmos.base.query.v1beta1.PageResponse" is not defined.

我已经安装了协议版本 3.21.12,每个导入的路径文件都放置在正确的位置,但仍然出现错误。我也尝试过不同的 cosmos-sdk 版本,但问题对我来说仍然相同。 我的期望是运行命令后(protoc --go_out =.query.proto) 在 cosmos-sdk/proto/bank/v1beta1 路径中,它应该可以自由运行错误

解决方法

我在官方 cosmos sdk github 存储库上遇到了与同一问题相关的问题。 cosmos sdk 团队的两位核心工程师建议我使用“buf”而不是“protoc”来解决我的错误。我听从了他们的建议并成功解决了问题。

这是链接:

https://github.com/cosmos/cosmos-sdk/issues/16897  (closed)

以上是cosmos-sdk/proto/bank/v1beta1/query.proto 文件编译时错误的详细内容。更多信息请关注PHP中文网其他相关文章!

声明:
本文转载于:stackoverflow.com。如有侵权,请联系admin@php.cn删除