Go Protobuf has introduced a new Opaque API to improve performance and memory efficiency by decoupling the generated code API from the in-memory representation. This change hides struct fields and replaces direct field access with getter and setter methods. The Opaque API supports lazy decoding and reduces pointer-related bugs. Migration to the Opaque API is recommended for new development, with a hybrid option available for existing codebases.

13m read timeFrom go.dev
Post cover image
Table of contents
Background: the (existing) Open Struct API ¶The new Opaque API ¶Migration ¶Next Steps ¶

Sort: