Golang go/ast.CompositeLit type example

package go/ast

A CompositeLit node represents a composite literal.

Golang go/ast.CompositeLit 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.CompositeLit:
 return "composite literal"
 ...
 }

Reference :

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

Advertisement