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

Make generator play nice with plugin imports #434

Closed
meling opened this issue Sep 29, 2017 · 2 comments
Closed

Make generator play nice with plugin imports #434

meling opened this issue Sep 29, 2017 · 2 comments

Comments

@meling
Copy link

meling commented Sep 29, 2017

Referring to generator.go#L1353, it would be much preferred if plugins were asked to supply a list or map of imports and let the generateImports() method take care of ensuring uniqueness, emitting what is needed. As a plugin author I currently need to write intricate checks based on what comes in through the generator.FileDescriptor. Right now, I'm getting an import emitted twice for some proto files, and once on other files.

A breaking change would be to change the signature of GenerateImports(file *generator.FileDescriptor) to return a slice of imports, but I'm guessing that wouldn't be acceptable. So perhaps a better alternative would be to add another interface, which if implemented by the plugin is called instead of GenerateImports.

@dsnet
Copy link
Member

dsnet commented Dec 6, 2017

The generator is documented as having no compatibility guarantees. Users of the API should vendor the generator.

That being said, the plugin API was primarily designed just for gRPC's use case and falls flat for other use cases and is definitely not considered stable.

A stable and more expressive API would be great, but it's not on the radar for the foreseeable future.

@dsnet dsnet added this to the Unplanned milestone Dec 6, 2017
@dsnet
Copy link
Member

dsnet commented Mar 8, 2018

Support for plugins in general needs to be discussed. If we decide to provide first-class support for plugins, there will probably be an entire redesign.

Closing this in favor of the umbrella issue #547.

@dsnet dsnet closed this as completed Mar 8, 2018
@golang golang locked 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

2 participants