dsymonds / gotoc

Protocol Buffer compiler written in Go
Other
120 stars 8 forks source link

Add a flag to enable grpc. #4

Closed sbunce closed 7 years ago

sbunce commented 7 years ago

This is needed to get protoc-gen-go to output grpc code.

dsymonds commented 7 years ago

This will need a bit of thought. You're right that this is the required mechanism on the CodeGeneratorRequest edge, but I'm not sure I want to bake this in in this form. The specific plugins=grpc value only works with protoc-gen-go, and gotoc is trying to be agnostic to the generated language.

protoc handles this by overloading the --go_out flag. I'm not keen to follow that precedence. Maybe this should be a --params flag instead?

sbunce commented 7 years ago

I see your point. It does seem odd that protoc specifies plugins in the output flag value. My original solution of having a "-grpc" flag also doesn't seem quite right because we may want to specify additional plugins in the future.

I like your idea of "-params" because it allows us to specify additional plugins in the future without adding additional flags. I updated the pull request to use "-params".

No rush on this. This is an API change of sorts. Hard to change later.

sbunce commented 7 years ago

I kept looking at things in an overly-specific way. "-grpc", then "plugins=". Passing the raw parameters does seem like the best way to go. Thanks!

Updated the pull request.

dsymonds commented 7 years ago

Merged in 0071f33. Thanks!