Standard library / go/token
go/token.Pos.IsValid()
Tests whether a compact position differs from NoPos; does not test membership in a particular set. Expected stdout: 'false true\n'.
Formal Syntax & Structure
go syntaxgo
func (p Pos) IsValid() boolReturn Value
bool
Tests whether a compact position differs from NoPos; does not test membership in a particular set.
Working Example
Example Snippetgo
package main
import ( "fmt" "go/token")
func main() { fmt.Println(token.NoPos.IsValid(), token.Pos(1).IsValid()) }