Add status package for reporting gRPC status and errors (#1156)

When an error implemented by the status package is returned from a service
handler, the server will transmit a rich status message in the
"grpc-status-details-bin" trailing metadata field if any detailed data is
attached to the error.  Client-side, we will decode them if present in the
server's response and return them to the user code performing the RPC.

This is backward compatible with the existing errors supported by the grpc
package.  However, the grpc.Errorf, grpc.Code and grpc.ErrorDesc functions for
managing errors are now deprecated; status.Errorf and status.Status type
asserions should be used instead.
17 files changed
tree: 97808990ed1e57f01c93c8539a9f8042e5d56770
  1. benchmark/
  2. codes/
  3. credentials/
  4. Documentation/
  5. examples/
  6. grpclb/
  7. grpclog/
  8. health/
  9. internal/
  10. interop/
  11. keepalive/
  12. metadata/
  13. naming/
  14. peer/
  15. reflection/
  16. stats/
  17. status/
  18. stress/
  19. tap/
  20. test/
  21. testdata/
  22. transport/
  23. .travis.yml
  24. backoff.go
  25. backoff_test.go
  26. balancer.go
  27. balancer_test.go
  28. call.go
  29. call_test.go
  30. clientconn.go
  31. clientconn_test.go
  32. codegen.sh
  33. CONTRIBUTING.md
  34. coverage.sh
  35. doc.go
  36. interceptor.go
  37. LICENSE
  38. Makefile
  39. PATENTS
  40. README.md
  41. rpc_util.go
  42. rpc_util_test.go
  43. server.go
  44. server_test.go
  45. stream.go
  46. trace.go
README.md

#gRPC-Go

Build Status GoDoc

The Go implementation of gRPC: A high performance, open source, general RPC framework that puts mobile and HTTP/2 first. For more information see the gRPC Quick Start guide.

Installation

To install this package, you need to install Go and setup your Go workspace on your computer. The simplest way to install the library is to run:

$ go get google.golang.org/grpc

Prerequisites

This requires Go 1.6 or later.

Constraints

The grpc package should only depend on standard Go packages and a small number of exceptions. If your contribution introduces new dependencies which are NOT in the list, you need a discussion with gRPC-Go authors and consultants.

Documentation

See API documentation for package and API descriptions and find examples in the examples directory.

Status

GA

FAQ

Compiling error, undefined: grpc.SupportPackageIsVersion

Please update proto package, gRPC package and rebuild the proto files:

  • go get -u github.com/golang/protobuf/{proto,protoc-gen-go}
  • go get -u google.golang.org/grpc
  • protoc --go_out=plugins=grpc:. *.proto