The Go language implementation of gRPC. HTTP/2 based RPC
Go to file
Arjan Singh Bal 183c148c4e
balancer/ringhash: Add experimental notice in package comment (#8364) (#8365)
2025-05-28 15:26:25 +05:30
.github github: replace actions/upload-release-asset@v1 with gh cli (#8264) 2025-04-23 11:29:31 -07:00
Documentation cleanup: replace dial with newclient (#8196) 2025-05-12 10:57:47 +05:30
admin
attributes
authz
backoff
balancer balancer/ringhash: Add experimental notice in package comment (#8364) (#8365) 2025-05-28 15:26:25 +05:30
benchmark
binarylog
channelz
cmd/protoc-gen-go-grpc
codes
connectivity
credentials cleanup: replace dial with newclient (#8196) 2025-05-12 10:57:47 +05:30
encoding
examples examples/features/opentelemetry: demonstrate tracing using OpenTelemetry plugin (#8056) 2025-04-17 10:42:51 +05:30
experimental
gcp/observability
grpclog
health health: Add List method to gRPC Health service (#8155) 2025-05-09 09:02:21 +05:30
internal delegatingresolver: avoid proxy for resolved addresses in NO_PROXY env (#8329) (#8354) 2025-05-23 22:29:27 +05:30
interop
keepalive
mem
metadata
orca
peer
profiling
reflection
resolver ringhash: implement gRFC A76 (#8159) 2025-04-08 15:50:54 +05:30
scripts
security/advancedtls
serviceconfig
stats cleanup: replace dial with newclient (#8196) 2025-05-12 10:57:47 +05:30
status transport: skip Status.Proto() without details in writeStatus (#8282) 2025-05-07 23:50:46 +05:30
tap
test transport: Prevent sending negative timeouts (#8312) 2025-05-14 09:15:09 +05:30
testdata testdata: Wrap lines to 80 columns in markdown file (#8235) 2025-04-08 14:32:55 +05:30
xds cleanup: remove unused constants in generic xdsclient (#8315) 2025-05-14 09:53:59 +05:30
AUTHORS
CODE-OF-CONDUCT.md
CONTRIBUTING.md grpc: update contributing.md (#8318) 2025-05-14 14:37:25 +05:30
GOVERNANCE.md
LICENSE
MAINTAINERS.md
Makefile
NOTICE.txt
README.md Update CONTRIBUTING.md (#8300) 2025-05-09 09:57:52 -07:00
SECURITY.md
backoff.go
balancer_wrapper.go
balancer_wrapper_test.go
call.go
clientconn.go
clientconn_authority_test.go
clientconn_parsed_target_test.go
clientconn_test.go
codec.go
codec_test.go
default_dial_option_server_option_test.go
dialoptions.go cleanup: replace dial with newclient (#8196) 2025-05-12 10:57:47 +05:30
doc.go
go.mod
go.sum
grpc_test.go
interceptor.go
picker_wrapper.go
picker_wrapper_test.go
preloader.go
producer_ext_test.go
resolver_balancer_ext_test.go
resolver_test.go
resolver_wrapper.go
rpc_util.go credentials, transport, grpc : add a call option to override the :authority header on a per-RPC basis (#8068) 2025-04-30 14:41:28 +05:30
rpc_util_test.go
server.go
server_ext_test.go
server_test.go
service_config.go
service_config_test.go
stream.go grpc: Update ClientStream.CloseSend docs (#8292) 2025-05-08 00:15:51 +05:30
stream_interfaces.go
stream_test.go
trace.go
trace_notrace.go
trace_test.go
trace_withtrace.go
version.go

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:

  • Set up a VPN and access google.golang.org through that.

  • With Go module support: it is possible to use the replace feature of go mod to create aliases for golang.org packages. In your project's directory:

    go mod edit -replace=google.golang.org/grpc=github.com/grpc/grpc-go@latest
    go mod tidy
    go mod vendor
    go build -mod=vendor
    

    Again, this will need to be done for all transitive dependencies hosted on golang.org as well. For details, refer to golang/go issue #28652.

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.