Are there serialization formats that support Go generics?
I'd like to take a look at how they do it, if they exist.
I'm wondering: Do they use reflection at runtime?
and/or: Do they parse the source looking for template instantiations at go:generate time
to codegen for all possible instantiations?
I used to just skip generic structs, but now I serialize them and just skip the
fields that contain type parameters; there are pre/post load hooks that can
be used to manually add reflection code, if desired.
I'm thinking that (for automatic support) reflection at runtime for any generic fields is probably the only sane way to go; but I'd be glad to be aware of other possible approaches.
At the moment I parse the source code at go:generate time and look for instantiations of generics; using the first found instantiation to generate the automatic test code.
Thanks for any ideas.
Jason