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

package go/ast

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

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

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

Reference :

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

Advertisement