protoc-gen-gotemplate icon indicating copy to clipboard operation
protoc-gen-gotemplate copied to clipboard

Add a flag to change which type to iterate over in order to create files

Open pmoroney opened this issue 7 years ago • 2 comments

I needed to generate a file per message as well as a single file with access to all of the AST. So I added a type flag that you can pass the following options: message: Generate a file per message definition, allows you to create files like {{.Message.Name}}.go.tmpl service: Generate a file per service definition. This was the previous behavior and is now the default. file: Generate a file per .proto file. This allows you to generate per file templates if those proto files have multiple service definitions. none: Generates a single file. This gives you access to .Files which is a slice of all the .File descriptors.

pmoroney avatar Jan 15 '18 18:01 pmoroney

Hi @pmoroney,

Can you add an example in the examples directory ? It will be easier to discover the flag features and that example can be used as kind of integration test

Thank you 😊

moul avatar Jan 17 '18 07:01 moul

Thanks for your patience, I will get to this as soon as I can :)

pmoroney avatar Jan 23 '18 19:01 pmoroney