aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnderson Queiroz <me@andersonq.me>2022-08-17 22:09:24 +0100
committerGopher Robot <gobot@golang.org>2022-08-19 03:09:29 +0000
commit7fc1605a5dde7535a0fc1770ca44238629ff29ac (patch)
tree44a59d46ae2090f37c8add2f9cc1f52b0896925b
parent886fb9371eb4b47af10bff9c8025a8c9e1554b92 (diff)
downloadgolang-x-sync-7fc1605a5dde7535a0fc1770ca44238629ff29ac.tar.gz
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>
-rw-r--r--errgroup/errgroup.go4
1 files changed, 2 insertions, 2 deletions
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 @@ func (g *Group) Wait() error {
// 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{}