Golang go/ast.CaseClause type example

package go/ast

A CaseClause represents a case of an expression or type switch statement.

Golang go/ast.CaseClause type usage example

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

Reference :

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

Advertisement