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

package go/ast

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

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

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

References :

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

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

Advertisement