Standard library / go/ast

go/ast.BadExpr.Pos()

Returns the stored From position of the malformed expression. Expected stdout: '3\n'.

Formal Syntax & Structure

go syntaxgo
func (x *BadExpr) Pos() token.Pos

Return Value

token.Pos

Returns the stored From position of the malformed expression.

Working Example

Example Snippetgo
package main
import (  "fmt"  "go/ast")
func main() { x := &ast.BadExpr{From: 3, To: 7}; fmt.Println(x.Pos()) }
Go Reference