From 7fc1605a5dde7535a0fc1770ca44238629ff29ac Mon Sep 17 00:00:00 2001 From: Anderson Queiroz Date: Wed, 17 Aug 2022 22:09:24 +0100 Subject: 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 Auto-Submit: Bryan Mills Run-TryBot: Bryan Mills Reviewed-by: Bryan Mills Reviewed-by: Ian Lance Taylor --- errgroup/errgroup.go | 4 ++-- 1 file 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{} -- cgit v1.2.3