Standard library / go/ast

go/ast.Stmt

Interface for stmt syntax nodes. Node positions are exposed through Pos and End; concrete forms can be distinguished with a type switch. Expected stdout: '*ast.ReturnStmt\n'.

Formal Syntax & Structure

go syntaxgo
type Stmt interface {  Node}

Working Example

Example Snippetgo
package main
import (  "fmt"  "go/ast")
func main() { var n ast.Stmt = &ast.ReturnStmt{}; fmt.Printf("%T\n", n) }
Go Reference