From: Dmitri Shuralyov Date: Fri, 23 Oct 2020 03:46:19 +0000 (+0000) Subject: sync: document that Once must not be copied X-Git-Tag: go1.16beta1~571 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=f8376a55b06304bd24612d10812cf8ada29a5c84;p=gostls13.git 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 Run-TryBot: Dmitri Shuralyov TryBot-Result: Go Bot Reviewed-by: Bryan C. Mills --- 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.