Standard library / reflect
reflect.ChanDir
Direction of a channel type: receive-only, send-only or bidirectional. Expected stdout: 'true\n'.
Formal Syntax & Structure
go syntaxgo
type ChanDir intWorking Example
Example Snippetgo
package main
import ( "fmt" "reflect")
func main() { fmt.Println(reflect.TypeOf((chan<- int)(nil)).ChanDir() == reflect.SendDir) }