Standard library / go/ast
go/ast.Expr
Interface for expr syntax nodes. Node positions are exposed through Pos and End; concrete forms can be distinguished with a type switch. Expected stdout: '*ast.Ident\n'.
Formal Syntax & Structure
go syntaxgo
type Expr interface { Node}Working Example
Example Snippetgo
package main
import ( "fmt" "go/ast")
func main() { var n ast.Expr = ast.NewIdent("x"); fmt.Printf("%T\n", n) }