Golang go/ast.GoStmt type examples

package go/ast

A GoStmt node represents a go statement.

Golang go/ast.GoStmt type usage examples

Example 1:

 func NodeDescription(n ast.Node) string {
 switch n := n.(type) {
 case *ast.ArrayType:
 return "array type"
 case *ast.AssignStmt:
 return "assignment"
 case *ast.GoStmt:
 return "go statement"
 }

Example 2:

 case *ast.GoStmt:
 fmt.Println(token.GO)

Reference :

http://golang.org/pkg/go/ast/#GoStmt

Advertisement