Golang go/ast.CaseClause.End() and Pos() functions example

package go/ast

Golang go/ast.CaseClause.End() and Pos() functions usage example

 func checkCurrentPosition(node ast.Node) string {
 n := node.(*ast.CaseClause)
 endpos := n.End()
 pospos := n.Pos()

 if pospos != endpos {
 return "not yet"
 }
 }

References :

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

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

Advertisement