Standard library / go/types
go/types.Chan.Dir()
Returns the channel direction. Expected stdout: 'true\n'.
Formal Syntax & Structure
go syntaxgo
func (c *Chan) Dir() ChanDirReturn Value
ChanDir
Returns the channel direction.
Working Example
Example Snippetgo
package main
import ( "fmt" "go/types")
func main() { t := types.NewChan(types.SendOnly, types.Typ[types.Int]) fmt.Println(t.Dir() == types.SendOnly)}