From 41ed2d29c7a7e4e4b6a60d43d37f8c7270b44e75 Mon Sep 17 00:00:00 2001 From: wang yan Date: Thu, 29 Jun 2023 02:59:01 +0000 Subject: [PATCH] update version --- src/go.mod | 2 +- src/go.sum | 4 ++-- src/vendor/golang.org/x/sync/errgroup/errgroup.go | 10 +++++----- src/vendor/golang.org/x/sync/errgroup/go120.go | 14 ++++++++++++++ .../golang.org/x/sync/errgroup/pre_go120.go | 15 +++++++++++++++ src/vendor/modules.txt | 4 ++-- 6 files changed, 39 insertions(+), 10 deletions(-) create mode 100644 src/vendor/golang.org/x/sync/errgroup/go120.go create mode 100644 src/vendor/golang.org/x/sync/errgroup/pre_go120.go diff --git a/src/go.mod b/src/go.mod index 8b6a40d1a117..a51c7130ad10 100644 --- a/src/go.mod +++ b/src/go.mod @@ -162,7 +162,7 @@ require ( go.uber.org/atomic v1.7.0 // indirect go.uber.org/multierr v1.6.0 // indirect go.uber.org/zap v1.19.0 // indirect - golang.org/x/sync v0.1.0 + golang.org/x/sync v0.3.0 golang.org/x/sys v0.7.0 // indirect golang.org/x/term v0.7.0 // indirect google.golang.org/api v0.110.0 // indirect diff --git a/src/go.sum b/src/go.sum index e284b6d8add9..c5fef8f52684 100644 --- a/src/go.sum +++ b/src/go.sum @@ -1521,8 +1521,8 @@ golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o= -golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E= +golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= golang.org/x/sys v0.0.0-20180224232135-f6cff0780e54/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= diff --git a/src/vendor/golang.org/x/sync/errgroup/errgroup.go b/src/vendor/golang.org/x/sync/errgroup/errgroup.go index cbee7a4e230d..b18efb743fe7 100644 --- a/src/vendor/golang.org/x/sync/errgroup/errgroup.go +++ b/src/vendor/golang.org/x/sync/errgroup/errgroup.go @@ -20,7 +20,7 @@ type token struct{} // A zero Group is valid, has no limit on the number of active goroutines, // and does not cancel on error. type Group struct { - cancel func() + cancel func(error) wg sync.WaitGroup @@ -43,7 +43,7 @@ func (g *Group) done() { // returns a non-nil error or the first time Wait returns, whichever occurs // first. func WithContext(ctx context.Context) (*Group, context.Context) { - ctx, cancel := context.WithCancel(ctx) + ctx, cancel := withCancelCause(ctx) return &Group{cancel: cancel}, ctx } @@ -52,7 +52,7 @@ func WithContext(ctx context.Context) (*Group, context.Context) { func (g *Group) Wait() error { g.wg.Wait() if g.cancel != nil { - g.cancel() + g.cancel(g.err) } return g.err } @@ -76,7 +76,7 @@ func (g *Group) Go(f func() error) { g.errOnce.Do(func() { g.err = err if g.cancel != nil { - g.cancel() + g.cancel(g.err) } }) } @@ -105,7 +105,7 @@ func (g *Group) TryGo(f func() error) bool { g.errOnce.Do(func() { g.err = err if g.cancel != nil { - g.cancel() + g.cancel(g.err) } }) } diff --git a/src/vendor/golang.org/x/sync/errgroup/go120.go b/src/vendor/golang.org/x/sync/errgroup/go120.go new file mode 100644 index 000000000000..7d419d3760ce --- /dev/null +++ b/src/vendor/golang.org/x/sync/errgroup/go120.go @@ -0,0 +1,14 @@ +// Copyright 2023 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build go1.20 +// +build go1.20 + +package errgroup + +import "context" + +func withCancelCause(parent context.Context) (context.Context, func(error)) { + return context.WithCancelCause(parent) +} diff --git a/src/vendor/golang.org/x/sync/errgroup/pre_go120.go b/src/vendor/golang.org/x/sync/errgroup/pre_go120.go new file mode 100644 index 000000000000..1795c18ace06 --- /dev/null +++ b/src/vendor/golang.org/x/sync/errgroup/pre_go120.go @@ -0,0 +1,15 @@ +// Copyright 2023 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build !go1.20 +// +build !go1.20 + +package errgroup + +import "context" + +func withCancelCause(parent context.Context) (context.Context, func(error)) { + ctx, cancel := context.WithCancel(parent) + return ctx, func(error) { cancel() } +} diff --git a/src/vendor/modules.txt b/src/vendor/modules.txt index 8cb7ea5f3172..408846e62541 100644 --- a/src/vendor/modules.txt +++ b/src/vendor/modules.txt @@ -696,8 +696,8 @@ golang.org/x/oauth2/google/internal/externalaccount golang.org/x/oauth2/internal golang.org/x/oauth2/jws golang.org/x/oauth2/jwt -# golang.org/x/sync v0.1.0 -## explicit +# golang.org/x/sync v0.3.0 +## explicit; go 1.17 golang.org/x/sync/errgroup # golang.org/x/sys v0.7.0 ## explicit; go 1.17