Skip to content

BUG: protoc-gen-gogofast not generate trailing comments #764

@hitzhangjie

Description

@hitzhangjie

for example, here's the protobuf:

syntax="proto3";
package hello;
...
message HelloRequest {
    // xxx111
    string msg = 1; // xxx222
}

Then execute the: protoc --gogofast_out=. hello.proto, the generated code is:

type HelloRequest struct {
    // xxx111
    Msg                  string   `protobuf:"bytes,1,opt,name=msg,proto3" json:"msg,omitempty"`                                                                        
    XXX_NoUnkeyedLiteral struct{} `json:"-"`
    XXX_unrecognized     []byte   `json:"-"`
    XXX_sizecache        int32    `json:"-"`
}

We could see, the trailing comments is not generated, while protoc-gen-go will handle both the leading and trailing comments. Please support this style of trailing comments.

This style of trailing comments will help align the fields, much clearer. It will improve readability. I won't have to switch between the *.pb.go and *.proto file.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions