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

package go/ast

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

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

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

References :

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

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

Advertisement