Standard library / reflect
reflect.SelectSend
Send case uses a channel and an assignable send value. Expected stdout: '0 5\n'.
Formal Syntax & Structure
go syntaxgo
const SelectSend SelectDir = 1Working Example
Example Snippetgo
package main
import ( "fmt" "reflect")
func main() { ch := make(chan int, 1) v := reflect.ValueOf(ch) i, _, _ := reflect.Select([]reflect.SelectCase{{Dir: reflect.SelectSend, Chan: v, Send: reflect.ValueOf(5)}}) fmt.Println(i, <-ch)}