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

grpc: plugin flag for generate server-only or client-only #373

Closed
adam-26 opened this issue Jun 13, 2017 · 6 comments
Closed

grpc: plugin flag for generate server-only or client-only #373

adam-26 opened this issue Jun 13, 2017 · 6 comments

Comments

@adam-26
Copy link

adam-26 commented Jun 13, 2017

Can some flags be added to the grpc_go plugin to allow only the required code to be generated? As done in the C# plugin.

@dsnet dsnet changed the title [proto-gen-go] plugin flag for generate server-only or client-only grpc: plugin flag for generate server-only or client-only Feb 2, 2018
@dsnet dsnet added the grpc label Feb 2, 2018
@dsnet
Copy link
Member

dsnet commented Feb 2, 2018

\cc @dfawley. Inside Google, I believe is a movement to provide finer granularity control over what stubs are general.

@dfawley
Copy link
Contributor

dfawley commented Feb 2, 2018

I have not heard of any such movement yet. What is the significance of this request? IIUC the only difference is that slightly fewer methods would be in the generated file, which would have a negligible effect on binary size.

@dfawley
Copy link
Contributor

dfawley commented Feb 5, 2018

Ping for @adam-26 since I forgot to at-mention earlier.

@adam-26
Copy link
Author

adam-26 commented Feb 5, 2018

@dfawley, the issue was raised to allow for client code to be generated and distributed as part of an SDK without needing to include the server code. Nice to have, but not a blocking issue.

@paranoiacblack
Copy link
Contributor

I'm going to go ahead and say we're unlikely to add this to the upcoming release. As @dfawley notes changes here would likely have a negligible effect on binary size or performance. It seems that as a work around, the distributed SDK that @adam-26 mentioned can manually (or automatically) remove related server code from their generated proto package for the purpose of distributing a client-only implementation. It's not clear if this is overall useful for the grpc proto plugin.

Please re-open if you think there's more utility to this than meets the eye (or at least my eyes).

@mattes
Copy link

mattes commented Jun 30, 2019

From the C# plugin:

In a client library for other users, there's not much point in making the server API available, and it adds to pollution in the namespace.

Not only pollution, but also potentially confusing to user.

The distributed SDK can manually (or automatically) remove related server code.

That's what we are doing now. Yet, it would be nice if the server related code could be omitted with a flag in the first place.

@golang golang locked as resolved and limited conversation to collaborators Jun 26, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants