]> Cypherpunks repositories - gostls13.git/commitdiff
sync: improve once.Do documentation readability
authorJosh Bleecher Snyder <josharian@gmail.com>
Wed, 28 Aug 2013 02:53:59 +0000 (12:53 +1000)
committerRob Pike <r@golang.org>
Wed, 28 Aug 2013 02:53:59 +0000 (12:53 +1000)
The previous wording, though accurate, was hard to parse.
In particular, it was tempting to interpret "the method"
as referring to "the function f" instead of "Do", and
required effort to find the correct antecedent for
"this receiver".

R=golang-dev, bradfitz, r
CC=golang-dev
https://golang.org/cl/13307043

src/pkg/sync/once.go

index 1699e86a9eb396274325310c91e91f1f019be531..161ae3b3e968530524c4c519382e297a684c7426 100644 (file)
@@ -14,8 +14,8 @@ type Once struct {
        done uint32
 }
 
-// Do calls the function f if and only if the method is being called for the
-// first time with this receiver.  In other words, given
+// Do calls the function f if and only if Do is being called for the
+// first time for this instance of Once.  In other words, given
 //     var once Once
 // if once.Do(f) is called multiple times, only the first call will invoke f,
 // even if f has a different value in each invocation.  A new instance of