Standard library / go/token
go/token.Token.IsKeyword()
Reports whether the token is a Go keyword. Expected stdout: 'true false\n'.
Formal Syntax & Structure
go syntaxgo
func (tok Token) IsKeyword() boolReturn Value
bool
Reports whether the token is a Go keyword.
Working Example
Example Snippetgo
package main
import ( "fmt" "go/token")
func main() { fmt.Println(token.FUNC.IsKeyword(), token.IDENT.IsKeyword()) }