Browse Source

vendor: upgrade grpc/grpc-go to v1.11.3

Joe Betz 7 years ago
parent
commit
12acfc057a

+ 3 - 3
Gopkg.lock

@@ -360,8 +360,8 @@
     "tap",
     "transport"
   ]
-  revision = "1e2570b1b19ade82d8dbb31bba4e65e9f9ef5b34"
-  version = "v1.11.1"
+  revision = "d11072e7ca9811b1100b80ca0269ac831f06d024"
+  version = "v1.11.3"
 
 [[projects]]
   name = "gopkg.in/cheggaaa/pb.v1"
@@ -378,6 +378,6 @@
 [solve-meta]
   analyzer-name = "dep"
   analyzer-version = 1
-  inputs-digest = "b747b3fd3120687183829e5d2d5b2d10bba1719402c9bcc7c955d27ab5f884a0"
+  inputs-digest = "9b6e97c6524385aecaa477af059f4f6555b3609d4a283ecf27ac2ad4fbe08f06"
   solver-name = "gps-cdcl"
   solver-version = 1

+ 1 - 1
test

@@ -380,7 +380,7 @@ function shellcheck_pass {
 
 function markdown_you_pass {
 	# eschew you
-	yous=$(find . -name \*.md ! -path './vendor/*' ! -path './gopath.proto/*' -exec grep -E --color "[Yy]ou[r]?[ '.,;]" {} + | grep -v /v2/ || true)
+	yous=$(find . -name \*.md ! -path './vendor/*' ! -path './Documentation/v2/*' ! -path './gopath.proto/*' -exec grep -E --color "[Yy]ou[r]?[ '.,;]" {} + || true)
 	if [ ! -z "$yous" ]; then
 		echo -e "found 'you' in documentation:\\n${yous}"
 		exit 255

+ 0 - 123
vendor/google.golang.org/genproto/regen.go

@@ -1,123 +0,0 @@
-// Copyright 2016 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// +build ignore
-
-// Regen.go regenerates the genproto repository.
-//
-// Regen.go recursively walks through each directory named by given arguments,
-// looking for all .proto files. (Symlinks are not followed.)
-// If the pkg_prefix flag is not an empty string,
-// any proto file without `go_package` option
-// or whose option does not begin with the prefix is ignored.
-// Protoc is executed on remaining files,
-// one invocation per set of files declaring the same Go package.
-package main
-
-import (
-	"flag"
-	"fmt"
-	"io/ioutil"
-	"log"
-	"os"
-	"os/exec"
-	"path/filepath"
-	"regexp"
-	"strconv"
-	"strings"
-)
-
-var goPkgOptRe = regexp.MustCompile(`(?m)^option go_package = (.*);`)
-
-func usage() {
-	fmt.Fprintln(os.Stderr, `usage: go run regen.go -go_out=path/to/output [-pkg_prefix=pkg/prefix] roots...
-
-Most users will not need to run this file directly.
-To regenerate this repository, run regen.sh instead.`)
-	flag.PrintDefaults()
-}
-
-func main() {
-	goOutDir := flag.String("go_out", "", "go_out argument to pass to protoc-gen-go")
-	pkgPrefix := flag.String("pkg_prefix", "", "only include proto files with go_package starting with this prefix")
-	flag.Usage = usage
-	flag.Parse()
-
-	if *goOutDir == "" {
-		log.Fatal("need go_out flag")
-	}
-
-	pkgFiles := make(map[string][]string)
-	walkFn := func(path string, info os.FileInfo, err error) error {
-		if err != nil {
-			return err
-		}
-		if !info.Mode().IsRegular() || !strings.HasSuffix(path, ".proto") {
-			return nil
-		}
-		pkg, err := goPkg(path)
-		if err != nil {
-			return err
-		}
-		pkgFiles[pkg] = append(pkgFiles[pkg], path)
-		return nil
-	}
-	for _, root := range flag.Args() {
-		if err := filepath.Walk(root, walkFn); err != nil {
-			log.Fatal(err)
-		}
-	}
-	for pkg, fnames := range pkgFiles {
-		if !strings.HasPrefix(pkg, *pkgPrefix) {
-			continue
-		}
-		if out, err := protoc(*goOutDir, flag.Args(), fnames); err != nil {
-			log.Fatalf("error executing protoc: %s\n%s", err, out)
-		}
-	}
-}
-
-// goPkg reports the import path declared in the given file's
-// `go_package` option. If the option is missing, goPkg returns empty string.
-func goPkg(fname string) (string, error) {
-	content, err := ioutil.ReadFile(fname)
-	if err != nil {
-		return "", err
-	}
-
-	var pkgName string
-	if match := goPkgOptRe.FindSubmatch(content); len(match) > 0 {
-		pn, err := strconv.Unquote(string(match[1]))
-		if err != nil {
-			return "", err
-		}
-		pkgName = pn
-	}
-	if p := strings.IndexRune(pkgName, ';'); p > 0 {
-		pkgName = pkgName[:p]
-	}
-	return pkgName, nil
-}
-
-// protoc executes the "protoc" command on files named in fnames,
-// passing go_out and include flags specified in goOut and includes respectively.
-// protoc returns combined output from stdout and stderr.
-func protoc(goOut string, includes, fnames []string) ([]byte, error) {
-	args := []string{"--go_out=plugins=grpc:" + goOut}
-	for _, inc := range includes {
-		args = append(args, "-I", inc)
-	}
-	args = append(args, fnames...)
-	return exec.Command("protoc", args...).CombinedOutput()
-}

+ 1 - 11
vendor/google.golang.org/grpc/clientconn.go

@@ -24,7 +24,6 @@ import (
 	"math"
 	"net"
 	"reflect"
-	"regexp"
 	"strings"
 	"sync"
 	"time"
@@ -444,16 +443,7 @@ func DialContext(ctx context.Context, target string, opts ...DialOption) (conn *
 	if cc.dopts.copts.Dialer == nil {
 		cc.dopts.copts.Dialer = newProxyDialer(
 			func(ctx context.Context, addr string) (net.Conn, error) {
-				network := "tcp"
-				p := regexp.MustCompile(`[a-z]+://`)
-				if p.MatchString(addr) {
-					parts := strings.Split(addr, "://")
-					scheme := parts[0]
-					if (scheme == "unix" || scheme == "unixs") && len(parts) > 1 && len(parts[1]) > 0 {
-						network = "unix"
-						addr = parts[1]
-					}
-				}
+				network, addr := parseDialTarget(addr)
 				return dialContext(ctx, network, addr)
 			},
 		)

+ 0 - 91
vendor/google.golang.org/grpc/resolver/manual/manual.go

@@ -1,91 +0,0 @@
-/*
- *
- * Copyright 2017 gRPC authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// Package manual defines a resolver that can be used to manually send resolved
-// addresses to ClientConn.
-package manual
-
-import (
-	"strconv"
-	"time"
-
-	"google.golang.org/grpc/resolver"
-)
-
-// NewBuilderWithScheme creates a new test resolver builder with the given scheme.
-func NewBuilderWithScheme(scheme string) *Resolver {
-	return &Resolver{
-		scheme: scheme,
-	}
-}
-
-// Resolver is also a resolver builder.
-// It's build() function always returns itself.
-type Resolver struct {
-	scheme string
-
-	// Fields actually belong to the resolver.
-	cc             resolver.ClientConn
-	bootstrapAddrs []resolver.Address
-}
-
-// InitialAddrs adds resolved addresses to the resolver so that
-// NewAddress doesn't need to be explicitly called after Dial.
-func (r *Resolver) InitialAddrs(addrs []resolver.Address) {
-	r.bootstrapAddrs = addrs
-}
-
-// Build returns itself for Resolver, because it's both a builder and a resolver.
-func (r *Resolver) Build(target resolver.Target, cc resolver.ClientConn, opts resolver.BuildOption) (resolver.Resolver, error) {
-	r.cc = cc
-	if r.bootstrapAddrs != nil {
-		r.NewAddress(r.bootstrapAddrs)
-	}
-	return r, nil
-}
-
-// Scheme returns the test scheme.
-func (r *Resolver) Scheme() string {
-	return r.scheme
-}
-
-// ResolveNow is a noop for Resolver.
-func (*Resolver) ResolveNow(o resolver.ResolveNowOption) {}
-
-// Close is a noop for Resolver.
-func (*Resolver) Close() {}
-
-// NewAddress calls cc.NewAddress.
-func (r *Resolver) NewAddress(addrs []resolver.Address) {
-	r.cc.NewAddress(addrs)
-}
-
-// NewServiceConfig calls cc.NewServiceConfig.
-func (r *Resolver) NewServiceConfig(sc string) {
-	r.cc.NewServiceConfig(sc)
-}
-
-// GenerateAndRegisterManualResolver generates a random scheme and a Resolver
-// with it. It also regieter this Resolver.
-// It returns the Resolver and a cleanup function to unregister it.
-func GenerateAndRegisterManualResolver() (*Resolver, func()) {
-	scheme := strconv.FormatInt(time.Now().UnixNano(), 36)
-	r := NewBuilderWithScheme(scheme)
-	resolver.Register(r)
-	return r, func() { resolver.UnregisterForTesting(scheme) }
-}

+ 36 - 1
vendor/google.golang.org/grpc/rpc_util.go

@@ -26,6 +26,7 @@ import (
 	"io"
 	"io/ioutil"
 	"math"
+	"net/url"
 	"strings"
 	"sync"
 	"time"
@@ -662,6 +663,40 @@ func setCallInfoCodec(c *callInfo) error {
 	return nil
 }
 
+// parseDialTarget returns the network and address to pass to dialer
+func parseDialTarget(target string) (net string, addr string) {
+	net = "tcp"
+
+	m1 := strings.Index(target, ":")
+	m2 := strings.Index(target, ":/")
+
+	// handle unix:addr which will fail with url.Parse
+	if m1 >= 0 && m2 < 0 {
+		if n := target[0:m1]; n == "unix" {
+			net = n
+			addr = target[m1+1:]
+			return net, addr
+		}
+	}
+	if m2 >= 0 {
+		t, err := url.Parse(target)
+		if err != nil {
+			return net, target
+		}
+		scheme := t.Scheme
+		addr = t.Path
+		if scheme == "unix" {
+			net = scheme
+			if addr == "" {
+				addr = t.Host
+			}
+			return net, addr
+		}
+	}
+
+	return net, target
+}
+
 // The SupportPackageIsVersion variables are referenced from generated protocol
 // buffer files to ensure compatibility with the gRPC version used.  The latest
 // support package version is 5.
@@ -677,6 +712,6 @@ const (
 )
 
 // Version is the current grpc version.
-const Version = "1.11.1"
+const Version = "1.11.3"
 
 const grpcUA = "grpc-go/" + Version

+ 10 - 0
vendor/google.golang.org/grpc/server.go

@@ -1359,3 +1359,13 @@ func SetTrailer(ctx context.Context, md metadata.MD) error {
 	}
 	return stream.SetTrailer(md)
 }
+
+// Method returns the method string for the server context.  The returned
+// string is in the format of "/service/method".
+func Method(ctx context.Context) (string, bool) {
+	s := serverTransportStreamFromContext(ctx)
+	if s == nil {
+		return "", false
+	}
+	return s.Method(), true
+}

+ 1 - 5
vendor/google.golang.org/grpc/stream.go

@@ -732,9 +732,5 @@ func (ss *serverStream) RecvMsg(m interface{}) (err error) {
 // MethodFromServerStream returns the method string for the input stream.
 // The returned string is in the format of "/service/method".
 func MethodFromServerStream(stream ServerStream) (string, bool) {
-	s := serverTransportStreamFromContext(stream.Context())
-	if s == nil {
-		return "", false
-	}
-	return s.Method(), true
+	return Method(stream.Context())
 }