vtprotobuf icon indicating copy to clipboard operation
vtprotobuf copied to clipboard

Uncompilable code generated for repeated groups

Open biosvs opened this issue 1 year ago • 0 comments

Groups are deprecated feature, but still available for use in proto2.

Following proto leads to uncompilable output:

syntax = "proto2";

message MyMessage {
    repeated group Group = 1 {
        optional int32 i32 = 1;
    }
}

Generated message contains slice of struct generated for group:

Group []*MyMessage_Group `protobuf:"group,1,rep,name=Group,json=group" json:"group,omitempty"`

VtProto generates code as it's just a message, not a slice:

size, err := m.Group.MarshalToSizedBufferVT(dAtA[:i])

l = m.Group.SizeVT()

m.Group.UnmarshalVT(dAtA[groupStart:maybeGroupEnd])

Expected behaviour: to handle it as list of messages.

biosvs avatar Oct 02 '23 12:10 biosvs