New Opaque API for GoBack in March 2020, we released the
google.golang.org/protobuf module,
a major overhaul of the Go Protobuf API. This package introduced first-class
support for reflection, a
dynamicpb implementation and the
protocmp package for easier testing.
That release introduced a new protobuf module with a new API. Today, we are releasing an additional API for generated code, meaning the Go code in the .pb.go files created by the protocol compiler (protoc). The blog post at
https://go.dev/blog/protobuf-opaque explains our motivation for creating a new API and shows you how to use it in your projects.
To be clear: We are not removing anything. We will continue to support the existing API for generated code, just like we still support the older protobuf module (by wrapping the
google.golang.org/protobuf implementation). Go is
committed to backwards compatibility and this applies to Go Protobuf, too!
Another change in v30
In v30.x, we are removing the following reflection-related function:
MutableRepeatedFieldRef<T>::Reserve().
An upcoming performance improvement in
RepeatedPtrField is incompatible with this API. The improvement is projected to accelerate repeated access to the elements of
RepeatedPtrField, in particular and especially sequential access.