Skip to content

Commit

Permalink
protoc-gen-go: fix deprecated comment for grpc methods (#952)
Browse files Browse the repository at this point in the history
  • Loading branch information
menghanl authored and dsnet committed Sep 20, 2019
1 parent 822fe56 commit 1680a47
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
8 changes: 8 additions & 0 deletions protoc-gen-go/grpc/grpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,10 @@ func (g *grpc) generateService(file *generator.FileDescriptor, service *pb.Servi
g.P("type ", servName, "Client interface {")
for i, method := range service.Method {
g.gen.PrintComments(fmt.Sprintf("%s,2,%d", path, i)) // 2 means method in a service.
if method.GetOptions().GetDeprecated() {
g.P("//")
g.P(deprecationComment)
}
g.P(g.generateClientSignature(servName, method))
}
g.P("}")
Expand Down Expand Up @@ -213,6 +217,10 @@ func (g *grpc) generateService(file *generator.FileDescriptor, service *pb.Servi
g.P("type ", serverType, " interface {")
for i, method := range service.Method {
g.gen.PrintComments(fmt.Sprintf("%s,2,%d", path, i)) // 2 means method in a service.
if method.GetOptions().GetDeprecated() {
g.P("//")
g.P(deprecationComment)
}
g.P(g.generateServerSignature(servName, method))
}
g.P("}")
Expand Down
4 changes: 4 additions & 0 deletions protoc-gen-go/testdata/deprecated/deprecated.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 1680a47

Please sign in to comment.