Standard library / go/token
go/token.Position.IsValid()
Tests whether the line number is positive. Expected stdout: 'true\nfalse\n'.
Formal Syntax & Structure
go syntaxgo
func (pos *Position) IsValid() boolReturn Value
bool
Tests whether the line number is positive.
Working Example
Example Snippetgo
package main
import ( "fmt" "go/token")
func main() { p := token.Position{Line: 1} fmt.Println(p.IsValid()) p.Line = 0 fmt.Println(p.IsValid())}