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 int

Working Example

Example Snippetgo
package main
import (  "fmt"  "reflect")
func main() { fmt.Println(reflect.TypeOf((chan<- int)(nil)).ChanDir() == reflect.SendDir) }
Go Reference