Golang go/ast.KeyValueExpr type example

package go/ast

A KeyValueExpr node represents (key : value) pairs in composite literals.

Golang go/ast.KeyValueExpr type usage example

 var elts []ast.Expr
 for _, e := range elts {
 if kv, ok := e.(*ast.KeyValueExpr); ok { // <-- here
 i = b.expr(fn, kv.Key).(*Const).Int64()
 } else {
  i++
 }

Reference :

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

Advertisement