grpc-go README

The project's README from github.com/grpc/grpc-go. As one markdown file: README.md.

gRPC-Go

GoDoc GoReportCard codecov

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 Go gRPC docs, or jump directly into the quick start.

Prerequisites

Installation

Simply add the following import to your code, and then go [build|run|test] will automatically fetch the necessary dependencies:

import "google.golang.org/grpc"

Note: If you are trying to access grpc-go from China, see the FAQ below.

Learn more

FAQ

I/O Timeout Errors

The golang.org domain may be blocked from some countries. go get usually produces an error like the following when this happens:

$ go get -u google.golang.org/grpc
package google.golang.org/grpc: unrecognized import path "google.golang.org/grpc" (https fetch: Get https://google.golang.org/grpc?go-get=1: dial tcp 216.239.37.1:443: i/o timeout)

To build Go code, there are several options:

Compiling error, undefined: grpc.SupportPackageIsVersion

Please update to the latest version of gRPC-Go using go get google.golang.org/grpc.

How to turn on logging

The default logger is controlled by environment variables. Turn everything on like this:

$ export GRPC_GO_LOG_VERBOSITY_LEVEL=99
$ export GRPC_GO_LOG_SEVERITY_LEVEL=info

The RPC failed with error "code = Unavailable desc = transport is closing"

This error means the connection the RPC is using was closed, and there are many possible reasons, including:

  1. mis-configured transport credentials, connection failed on handshaking
  2. bytes disrupted, possibly by a proxy in between
  3. server shutdown
  4. Keepalive parameters caused connection shutdown, for example if you have configured your server to terminate connections regularly to trigger DNS lookups. If this is the case, you may want to increase your MaxConnectionAgeGrace, to allow longer RPC calls to finish.

It can be tricky to debug this because the error happens on the client side but the root cause of the connection being closed is on the server side. Turn on logging on both client and server, and see if there are any transport errors.

grpc-go (grpc/grpc-go)

Searching Database…

23.1K ·GitHub
What is this?The Go implementation of gRPC: a high performance, open source, general RPC framework that puts mobile and HTTP/2 first. You use it to build gRPC clients and servers in Go.
Is gRPC-Go something I deploy, or a library I code against?A library you import into your own Go programs (the README calls it a general RPC framework). You write both client and server code with it; there is no standalone binary or service to run.
How do I add it to a project?Add the google.golang.org/grpc import to your code — go build, go run and go test will then fetch the necessary dependencies automatically.
Which Go version do I need installed first?Any one of the two latest major Go releases.
Are there any known connection pitfalls?The classic gotcha is the 'code = Unavailable desc = transport is closing' error: the connection the RPC used was closed — commonly misconfigured transport credentials, bytes disrupted by a proxy, server shutdown, or keepalive parameters.
Is there a benchmark or example code to look at first?Yes — the repository links a performance benchmark and ships examples, alongside low-level technical docs and a quick start in the Go gRPC docs.
How mature is this project?It has been developed since December 2014, counts about 23k GitHub stars, and its CI runs CodeQL, coverage, dependency and govulncheck workflows.
Is it only useful for microservices?No — the README calls it a general RPC framework; its GitHub topics do highlight microservices, rpc and proto, but nothing restricts it to that use case.
What are similar projects?grpc-java, grpc-rust, brpc, kratos, flatbuffers, chi, fiber, grpc-gateway
Creator
grpc
Size
45.5 MB
Stars
23.1K
Age
11y
Commits · 90 Days