@adlrocha - Never take Marshaling for granted
Marshaling dynamic types in Go.
|Alfonso de la Rocha||Mar 21|
We sometimes take marshaling for granted, but there is more than one occasion in which you have no choice but to write your own custom marshaller. Either because your compiler/marshal library is not able to infer how to automatically marshal your objects, because your marshaler is not generating the right output (we saw last week how a JSON document can be parsed with different values across microservices, leading to a variety of potential security risk), etc. The fact is that for one reason or the other, one day you may end up having to tinker with your marshaller, and you better be prepared if you don’t want to drain your time trying to make things work. This is exactly what happened to me this week. Let me walk you through the marvelous world of interface marshaling in Golang.
This publication is full of code and it was hard to make it readable directly from Substack. I have been forced to host it somewhere else to offer you the best of the experiences. If you want to keep reading, go here.