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 templates self-contained and pluginable #531

Closed
wants to merge 1 commit into from

Conversation

Reflejo
Copy link
Contributor

@Reflejo Reflejo commented Nov 1, 2021

This change introduces templates as plugins, meaning consumers of PGV can now provide a go-plugin to serve as a template instead of relying in the built-in ones. Note the ones that were built in were slightly refactored to compose a TemplatePlugin type but functionality were left untouched and are embedded the same way to reduce the blast radius of this change.

Example invocation with this change:

$ protoc \
  -I .\
  -I ${GOPATH}/src \
  -I ~/src/protoc-gen-validate \
  --go_out=":." \
  --validate_out="lang-plugin=plugin-test/ccnop.so:." \
  --go_opt=Mexample.proto=./ \
  example.proto

This change introduces templates as plugins, meaning consumers of PGV
can now provide a go-plugin to serve as a template instead of relying in
the built-in ones. Note the ones that were built in were slightly
refactored to compose a `TemplatePlugin` type but functionality were
left untouched and are embedded the same way to reduce the blast radius
of this change.

Signed-off-by: Martin Conte Mac Donell <reflejo@gmail.com>
@@ -35,6 +35,7 @@ go_proto_library(
name = "validate_go_proto",
importpath = "github.com/envoyproxy/protoc-gen-validate/validate",
proto = ":validate_proto",
gc_goopts = ["-trimpath=$(BINDIR)=>."],
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an important change for go plugins to work. see more info about this on: bazelbuild/rules_go#2994

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the rules_go fix is now merged!

@Reflejo Reflejo marked this pull request as ready for review November 3, 2021 23:31
@stale
Copy link

stale bot commented Apr 16, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the Stale Activity has stalled on this issue/pull-request label Apr 16, 2022
@stale stale bot closed this Apr 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Stale Activity has stalled on this issue/pull-request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant