protoc-gen-go: fix deprecated comment for grpc methods (#952)
diff --git a/protoc-gen-go/grpc/grpc.go b/protoc-gen-go/grpc/grpc.go
index 5d1e3f0..b15456f 100644
--- a/protoc-gen-go/grpc/grpc.go
+++ b/protoc-gen-go/grpc/grpc.go
@@ -166,6 +166,10 @@
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("}")
@@ -213,6 +217,10 @@
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("}")
diff --git a/protoc-gen-go/testdata/deprecated/deprecated.pb.go b/protoc-gen-go/testdata/deprecated/deprecated.pb.go
index 2515c99..1a7b03c 100644
--- a/protoc-gen-go/testdata/deprecated/deprecated.pb.go
+++ b/protoc-gen-go/testdata/deprecated/deprecated.pb.go
@@ -207,6 +207,8 @@
// Deprecated: Do not use.
type DeprecatedServiceClient interface {
// DeprecatedCall takes a DeprecatedRequest and returns a DeprecatedResponse.
+ //
+ // Deprecated: Do not use.
DeprecatedCall(ctx context.Context, in *DeprecatedRequest, opts ...grpc.CallOption) (*DeprecatedResponse, error)
}
@@ -234,6 +236,8 @@
// Deprecated: Do not use.
type DeprecatedServiceServer interface {
// DeprecatedCall takes a DeprecatedRequest and returns a DeprecatedResponse.
+ //
+ // Deprecated: Do not use.
DeprecatedCall(context.Context, *DeprecatedRequest) (*DeprecatedResponse, error)
}