x/sync/errgroup: clarify docs for Go

Even thought Go cancels the context in g, if it's not nil, it'll call
any subsequent function, regardless if a previous call of f returned an error or not.

Fixes golang/go#54045

Change-Id: Ie6059925f45458cf393bf1fc8949ce16be8e6f2a
Reviewed-on: https://go-review.googlesource.com/c/sync/+/424634
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
This commit is contained in:
Anderson Queiroz 2022-08-17 22:09:24 +01:00 committed by Gopher Robot
commit 7fc1605a5d

View file

@ -61,8 +61,8 @@ func (g *Group) Wait() error {
// It blocks until the new goroutine can be added without the number of // It blocks until the new goroutine can be added without the number of
// active goroutines in the group exceeding the configured limit. // active goroutines in the group exceeding the configured limit.
// //
// The first call to return a non-nil error cancels the group; its error will be // The first call to return a non-nil error cancels the group's context, if the
// returned by Wait. // group was created by calling WithContext. The error will be returned by Wait.
func (g *Group) Go(f func() error) { func (g *Group) Go(f func() error) {
if g.sem != nil { if g.sem != nil {
g.sem <- token{} g.sem <- token{}