protoc-gen-go-grpc: support proto edition
ukai opened this issue · comments
Please see the FAQ in our main README.md before submitting your issue.
Use case(s) - what problem will this feature solve?
Please add edition support in protoc-gen-go-grpc.
https://protobuf.dev/editions/overview/
protoc-gen-go@v1.33.0 works with protoc@v26.1 with --experimental_editions
, but
protoc-gen-go-grpc can't use it
protoc-gen-go-grpc: invalid FileDescriptorProto "local_rpc_service.proto": proto: invalid syntax: "editions"
--go-grpc_out: protoc-gen-go-grpc: Plugin failed with status code 1.
Proposed Solution
Support "edition" in protoc-gen-go-grpc.
Alternatives Considered
Keep legacy proto2/3 when using grpc.
Additional Context
It would be great to add editions
support to protoc-gen-go-grpc. However this is not something the team has cycles to prioritize at the moment. Please feel free to send us a PR and we would love to take a look at it.
FYI, this should be trivial to add once protobuf-go issues a new release and you bump your dependency. Edition 2023 has no grpc-relevant features (unless you want to add some), so the following should be sufficient in your main plugin file:
gen.SupportedFeatures = uint64(pluginpb.CodeGeneratorResponse_FEATURE_PROTO3_OPTIONAL | pluginpb.CodeGeneratorResponse_FEATURE_SUPPORTS_EDITIONS)
gen.SupportedEditionsMinimum = descriptorpb.Edition_EDITION_PROTO2
gen.SupportedEditionsMaximum = descriptorpb.Edition_EDITION_2023
We need to wait for protobuf-go version 1.34 to be released which should include this commit that adds support for the editions feature.