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

package go/ast

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

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

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

 }

References :

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

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

Advertisement