Uncompilable code generated for repeated groups

Open
#100 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
go
Domain
devtools

Research direction

Start with the proto2 repeated-group example and inspect the generated Go field alongside the MarshalToSizedBufferVT, SizeVT, and UnmarshalVT entry points shown in the report. Trace how repeated groups are handled and verify that generated output treats them as a list of messages and compiles.

Written by the indexing model from the issue text.

Description

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.

Dominant language
Go
Stars
1.1k
Forks
112
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from planetscale/vtprotobuf

All issues in planetscale/vtprotobuf

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.