mardi 24 mars 2020

How to load a .proto file in protoregistry

I need to simply load the contents of a few .proto files in https://pkg.go.dev/google.golang.org/protobuf/reflect/protoregistry

From what I can gather, I need to

  1. Load the contents of the file as a string.
  2. Use prototext to Unmarshal the string into a descriptorpb.FileDescriptorProto
  3. Initialize a ProtoFileDescriptor with that
  4. Finally I can register the ProtoFileDescriptor in a registry.

Do I really need to jump through all of these hoops, or am I completely missing another API.





Aucun commentaire:

Enregistrer un commentaire