The implementation of this is pretty interesting, in that it generates code that imports your code, compiles it, and then uses reflection to generate the serialization code. And in the end, that worked out better for the author than using the AST.
*: https://code.google.com/p/go/source/browse/cmd/oracle/main.g...