Standard library / go/ast

go/ast.Spec

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

Formal Syntax & Structure

go syntaxgo
type Spec interface {  Node
}

Working Example

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