Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncompilable code generated for repeated groups #100

Open
biosvs opened this issue Oct 2, 2023 · 0 comments
Open

Uncompilable code generated for repeated groups #100

biosvs opened this issue Oct 2, 2023 · 0 comments

Comments

@biosvs
Copy link
Contributor

biosvs commented Oct 2, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant