moul / protoc-gen-gotemplate

:open_file_folder: generic protocol generator based on golang's text/template (grpc/protobuf)
https://manfred.life/protoc-gen-gotemplate
MIT License
438 stars 68 forks source link

Support Dependency Lookup #62

Closed moul closed 7 years ago

moul commented 7 years ago

It breaks calling protoc with multiple *.proto files from different packages, i.e.:

$ protoc -I. -I./vendor --gotemplate_out=debug=true,template_dir=../.proto-templates:.. ./aaa/aaa.proto ./bbb/bbb.proto
2017/05/18 19:33:53 protoc-gen-go: error:registry: failed to load the request:inconsistent package names: aaa bbb

This is caused by the addition of this package (used to lookup protobuf Messages across all the imported files.

Except if someone would want to recode this package without the pain it brings, I'm for adding a new flag in the main.go file to switch between single-package with import support and multiple-packages without import support modes

cc @vgheri @jhayotte @proullon, what do you think?

proullon commented 7 years ago

if the previous behavior stays the default one, then sgtm. I guess multiple package with import is an edge case

moul commented 7 years ago

Refactored the PR to take @proullon's https://github.com/moul/protoc-gen-gotemplate/pull/62#issuecomment-302506895 into account