v1.12.0
This change includes a new feature related to source code information for compiled-in proto descriptors. It also includes some other bug fixes.
"github.com/jhump/protoreflect/desc"
Changes/fixes:
- The
FindSymbol
method ofFileDescriptor
would panic if given an empty string as the symbol name. This has been fixed. This case now returns a nil descriptor, indicating no element with the given name could be found. - The various
Load*
functions will return descriptors that include comment information (and the underlyingFileDescriptorProto
will contain source code info) if theprotoc-gen-gosrcinfo
plugin was used to generate additional Go code for these proto files.
"github.com/jhump/protoreflect/desc/protoprint"
Changes/fixes:
- If an option included a message type, and was printed as a compact message literal, it had an errant extra space before the final closing '}' symbol. This is fixed, and these are now printed with a single space between the last field value and the closing brace.
"github.com/jhump/protoreflect/desc/sourceinfo"
This is a brand new package which allows for registering source code information for a proto source file. It also includes some API for using/querying the source code info. This is useful to retain comments for compiled and linked-in descriptors. It is not expected that users would explicitly register source code info; instead use the protoc-gen-gosrcinfo
plugin, in addition to protoc-gen-go
, when compiling your proto sources.
"github.com/jhump/protoreflect/desc/sourceinfo/cmd/protoc-gen-gosrcinfo"
This is a brand new command which is a protoc
plugin for augmenting compiled and linked-in descriptors with source code information. When used, the desc
package can include source code info (and thus comments) when loading linked-in descriptors. The desc/sourceinfo
package can be used to query for the source code info and can be useful for integrating this data with other things, such as gRPC server reflection.