Standard library / reflect
reflect.Value.Send()
Sends an assignable value on a channel and may block until a receiver or buffer is ready. Expected stdout: '8\n'.
Formal Syntax & Structure
go syntaxgo
func (v Value) Send(x Value)Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| x | Value | Value assignable to the channel element type. |
Working Example
Example Snippetgo
package main
import ( "fmt" "reflect")
func main() { ch := make(chan int, 1) v := reflect.ValueOf(ch) v.Send(reflect.ValueOf(8)) fmt.Println(<-ch)}