tinylib / msgp

A Go code generator for MessagePack / msgpack.org[Go]
MIT License
1.79k stars 190 forks source link

unnecessary wrapping #308

Closed artvel closed 1 week ago

artvel commented 2 years ago

Having a structure like:

type A struct {
 Field1 int
 Field2 string
}
type B struct {
 A
}

Produces currently an unnecessary wrapped outcome:

B.A.Field1
B.A.Field2

Expected outcome:

B.Field1
B.Field2
photoszzt commented 2 years ago

there's a flatten tag which implements this behavior.

type B struct { A `msg",flatten" }

But it seems it only works if A and B is in the same file. This breaks if it's in a different file. Worse, it doesn't print any warning that it skips a field during generation.

klauspost commented 6 months ago

Is there any actual problems arising from this?