Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please generate these files with google.golang.org/grpc/cmd/protoc-gen-go-grpc #1040

Open
EdSchouten opened this issue Jul 27, 2023 · 7 comments
Assignees
Labels
priority: p3 Desirable enhancement or fix. May not be included in next release. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.

Comments

@EdSchouten
Copy link

It looks like the .pb.go files in this repository are being generated with github.com/golang/protobuf/protoc-gen-go. Though this works, it has the annoying side-effect that all Register*Server() functions depend on concrete type *grpc.Server instead of grpc.ServiceRegistrar. This makes it harder to stub out gRPC server implementations. See: golang/protobuf#1378

Would it be possible to alter this repo to use protoc-gen-go-rpc instead?

@EdSchouten EdSchouten added priority: p3 Desirable enhancement or fix. May not be included in next release. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. labels Jul 27, 2023
@codyoss
Copy link
Member

codyoss commented Jul 31, 2023

Hey I am not sure if we are likely to do this anytime soon as this would be a breaking change to everything. Can you please explain the use case for needing to implementing a server -- there may be other patterns you could use I am thinking.

@codyoss codyoss self-assigned this Jul 31, 2023
@codyoss codyoss added type: question Request for information or clarification. Not an issue. and removed type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. labels Jul 31, 2023
@EdSchouten
Copy link
Author

EdSchouten commented Jul 31, 2023

You need it if you want to register a service against a gRPC server that was created using the xDS package:

https://pkg.go.dev/google.golang.org/grpc/xds#NewGRPCServer

That package offers a custom server type that’s different from *grpc.Server. But it does implement grpc.ServiceRegistrar.

@codyoss codyoss added type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. status: investigating The issue is under investigation, which is determined to be non-trivial. and removed type: question Request for information or clarification. Not an issue. labels Jul 31, 2023
@codyoss
Copy link
Member

codyoss commented Jul 31, 2023

As a workaround you can always generate the files yourself if you need. All public protos are located here: https://github.com/googleapis/googleapis

@EdSchouten
Copy link
Author

Yeah, I’m already working around it by letting Bazel apply a patch against the .pb.go files.

@codyoss
Copy link
Member

codyoss commented Jul 31, 2023

After some discussion I think will will make the switch sometime in the future, but I don't have a timeline to share. I will leave this issue open for tracking purposes. Thanks for the request

@codyoss
Copy link
Member

codyoss commented Nov 15, 2024

We sent out a warning a few weeks back about making this change in Dec. Example message shared in our cloud releases:

 On approximately Dec 1, 2024, an update to Protobuf will change service registration function signatures to use an
interface instead of a concrete type in generated .pb.go files. This change is expected to affect very few if any users of 
this client library. For more information, see https://togithub.com/googleapis/google-cloud-go/issues/11020.
([2b8ca4b](https://github.com/googleapis/google-cloud-go/commit/2b8ca4b4127ce3025c7a21cc7247510e07cc5625))

@EdSchouten
Copy link
Author

That’s awesome, Cody. Really appreciated!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: p3 Desirable enhancement or fix. May not be included in next release. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.
Projects
None yet
Development

No branches or pull requests

2 participants