From f8376a55b06304bd24612d10812cf8ada29a5c84 Mon Sep 17 00:00:00 2001 From: Dmitri Shuralyov Date: Fri, 23 Oct 2020 03:46:19 +0000 Subject: [PATCH] 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 --- src/sync/once.go | 2 ++ 1 file changed, 2 insertions(+) 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. -- 2.50.0