如何使用插件使用旧版本的Protoc-Gen-Go

发布于 2025-01-27 11:04:54 字数 376 浏览 3 评论 0原文

我无法生成

protoc -I=./ --go_out=plugins=grpc:. code/proto/*
--go_out: protoc-gen-go: plugins are not supported; use 'protoc --go-grpc_out=...' to generate gRPC

See https://grpc.io/docs/languages/go/quickstart/#regenerate-grpc-code for more information.
make: *** [protoc-gen] Error 1

我不想使用新版本原因再生的grpc的杂质文件,而不是向后兼容,我需要使用该版本(我找不到是哪个)可以运行使用插件

I'm not being able to generate the protobuffer files for grpc

protoc -I=./ --go_out=plugins=grpc:. code/proto/*
--go_out: protoc-gen-go: plugins are not supported; use 'protoc --go-grpc_out=...' to generate gRPC

See https://grpc.io/docs/languages/go/quickstart/#regenerate-grpc-code for more information.
make: *** [protoc-gen] Error 1

I don't want to regenerate using the new version cause is not backwards compatible, I need to use the version (I don't find which one is it) that can run with plugins

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

怀里藏娇 2025-02-03 11:04:54

我能够使用此命令生成有效的代码(没有破坏任何内容)。首先使用-go-grpc_out作为替代之前使用的GRPC插件,然后使用此标志require_unimplemented_servers = false = false,以避免添加额外的方法,如果您使用polimorthism,则可以破坏代码

protoc -I=./ --go-grpc_out=require_unimplemented_servers=false:.  --go_out=.  code/proto/*

I've been able to generate valid code (doesnt break anything) with this command. First using --go-grpc_out as a replacement of the grpc plugin used before and second using this flag require_unimplemented_servers=false to avoid adding an extra method that can break your code if you're using polimorphism

protoc -I=./ --go-grpc_out=require_unimplemented_servers=false:.  --go_out=.  code/proto/*
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文