From 0a18445f2559f91c7d54e0b9f71ca5d3413e723a Mon Sep 17 00:00:00 2001 From: "Victor M. Alvarez" Date: Fri, 23 Feb 2024 15:32:18 +0100 Subject: [PATCH] `root_message` changed to be the fully-qualified named of the root message. Before this change, the `root_message` field was message name alone, without its full path. After this change, `root_message` must be the fully-qualified name, which includes the package name. For instance, a message named `Foo` in a package `bar.baz`, will have a fully-qualified name `bar.baz.Foo`. --- generator/generator.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/generator/generator.go b/generator/generator.go index a3cbe43..d2c131b 100644 --- a/generator/generator.go +++ b/generator/generator.go @@ -68,9 +68,11 @@ func NewGenerator() *Generator { // // import "yara.proto" // +// package "foo" +// // option (yara.module_options) = { -// name : "foomodule" -// root_message: "FooMessage"; +// name : "foo" +// root_message: "foo.FooMessage"; // }; // // These options are required for the generator to be able to generate the YARA @@ -189,7 +191,7 @@ func (g *Generator) typeClass(t pb.FieldDescriptorProto_Type) typeClass { func (g *Generator) findMessage(fd *desc.FileDescriptor, messageType string) *desc.MessageDescriptor { for _, m := range fd.GetMessageTypes() { - if m.GetName() == messageType { + if m.GetFullyQualifiedName() == messageType { return m } }