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 <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
Commit-Queue: Alan Donovan <adonovan@google.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
This commit is contained in:
Alan Donovan 2025-04-23 22:58:05 -04:00 committed by Gopher Robot
parent 12110c3f7e
commit 9921537a96

View File

@ -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.