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.
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!
"I appreciate SDF but it's a general-purpose server and the name doesn't make it obvious that it's about art." - Eugen Rochko