> I wish the protobuf library wasn't awful
I’m curious what you don’t like about it? I haven’t used Go in anger, but I love protobufs, and it’s shocking that Go, of all languages, would have a substandard implementation.
I’m curious what you don’t like about it? I haven’t used Go in anger, but I love protobufs, and it’s shocking that Go, of all languages, would have a substandard implementation.
In particular, oneofs are *so* awful to work with that I'm often tempted to use an Any instead. For example:
message Image {
oneof kind {
Bitmap bitmap = 1;
Vector vector = 2;
}
}
Should, in my opinion, lead to code like this: img := &Image{Kind: &Bitmap{}}
But the reality looks more like this: img := &Image{Kind: &Image_Bitmap{Bitmap: &Bitmap{}}}
My other main gripe is that the generated structs embed a mutex, and so can't be copied, compared [ergonomically], or passed by value.Sadly, both of these issues are explained away as on the issue tracker.
(My use-case is primarily to share data structures across languages, so perhaps it's not totally aligned with what protobufs is trying to do. I just wish there was a better alternative.)