Skip to content

protoc-gen-go-grpc: copy service comment to interfaces #7233

@rittneje

Description

@rittneje

Use case(s) - what problem will this feature solve?

We can add comments to a service in our proto file.

// Here we can document how the service works, when to use it, etc.
service MyService {
}

However, they are currently completely ignored by protoc-gen-go-grpc. It instead puts a boilerplate comment on the client and server interfaces.

// MyServiceClient is the client API for MyService service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
type MyServiceClient interface {
}
// MyServiceServer is the server API for MyService service.
// All implementations must embed UnimplementedMyServiceServer
// for forward compatibility
type MyServiceServer interface {
}

Proposed Solution

Fix protoc-gen-go-grpc to copy over the comments from the service to the interfaces instead of the boilerplate comments.

Note that generators for other languages already do this properly.

Alternatives Considered

None.

Additional Context

None.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions