diff options
author | Valentin Rothberg <rothberg@redhat.com> | 2021-07-02 13:03:10 +0200 |
---|---|---|
committer | Valentin Rothberg <rothberg@redhat.com> | 2021-07-02 13:03:10 +0200 |
commit | 735be12481cdc3edfcbca3500172d2164255e1a3 (patch) | |
tree | 67f0ee2916812072967707ae6de779ebbcdb0476 /vendor/google.golang.org/grpc/metadata | |
parent | 7eb9ed975899ffe12fb82066aebf652444205e02 (diff) | |
download | podman-735be12481cdc3edfcbca3500172d2164255e1a3.tar.gz podman-735be12481cdc3edfcbca3500172d2164255e1a3.tar.bz2 podman-735be12481cdc3edfcbca3500172d2164255e1a3.zip |
force github.com/spf13/cobra@v1.1.3
v1.2.0 is breaking CI (see containers/podman/pull/10844).
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
Diffstat (limited to 'vendor/google.golang.org/grpc/metadata')
-rw-r--r-- | vendor/google.golang.org/grpc/metadata/metadata.go | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/vendor/google.golang.org/grpc/metadata/metadata.go b/vendor/google.golang.org/grpc/metadata/metadata.go index e4cbea917..cf6d1b947 100644 --- a/vendor/google.golang.org/grpc/metadata/metadata.go +++ b/vendor/google.golang.org/grpc/metadata/metadata.go @@ -75,9 +75,13 @@ func Pairs(kv ...string) MD { panic(fmt.Sprintf("metadata: Pairs got the odd number of input pairs for metadata: %d", len(kv))) } md := MD{} - for i := 0; i < len(kv); i += 2 { - key := strings.ToLower(kv[i]) - md[key] = append(md[key], kv[i+1]) + var key string + for i, s := range kv { + if i%2 == 0 { + key = strings.ToLower(s) + continue + } + md[key] = append(md[key], s) } return md } @@ -191,18 +195,12 @@ func FromOutgoingContext(ctx context.Context) (MD, bool) { return nil, false } - out := raw.md.Copy() - for _, added := range raw.added { - if len(added)%2 == 1 { - panic(fmt.Sprintf("metadata: FromOutgoingContext got an odd number of input pairs for metadata: %d", len(added))) - } - - for i := 0; i < len(added); i += 2 { - key := strings.ToLower(added[i]) - out[key] = append(out[key], added[i+1]) - } + mds := make([]MD, 0, len(raw.added)+1) + mds = append(mds, raw.md) + for _, vv := range raw.added { + mds = append(mds, Pairs(vv...)) } - return out, ok + return Join(mds...), ok } type rawMD struct { |