go-genproto
go-genproto copied to clipboard
Please generate these files with google.golang.org/grpc/cmd/protoc-gen-go-grpc
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: https://github.com/golang/protobuf/issues/1378
Would it be possible to alter this repo to use protoc-gen-go-rpc instead?
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.
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.
As a workaround you can always generate the files yourself if you need. All public protos are located here: https://github.com/googleapis/googleapis
Yeah, I’m already working around it by letting Bazel apply a patch against the .pb.go files.
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