Hacker News new | past | comments | ask | show | jobs | submit login
Show HN: Protobuf-go-lite: reflection-free protobuf for Go with JSON support (github.com/aperturerobotics)
1 point by aperturecjs 18 days ago | hide | past | favorite | 1 comment



Hi HN,

protobuf-go is a widely used binary serialization library and IDL for protobuf in Go. The upstream library leverages reflection to provide a wide variety of features which are useful in a server context.

Go is increasingly being used for resource-constrained environments like embedded (tinygo) and WebAssembly. In these environments, reflection is not always available, and when it is, it adds significant weight to the binary size.

vtprotobuf: https://github.com/planetscale/vtprotobuf - compiles static code generation for Protobufs in go, including functions to marshal, unmarshal, size, clone, messages. However, it still requires protobuf-go and the reflection-based code for the message structs.

protobuf-go-lite takes this one step further with a stripped-down version of the protobuf-go code generator modified to work without reflection and merged with vtprotobuf to provide modular features with static code generation for marshal/unmarshal, size, clone, and equal. It bundles a fork of protoc-gen-go-json for JSON support.

It has already been used (experimentally) for a reflection-free version of OpenTelemetry for Go: https://github.com/gburek-fastly/opentelemetry-proto-go/pull... as well as other projects at Aperture Robotics.

Thanks & have a great Friday!

~ Christian Stewart https://cjs.zip




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: