Skip to content

Commit

Permalink
grpc: document ctx closure best practices (#600)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeanbza authored and dsnet committed May 11, 2018
1 parent 7c4add5 commit 32a84b2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
7 changes: 4 additions & 3 deletions protoc-gen-go/grpc/grpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,12 +160,13 @@ func (g *grpc) generateService(file *generator.FileDescriptor, service *pb.Servi
deprecated := service.GetOptions().GetDeprecated()

g.P()
g.P("// Client API for ", servName, " service")
g.P()
g.P(fmt.Sprintf(`// %sClient is the client API for %s service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.`, servName, servName))

// Client interface.
if deprecated {
g.P(deprecationComment)
g.P("\n" + deprecationComment)
}
g.P("type ", servName, "Client interface {")
for i, method := range service.Method {
Expand Down
4 changes: 3 additions & 1 deletion 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.

5 changes: 3 additions & 2 deletions protoc-gen-go/testdata/grpc/grpc.pb.go

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

0 comments on commit 32a84b2

Please sign in to comment.