Standard library / go/types

go/types.Chan.Elem()

Channel element type. Expected stdout: 'int\n'.

Formal Syntax & Structure

go syntaxgo
func (c *Chan) Elem() Type

Return Value

Type

Channel element type.

Working Example

Example Snippetgo
package main
import (  "fmt"  "go/types")
func main() { t := types.NewChan(types.SendOnly, types.Typ[types.Int]); fmt.Println(t.Elem()) }
Go Reference