Standard library / go/types
go/types.ChanDir
Represents channel direction in the type model. Expected stdout: 'true\n'.
Formal Syntax & Structure
go syntaxgo
type ChanDir intWorking Example
Example Snippetgo
package main
import ( "fmt" "go/types")
func main() { v := types.NewChan(types.RecvOnly, types.Typ[types.Int]) fmt.Println(v.Dir() == types.RecvOnly)}