protoc-gen-gotemplate
protoc-gen-gotemplate copied to clipboard
Add a flag to change which type to iterate over in order to create files
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.
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 😊
Thanks for your patience, I will get to this as soon as I can :)