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

package go/ast

Pos and End implementations for declaration nodes.

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

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

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

Reference :

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

Advertisement