merge upstream and upgrade go to 1.21
This commit is contained in:
		
							
								
								
									
										10
									
								
								vendor/golang.org/x/sync/errgroup/errgroup.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										10
									
								
								vendor/golang.org/x/sync/errgroup/errgroup.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -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)
 | 
			
		||||
				}
 | 
			
		||||
			})
 | 
			
		||||
		}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										13
									
								
								vendor/golang.org/x/sync/errgroup/go120.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								vendor/golang.org/x/sync/errgroup/go120.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,13 @@
 | 
			
		||||
// 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
 | 
			
		||||
 | 
			
		||||
package errgroup
 | 
			
		||||
 | 
			
		||||
import "context"
 | 
			
		||||
 | 
			
		||||
func withCancelCause(parent context.Context) (context.Context, func(error)) {
 | 
			
		||||
	return context.WithCancelCause(parent)
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										14
									
								
								vendor/golang.org/x/sync/errgroup/pre_go120.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								vendor/golang.org/x/sync/errgroup/pre_go120.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -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
 | 
			
		||||
 | 
			
		||||
package errgroup
 | 
			
		||||
 | 
			
		||||
import "context"
 | 
			
		||||
 | 
			
		||||
func withCancelCause(parent context.Context) (context.Context, func(error)) {
 | 
			
		||||
	ctx, cancel := context.WithCancel(parent)
 | 
			
		||||
	return ctx, func(error) { cancel() }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										4
									
								
								vendor/modules.txt
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								vendor/modules.txt
									
									
									
									
										vendored
									
									
								
							@@ -1,3 +1,3 @@
 | 
			
		||||
# golang.org/x/sync v0.1.0
 | 
			
		||||
## explicit
 | 
			
		||||
# golang.org/x/sync v0.5.0
 | 
			
		||||
## explicit; go 1.18
 | 
			
		||||
golang.org/x/sync/errgroup
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user