Skip to content

Generated code is not reproducible when multiple plugins are specified #474

Closed
@ashi009

Description

@ashi009

So far this is not a problem, as there is only one plugin built in to protoc-gen-go. However when more than one plugin is registered the generator may behave unexpectedly.

This is caused by two issues:

  1. RegisterPlugin is called from init() and the execution sequence is not guaranteed (though it's possible to manually control the import sequence and hope go doesn't change it's behavior on handling import packages).
  2. Registered plugins are filtered against the list of plugin to use from user input at runtime. Meaning, the order of plugins to use doesn't affect the final output -- it will always be unpredictable. What makes things worse is that, unknown plugin will be ignored silently.

I think the second place is the best place to fix this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions