Not sure if there's a better way of doing this, but then I serialise the AST into a JSON, #go's JSON encoder will encode the struct of each node, but I miss the type.
I want to include the node type.
LOL!
I did a search and I found this: https://jhall.io/posts/go-json-tricks-slightly-custom-marshaler/
So looks like I may be right after all!