In generating serialization code for structs that contain parameterized generic types, I current utilize "golang.org/x/tools/go/packages"
and its Load() function. To give specifics, see here for instance:
https://github.com/glycerine/greenpack/blob/master/parse/generics.go#L124
So greenpack serialization, abstractly similar to protocol buffers (which does not support generics at all), can support some generic type serialization.
However it is off by default, since scanning for generics instantiation makes "go:generate greenpack" very slow.
The Go compiler is fast, and must also do the work of locating and processing instantiations during compilation.
It would be nice to be able to leverage this speed in serialization libraries too.
I don't know the most appropriate API, but perhaps awareness of the pain point might enable a feature in the future to accomplish the aim described above if an opportunity presented itself, or it even "almost feel out for free" during a refactor.
Generic types could then be truly first class citizens in Go data.
Again, not really a bug--just a "this would really be nice to have."
Thank you.
Comment From: seankhliao
closing as there doesn't appear to be any clear action to take. Please use other forums for general discussion.