diff options
author | Dmitri Shuralyov <dmitshur@golang.org> | 2020-10-23 03:46:19 +0000 |
---|---|---|
committer | Dmitri Shuralyov <dmitshur@golang.org> | 2020-10-23 19:57:55 +0000 |
commit | f8376a55b06304bd24612d10812cf8ada29a5c84 (patch) | |
tree | 4005dc8dd307d8bf11bfc519b1cc9263d51aa7cb /src/sync | |
parent | 3931cc113f3f3e7d484842d6e4f53b7a78311e8e (diff) | |
download | go-f8376a55b06304bd24612d10812cf8ada29a5c84.tar.gz go-f8376a55b06304bd24612d10812cf8ada29a5c84.zip |
sync: document that Once must not be copied
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>
Diffstat (limited to 'src/sync')
-rw-r--r-- | src/sync/once.go | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/sync/once.go b/src/sync/once.go index ca04408224..bf4b80c867 100644 --- a/src/sync/once.go +++ b/src/sync/once.go @@ -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. |