Huangyan9188 / gogoprotobuf

Automatically exported from code.google.com/p/gogoprotobuf
Other
0 stars 0 forks source link

support extra code generation for import public #22

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
protoc-gen-gogo/generator/helper.go

Add this method

func (d *FileDescriptor) AllMessages() []*Descriptor {
    msgs := d.desc
    for _, i := range d.imp {
        obj, ok := i.o.(*Descriptor)
        if ok {
            msgs = append(msgs, obj)
        }
    }
    return msgs
}

In each plugin there are gogoproto.Has/Is functions
At the moment they reference the current file, but they should reference the 
file in which the message/field was originally defined.

If the message was publicly imported its code generation should depend upon the 
file in which it was defined not the file which publicly imports it.

Most of it should work after this work is done.

Original issue reported on code.google.com by awalterschulze on 7 Aug 2014 at 11:59

GoogleCodeExporter commented 9 years ago
If this is feature is important to you please comment so I can push up the 
priority.

Original comment by awalterschulze on 7 Aug 2014 at 12:00