]> Cypherpunks repositories - gostls13.git/commitdiff
reflect: better document the tri-state for TryRecv
authorRob Pike <r@golang.org>
Tue, 14 Jan 2014 23:04:16 +0000 (15:04 -0800)
committerRob Pike <r@golang.org>
Tue, 14 Jan 2014 23:04:16 +0000 (15:04 -0800)
R=rsc, iant
CC=golang-codereviews
https://golang.org/cl/52360043

src/pkg/reflect/value.go

index 89d329257bd8a6061a6f34c29d649af91343cd46..30b5e2a92fa556e7f54217236d8d9a6b62cd9280 100644 (file)
@@ -1832,9 +1832,9 @@ func (v Value) String() string {
 
 // TryRecv attempts to receive a value from the channel v but will not block.
 // It panics if v's Kind is not Chan.
-// If the receive cannot finish without blocking, x is the zero Value.
-// The boolean ok is true if the value x corresponds to a send
-// on the channel, false if it is a zero value received because the channel is closed.
+// If the receive delivers a value, x is the transferred value and ok is true.
+// If the receive cannot finish without blocking, x is the zero Value and ok is false.
+// If the channel is closed, x is the zero value for the channel's element type and ok is false.
 func (v Value) TryRecv() (x Value, ok bool) {
        v.mustBe(Chan)
        v.mustBeExported()