From 9921537a96deb3cdfc64478bc041dc97326590ab Mon Sep 17 00:00:00 2001 From: Alan Donovan Date: Wed, 23 Apr 2025 22:58:05 -0400 Subject: [PATCH] sync: WaitGroup.Go: document that f must not panic Fixes #63796 Change-Id: Ib11d32574011e13aab3a0ad504f0d10009627503 Reviewed-on: https://go-review.googlesource.com/c/go/+/667695 LUCI-TryBot-Result: Go LUCI Reviewed-by: Damien Neil Commit-Queue: Alan Donovan Auto-Submit: Alan Donovan --- src/sync/waitgroup.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/sync/waitgroup.go b/src/sync/waitgroup.go index 811857bb23..c850f58ed1 100644 --- a/src/sync/waitgroup.go +++ b/src/sync/waitgroup.go @@ -163,6 +163,8 @@ func (wg *WaitGroup) Wait() { // Go calls f in a new goroutine and adds that task to the [WaitGroup]. // When f returns, the task is removed from the WaitGroup. // +// The function f must not panic. +// // If the WaitGroup is empty, Go must happen before a [WaitGroup.Wait]. // Typically, this simply means Go is called to start tasks before Wait is called. // If the WaitGroup is not empty, Go may happen at any time.