]> Cypherpunks repositories - gostls13.git/commitdiff
sync: WaitGroup.Go: document that f must not panic
authorAlan Donovan <adonovan@google.com>
Thu, 24 Apr 2025 02:58:05 +0000 (22:58 -0400)
committerGopher Robot <gobot@golang.org>
Thu, 1 May 2025 19:34:03 +0000 (12:34 -0700)
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>

src/sync/waitgroup.go

index 811857bb231cc2b1b86507d5d551be428a61830e..c850f58ed14e41817f5911b2d35b23f6a9127602 100644 (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.