Talking shop: Go and XML
Just separating out the tokenization, validation, and marshaling/unmarshaling parts into three different layers would make it more testable and readable, making issues easier to spot. It would also make it possible to encode a struct to a stream of tokens instead of bytes, which would greatly increase the speed of things that need to do that right now, and we could make the input/output stable across multiple encode/decodes, which would prevent downstream security issues.
The social network of the future: No ads, no corporate surveillance, ethical design, and decentralization! Own your data with Mastodon!