Skip to content

Commit

Permalink
root_message changed to be the fully-qualified named of the root me…
Browse files Browse the repository at this point in the history
…ssage.

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`.
  • Loading branch information
plusvic committed Feb 23, 2024
1 parent aae9131 commit 0a18445
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions generator/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
}
}
Expand Down

0 comments on commit 0a18445

Please sign in to comment.