samuel / go-thrift

A native Thrift package for Go
BSD 3-Clause "New" or "Revised" License
384 stars 110 forks source link

generator: separate packages from imports #11

Open samuel opened 11 years ago

samuel commented 11 years ago

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.

dmcgowan commented 11 years ago

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.