By default, generate each .bop file to a single .go file, with a const go_package hint for where those files should be found
Optionally, instead generate a single file containing all definitions in the entire import tree. This is what https://github.com/RainwayApp/bebop does, and may be necessary if working with a file you can't change to add a package hint.
We offer (1) instead because (2) is infeasible for a complex system. If you had a large app built on bebop structures you would either need a single place that stored every definition used in the app, which would eventually fail as file sizes increased and would have a bad developer experience, or you'd need to have partial definitions throughout the codebase, which would get confusing and an additional import added somewhere could cause a cascading file size bloat.
In addition,
This fixes a bug where unions could not be fields of Structs or Messages
Duplicate const names will now cause an error in the compiler.
iohelp.ErrTooShort has been superceded by io.ErrUnexpectedEOF
Unions and Messages will no longer read their full bodies up front when reading from a io.Reader.
iohelp.ErrorReader.Read will now wait until the complete payload it expects is available to read.
Code and template duplication in generation has been significantly reduced, fixing some inconsistencies.
I'm not 100% confident this implementation works in all cases as is, but have decided to push it forward and resolve bugs as they arise instead of attempting to generate further test cases right now.
This adds import support in two operating modes-
const go_package
hint for where those files should be foundWe offer (1) instead because (2) is infeasible for a complex system. If you had a large app built on bebop structures you would either need a single place that stored every definition used in the app, which would eventually fail as file sizes increased and would have a bad developer experience, or you'd need to have partial definitions throughout the codebase, which would get confusing and an additional import added somewhere could cause a cascading file size bloat.
In addition,
const
names will now cause an error in the compiler.iohelp.ErrTooShort
has been superceded byio.ErrUnexpectedEOF
io.Reader
.iohelp.ErrorReader.Read
will now wait until the complete payload it expects is available to read.I'm not 100% confident this implementation works in all cases as is, but have decided to push it forward and resolve bugs as they arise instead of attempting to generate further test cases right now.