Being too clever merging protobufs

This is probably something lots of other people have tried and burnt themselves with, but anyway, this time it’s my turn. The goal is, given an arbitrary protobuf, can we write an API that applies default values to it? Normally we would create a prototype protobuf object with the defaults and merge our current object into it, updating the prototype object with current values. However, in Go, this would erase the type information and mean we would have to do some ugly casting (it’s easy to avoid this in C++ by using templates).
Read more...