goprotoc icon indicating copy to clipboard operation
goprotoc copied to clipboard

Plugins Usage Example

Open tooolbox opened this issue 5 years ago • 2 comments

The plugins package has some decent documentation, but I can't tell how it's actually intended to be used. Could you create an example, perhaps in plugins/README.md?

As an idea, what if I wanted to codegen a copy of the structs created by protoc-gen-go, but with different struct tags? How would that look? I get a little taste of it from the docs but I feel like I'm missing a lot of context.

tooolbox avatar Nov 10 '19 00:11 tooolbox

@tooolbox, what kind of example are hoping to see? There is a high-level on in the package Go doc already: https://godoc.org/github.com/jhump/goprotoc/plugins#hdr-Interface_for_Protoc_Plugins

Do you mean like a fully-functioning plugin as an example, that also demonstrates interacting with the request and response (and maybe even using the GoNames type)?

jhump avatar Dec 14 '19 01:12 jhump

Do you mean like a fully-functioning plugin as an example, that also demonstrates interacting with the request and response (and maybe even using the GoNames type)?

Yes, exactly. In the example:

// Process req, generate code to resp

It's not clear how to do this from reading the code, so showing how you might do this would be awesome.

tooolbox avatar Dec 26 '19 21:12 tooolbox