Commit 591265fc authored by Rob Pike's avatar Rob Pike

reflect: better document the tri-state for TryRecv

R=rsc, iant
CC=golang-codereviews
https://golang.org/cl/52360043
parent 8454e2c2
...@@ -1832,9 +1832,9 @@ func (v Value) String() string { ...@@ -1832,9 +1832,9 @@ func (v Value) String() string {
// TryRecv attempts to receive a value from the channel v but will not block. // TryRecv attempts to receive a value from the channel v but will not block.
// It panics if v's Kind is not Chan. // It panics if v's Kind is not Chan.
// If the receive cannot finish without blocking, x is the zero Value. // If the receive delivers a value, x is the transferred value and ok is true.
// The boolean ok is true if the value x corresponds to a send // If the receive cannot finish without blocking, x is the zero Value and ok is false.
// on the channel, false if it is a zero value received because the channel is closed. // 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) { func (v Value) TryRecv() (x Value, ok bool) {
v.mustBe(Chan) v.mustBe(Chan)
v.mustBeExported() v.mustBeExported()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment