fullstorydev / grpchan

Channels for gRPC: custom transports
MIT License
204 stars 23 forks source link

Add support for `--go_opt=module=google.golang.org/protobuf` #51

Closed mtyrrell closed 3 years ago

mtyrrell commented 3 years ago

We recently started using grpchan for in-process servers and clients. It would be great to add support for the module option so that we can continue to use grpchan as part of our code generation strategy with buf generate.

Context

jhump commented 3 years ago

Note that this plugin cannot support --go_opt=module=... since that is only for the protoc-gen-go plugin. So instead, I've got a PR that would allow use of --grpchan_opt=module=..., which must mirror the option passed to protoc-gen-go.

The reason this plugin cannot key off of the --go_opt argument is due to how protoc works and how it invokes plugins: the go_opt args are only passed to the go plugin. Other plugins cannot see any args to protoc, only the ones that protoc chooses to pass along. So using --grpchan_opt would cause protoc to pass those same args to this plugin.

I hope that makes sense.

mtyrrell commented 3 years ago

Thank you for adding this so quickly! --grpchan_opt=module=... makes complete sense. I should have clarified that in the issue from the outset.