mirror of https://github.com/grpc/grpc-go.git
				
				
				
			*: remove references to old versions of go (#6545)
This commit is contained in:
		
							parent
							
								
									03d32b9c9d
								
							
						
					
					
						commit
						a0100790d9
					
				|  | @ -1,9 +1,8 @@ | |||
| # Proxy | ||||
| 
 | ||||
| HTTP CONNECT proxies are supported by default in gRPC. The proxy address can be | ||||
| specified by the environment variables `HTTPS_PROXY` and `NO_PROXY`.  Before Go | ||||
| 1.16, if the `HTTPS_PROXY` environment variable is unset, `HTTP_PROXY` will be | ||||
| used instead.  (Note that these environment variables are case insensitive.) | ||||
| specified by the environment variables `HTTPS_PROXY` and `NO_PROXY`.  (Note that | ||||
| these environment variables are case insensitive.) | ||||
| 
 | ||||
| ## Custom proxy | ||||
| 
 | ||||
|  |  | |||
							
								
								
									
										58
									
								
								README.md
								
								
								
								
							
							
						
						
									
										58
									
								
								README.md
								
								
								
								
							|  | @ -14,21 +14,14 @@ RPC framework that puts mobile and HTTP/2 first. For more information see the | |||
| 
 | ||||
| ## Installation | ||||
| 
 | ||||
| With [Go module][] support (Go 1.11+), simply add the following import | ||||
| Simply add the following import to your code, and then `go [build|run|test]` | ||||
| will automatically fetch the necessary dependencies: | ||||
| 
 | ||||
| 
 | ||||
| ```go | ||||
| import "google.golang.org/grpc" | ||||
| ``` | ||||
| 
 | ||||
| to your code, and then `go [build|run|test]` will automatically fetch the | ||||
| necessary dependencies. | ||||
| 
 | ||||
| Otherwise, to install the `grpc-go` package, run the following command: | ||||
| 
 | ||||
| ```console | ||||
| $ go get -u google.golang.org/grpc | ||||
| ``` | ||||
| 
 | ||||
| > **Note:** If you are trying to access `grpc-go` from **China**, see the | ||||
| > [FAQ](#FAQ) below. | ||||
| 
 | ||||
|  | @ -56,15 +49,6 @@ To build Go code, there are several options: | |||
| 
 | ||||
| - Set up a VPN and access google.golang.org through that. | ||||
| 
 | ||||
| - Without Go module support: `git clone` the repo manually: | ||||
| 
 | ||||
|   ```sh | ||||
|   git clone https://github.com/grpc/grpc-go.git $GOPATH/src/google.golang.org/grpc | ||||
|   ``` | ||||
| 
 | ||||
|   You will need to do the same for all of grpc's dependencies in `golang.org`, | ||||
|   e.g. `golang.org/x/net`. | ||||
| 
 | ||||
| - 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: | ||||
| 
 | ||||
|  | @ -76,33 +60,13 @@ To build Go code, there are several options: | |||
|   ``` | ||||
| 
 | ||||
|   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](https://github.com/golang/go/issues/28652). | ||||
|   golang.org as well. For details, refer to [golang/go issue | ||||
|   #28652](https://github.com/golang/go/issues/28652). | ||||
| 
 | ||||
| ### Compiling error, undefined: grpc.SupportPackageIsVersion | ||||
| 
 | ||||
| #### If you are using Go modules: | ||||
| 
 | ||||
| Ensure your gRPC-Go version is `require`d at the appropriate version in | ||||
| the same module containing the generated `.pb.go` files.  For example, | ||||
| `SupportPackageIsVersion6` needs `v1.27.0`, so in your `go.mod` file: | ||||
| 
 | ||||
| ```go | ||||
| module <your module name> | ||||
| 
 | ||||
| require ( | ||||
|     google.golang.org/grpc v1.27.0 | ||||
| ) | ||||
| ``` | ||||
| 
 | ||||
| #### If you are *not* using Go modules: | ||||
| 
 | ||||
| Update the `proto` package, gRPC package, and rebuild the `.proto` files: | ||||
| 
 | ||||
| ```sh | ||||
| go get -u github.com/golang/protobuf/{proto,protoc-gen-go} | ||||
| go get -u google.golang.org/grpc | ||||
| protoc --go_out=plugins=grpc:. *.proto | ||||
| ``` | ||||
| Please update to the latest version of gRPC-Go using | ||||
| `go get google.golang.org/grpc`. | ||||
| 
 | ||||
| ### How to turn on logging | ||||
| 
 | ||||
|  | @ -121,9 +85,11 @@ possible reasons, including: | |||
|  1. mis-configured transport credentials, connection failed on handshaking | ||||
|  1. bytes disrupted, possibly by a proxy in between | ||||
|  1. server shutdown | ||||
|  1. Keepalive parameters caused connection shutdown, for example if you have configured | ||||
|     your server to terminate connections regularly to [trigger DNS lookups](https://github.com/grpc/grpc-go/issues/3170#issuecomment-552517779). | ||||
|     If this is the case, you may want to increase your [MaxConnectionAgeGrace](https://pkg.go.dev/google.golang.org/grpc/keepalive?tab=doc#ServerParameters), | ||||
|  1. Keepalive parameters caused connection shutdown, for example if you have | ||||
|     configured your server to terminate connections regularly to [trigger DNS | ||||
|     lookups](https://github.com/grpc/grpc-go/issues/3170#issuecomment-552517779). | ||||
|     If this is the case, you may want to increase your | ||||
|     [MaxConnectionAgeGrace](https://pkg.go.dev/google.golang.org/grpc/keepalive?tab=doc#ServerParameters), | ||||
|     to allow longer RPC calls to finish. | ||||
| 
 | ||||
| It can be tricky to debug this because the error happens on the client side but | ||||
|  |  | |||
|  | @ -19,10 +19,6 @@ | |||
|  * | ||||
|  */ | ||||
| 
 | ||||
| // The test in this file should be run in an environment that has go1.10 or later,
 | ||||
| // as the function SyscallConn() (required to get socket option) was introduced
 | ||||
| // to net.TCPListener in go1.10.
 | ||||
| 
 | ||||
| package channelz_test | ||||
| 
 | ||||
| import ( | ||||
|  |  | |||
|  | @ -318,7 +318,7 @@ func (s) TestHandlerTransport_HandleStreams(t *testing.T) { | |||
| 		func(ctx context.Context, method string) context.Context { return ctx }, | ||||
| 	) | ||||
| 	wantHeader := http.Header{ | ||||
| 		"Date":          {}, | ||||
| 		"Date":          nil, | ||||
| 		"Content-Type":  {"application/grpc"}, | ||||
| 		"Trailer":       {"Grpc-Status", "Grpc-Message", "Grpc-Status-Details-Bin"}, | ||||
| 		"Custom-Header": {"Custom header value", "Another custom header value"}, | ||||
|  | @ -352,7 +352,7 @@ func handleStreamCloseBodyTest(t *testing.T, statusCode codes.Code, msg string) | |||
| 		func(ctx context.Context, method string) context.Context { return ctx }, | ||||
| 	) | ||||
| 	wantHeader := http.Header{ | ||||
| 		"Date":         {}, | ||||
| 		"Date":         nil, | ||||
| 		"Content-Type": {"application/grpc"}, | ||||
| 		"Trailer":      {"Grpc-Status", "Grpc-Message", "Grpc-Status-Details-Bin"}, | ||||
| 	} | ||||
|  | @ -402,7 +402,7 @@ func (s) TestHandlerTransport_HandleStreams_Timeout(t *testing.T) { | |||
| 		func(ctx context.Context, method string) context.Context { return ctx }, | ||||
| 	) | ||||
| 	wantHeader := http.Header{ | ||||
| 		"Date":         {}, | ||||
| 		"Date":         nil, | ||||
| 		"Content-Type": {"application/grpc"}, | ||||
| 		"Trailer":      {"Grpc-Status", "Grpc-Message", "Grpc-Status-Details-Bin"}, | ||||
| 	} | ||||
|  | @ -489,7 +489,7 @@ func (s) TestHandlerTransport_HandleStreams_ErrDetails(t *testing.T) { | |||
| 		func(ctx context.Context, method string) context.Context { return ctx }, | ||||
| 	) | ||||
| 	wantHeader := http.Header{ | ||||
| 		"Date":         {}, | ||||
| 		"Date":         nil, | ||||
| 		"Content-Type": {"application/grpc"}, | ||||
| 		"Trailer":      {"Grpc-Status", "Grpc-Message", "Grpc-Status-Details-Bin"}, | ||||
| 	} | ||||
|  | @ -515,7 +515,7 @@ func (s) TestHandlerTransport_Drain(t *testing.T) { | |||
| func checkHeaderAndTrailer(t *testing.T, rw testHandlerResponseWriter, wantHeader, wantTrailer http.Header) { | ||||
| 	// For trailer-only responses, the trailer values might be reported as part of the Header. They will however
 | ||||
| 	// be present in Trailer in either case. Hence, normalize the header by removing all trailer values.
 | ||||
| 	actualHeader := cloneHeader(rw.Result().Header) | ||||
| 	actualHeader := rw.Result().Header.Clone() | ||||
| 	for _, trailerKey := range actualHeader["Trailer"] { | ||||
| 		actualHeader.Del(trailerKey) | ||||
| 	} | ||||
|  | @ -527,21 +527,3 @@ func checkHeaderAndTrailer(t *testing.T, rw testHandlerResponseWriter, wantHeade | |||
| 		t.Errorf("Trailer mismatch.\n got: %#v\n want: %#v", actualTrailer, wantTrailer) | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| // cloneHeader performs a deep clone of an http.Header, since the (http.Header).Clone() method was only added in
 | ||||
| // Go 1.13.
 | ||||
| func cloneHeader(hdr http.Header) http.Header { | ||||
| 	if hdr == nil { | ||||
| 		return nil | ||||
| 	} | ||||
| 
 | ||||
| 	hdrClone := make(http.Header, len(hdr)) | ||||
| 
 | ||||
| 	for k, vv := range hdr { | ||||
| 		vvClone := make([]string, len(vv)) | ||||
| 		copy(vvClone, vv) | ||||
| 		hdrClone[k] = vvClone | ||||
| 	} | ||||
| 
 | ||||
| 	return hdrClone | ||||
| } | ||||
|  |  | |||
|  | @ -17,7 +17,7 @@ | |||
| # Stage 1: Build the interop test client and server | ||||
| # | ||||
| 
 | ||||
| FROM golang:1.17.13-bullseye as build | ||||
| FROM golang:1.21-bullseye as build | ||||
| 
 | ||||
| WORKDIR /grpc-go | ||||
| COPY . . | ||||
|  | @ -36,7 +36,7 @@ RUN go build -o server/ server/server.go && \ | |||
| #   with the given parameters. | ||||
| # | ||||
| 
 | ||||
| FROM golang:1.17.13-bullseye | ||||
| FROM golang:1.21-bullseye | ||||
| 
 | ||||
| ENV GRPC_GO_LOG_SEVERITY_LEVEL info | ||||
| ENV GRPC_GO_LOG_VERBOSITY_LEVEL 2 | ||||
|  |  | |||
|  | @ -16,7 +16,7 @@ | |||
| # following command from grpc-go directory: | ||||
| # docker build -t <TAG> -f interop/xds/client/Dockerfile . | ||||
| 
 | ||||
| FROM golang:1.19-alpine as build | ||||
| FROM golang:1.21-alpine as build | ||||
| 
 | ||||
| # Make a grpc-go directory and copy the repo into it. | ||||
| WORKDIR /go/src/grpc-go | ||||
|  |  | |||
|  | @ -16,7 +16,7 @@ | |||
| # following command from grpc-go directory: | ||||
| # docker build -t <TAG> -f interop/xds/server/Dockerfile . | ||||
| 
 | ||||
| FROM golang:1.19-alpine as build | ||||
| FROM golang:1.21-alpine as build | ||||
| 
 | ||||
| # Make a grpc-go directory and copy the repo into it. | ||||
| WORKDIR /go/src/grpc-go | ||||
|  |  | |||
|  | @ -16,10 +16,6 @@ | |||
|  * | ||||
|  */ | ||||
| 
 | ||||
| // The test in this file should be run in an environment that has go1.10 or later,
 | ||||
| // as the function SyscallConn() (required to get socket option) was
 | ||||
| // introduced to net.TCPListener in go1.10.
 | ||||
| 
 | ||||
| package test | ||||
| 
 | ||||
| import ( | ||||
|  |  | |||
|  | @ -9,8 +9,9 @@ export GOPATH="${HOME}/gopath" | |||
| pushd grpc-go/interop/xds/client | ||||
| # Install a version of Go supported by gRPC for the new features, e.g. | ||||
| # errors.Is() | ||||
| curl --retry 3 -O -L https://go.dev/dl/go1.17.3.linux-amd64.tar.gz | ||||
| sudo tar -C /usr/local -xf go1.17.3.linux-amd64.tar.gz | ||||
| gofilename=go1.21.0.linux-amd64.tar.gz | ||||
| curl --retry 3 -O -L "https://go.dev/dl/${gofilename}" | ||||
| sudo tar -C /usr/local -xf "${gofilename}" | ||||
| sudo ln -s /usr/local/go/bin/go /usr/bin/go | ||||
| # Retry go build on errors (e.g. go get connection errors), for at most 3 times | ||||
| for i in 1 2 3; do go build && break || sleep 5; done | ||||
|  |  | |||
							
								
								
									
										2
									
								
								vet.sh
								
								
								
								
							
							
						
						
									
										2
									
								
								vet.sh
								
								
								
								
							|  | @ -106,7 +106,7 @@ for MOD_FILE in $(find . -name 'go.mod'); do | |||
|   goimports -l . 2>&1 | not grep -vE "\.pb\.go" | ||||
|   golint ./... 2>&1 | not grep -vE "/grpc_testing_not_regenerate/.*\.pb\.go:" | ||||
| 
 | ||||
|   go mod tidy -compat=1.17 | ||||
|   go mod tidy -compat=1.19 | ||||
|   git status --porcelain 2>&1 | fail_on_output || \ | ||||
|     (git status; git --no-pager diff; exit 1) | ||||
|   popd | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue