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>
diff --git a/errgroup/errgroup.go b/errgroup/errgroup.go
index 4c0850a..cbee7a4 100644
--- a/errgroup/errgroup.go
+++ b/errgroup/errgroup.go
@@ -61,8 +61,8 @@
// It blocks until the new goroutine can be added without the number of
// 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
-// returned by Wait.
+// The first call to return a non-nil error cancels the group's context, if the
+// group was created by calling WithContext. The error will be returned by Wait.
func (g *Group) Go(f func() error) {
if g.sem != nil {
g.sem <- token{}