Standard library / reflect
reflect.Value.Recv()
Receives a value from a channel, blocking when necessary. The flag distinguishes a sent value from the zero value after closure. Expected stdout: '8 true\n'.
Formal Syntax & Structure
go syntaxgo
func (v Value) Recv() (x Value, ok bool)Return Value
(x Value, ok bool)
Receives a value from a channel, blocking when necessary.
Working Example
Example Snippetgo
package main
import ( "fmt" "reflect")
func main() { ch := make(chan int, 1) v := reflect.ValueOf(ch) ch <- 8 x, ok := v.Recv() fmt.Println(x.Int(), ok)}