If a type from another package (for example, a template) cannot be executed with any of the current serialization libraries for Go ( gob , json , bson, etc.). This also should not be done since the fields are not shown.
However, if you really need to, you can write your own serializer using the reflect package, in particular Value.Field() and friends, to get unallocated fields. Then you just need to save them so that you can decode later.
source share