This release deprecates some packages that have newer alternatives in the Protobuf runtime. It also includes some small additions to the grpcreflect
and desc/sourceinfo
packages. The rest of the changes are bug fixes.
"github.com/jhump/protoreflect/desc"
Changes:
- This package is now deprecated. Though use of this package is still needed in order to use a handful of other packages in this repo, many usages should instead prefer the
"google.golang.org/protobuf/reflect/protoreflect"
package in the Protobuf runtime. In a v2 of this repo, this package will no longer be present. - A performance improvement was contributed that speeds up the
MessageDescriptor.FindFieldByName
method.
"github.com/jhump/protoreflect/desc/protoparse"
Changes and bugfixes:
- This package is now deprecated. Most usages should instead prefer the
"github.com/bufbuild/protocompile"
package. There are some behavioral differences that we hope to address with additional API and enhancements toprotocompile
. But theprotoparse
package here is just a veneer on top ofprotocompile
and we plan to do as little maintenance as possible here. In a v2 of this repo, this package will no longer be present. - The
protocompile
dependency has been updated to use a more recent version of that package. This addresses potential panics when callingParser.ParseButDontLink
.
"github.com/jhump/protoreflect/desc/sourceinfo"
Changes and bugfixes:
- A possible panic when calling
sourceinfo.GlobalFiles.FindDescriptorByName
has been fixed. - Descriptors returned from the
sourceinfo.GlobalFiles
registry or from the variousWrap*
functions could induce panics in user code if querying for non-existent elements. For example, callingmessageDescriptor.Fields().ByNumber(123)
could return a typed-nil value on failure, instead of a nil interface. This would result in nil-dereference panics if methods were called on this later. These have been fixed. - Descriptors returned from the
sourceinfo.GlobalFiles
registry and from the variousWrap*
functions had concrete types defined in this package, not in the Protobuf runtime. But theprotoreflect.Descriptor
interface has a "do not implement" marker, indicating that concrete types implementing the interface should not be implemented outside of that module. To avoid future issues with the Protobuf runtime, there are no more implementations in this repo. Instead of wrapping other descriptor implementations (via embedding, and then overriding some methods), this package now builds new descriptors, using theprotodesc
package in the Protobuf runtime module. - The various
Wrap*
functions are now deprecated. The name is no longer accurate since they no longer return wrapper values. Also the new implementation, which builds new descriptors, can fail (though unlikely), but the existing signature of these functions did not allow for returning an error. So these functions could possibly panic in the face of malformed input descriptors. Users should use the newAddSourceInfoTo*
versions of these functions instead.
Additions:
- Adds
AddSourceInfoTo*
functions to replace theWrap*
functions. These functions augment the input descriptors by adding source code information to them.
"github.com/jhump/protoreflect/dynamic"
Changes:
- This package is now deprecated. Most usages should instead prefer the
"google.golang.org/protobuf/types/dynamicpb"
package in the Protobuf runtime. In a v2 of this repo, this package will no longer be present.
"github.com/jhump/protoreflect/grpcreflect"
Additions:
- Adds a new
NewClientV1
function to return a client that uses v1 of the server reflection service. This fills the gap in the existing factory functions,NewClientV1Alpha
andNewClientAuto
. - Adds a new
AllowFallbackResolver
method to the*grpcreflect.Client
type. This allows the client to be configured with an alternate resolver that can be used as a backup when trying to satisfy dependencies, for cases where the remote server is non-authoritative and unable to provide all of them.