]> Cypherpunks repositories - gostls13.git/commitdiff
sync: document that Once must not be copied
authorDmitri Shuralyov <dmitshur@golang.org>
Fri, 23 Oct 2020 03:46:19 +0000 (03:46 +0000)
committerDmitri Shuralyov <dmitshur@golang.org>
Fri, 23 Oct 2020 19:57:55 +0000 (19:57 +0000)
Fixes #42160.

Change-Id: I9bf8b6f0bf1eccd3ab32cbd94c812f768746d291
Reviewed-on: https://go-review.googlesource.com/c/go/+/264557
Trust: Dmitri Shuralyov <dmitshur@golang.org>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
src/sync/once.go

index ca044082241232ec7ed7fe2a850a9e10d0978633..bf4b80c867dd561a2c9ad491ae52e91bc3d03418 100644 (file)
@@ -9,6 +9,8 @@ import (
 )
 
 // Once is an object that will perform exactly one action.
+//
+// A Once must not be copied after first use.
 type Once struct {
        // done indicates whether the action has been performed.
        // It is first in the struct because it is used in the hot path.