samuel / go-thrift

A native Thrift package for Go

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

generator: separate packages from imports

samuel opened this issue · comments

Right now the generator can only create a single Go file which includes all imports. It would be good to be able to create separate packages from the imports instead of bundling. This would allow for multiple uses of the imports, and it would fix some import namespace issues.

When includes are involved there are likely multiple thrift interfaces sharing the include, if you generated the include package automatically you may end up generating it twice. Would it be easier to have the generator look at the include but not automatically generate, or even have a command line option to toggle this behavior. For my particular use case it is easier to call generate on each .thrift file without worrying about side effects on each generation. Another option could be just supporting multiple input files to the generator, then you could just run command like ./generator *.thrift -outputdir src.