Go token: lexical tokens of the Go language
Answer: The token package defines constants for the lexical tokens of the Go programming language.
Tokens and operations
It also defines basic operations on tokens, including printing and predicates.
Token is the set of lexical tokens of the language, represented as an integer type.
The list includes special tokens, identifiers, literals, operators, and keywords.
IsKeyword reports whether a name is a keyword.
Token kinds
Special tokens include ILLEGAL, EOF, and COMMENT.
Literal classes include IDENT, INT, FLOAT, IMAG, CHAR, and STRING.
For operators and keywords, the printed string is the actual token character sequence.
See also
Claims
- id: C1 claim: The package defines constants for Go's lexical tokens. source: S1 evidence: "Package token defines constants representing the lexical tokens of the Go programming language"
- id: C2 claim: It also defines basic operations on tokens, including printing and predicates. source: S1 evidence: "basic operations on tokens (printing, predicates)"
- id: C3 claim: The package defines constants for Go's lexical tokens. source: S2 evidence: "Token is the set of lexical tokens of the Go programming language."
- id: C4 claim: Token is the set of lexical tokens of the language. source: S2 evidence: "Token is the set of lexical tokens of the Go programming language."
Sources
- [S1] go/token. The Go Authors. https://pkg.go.dev/go/token . License: BSD-3-Clause. Accessed 2026-11-24.
- [S2] go/token source. The Go Authors. https://go.dev/src/go/token/token.go . License: BSD-3-Clause. Accessed 2026-11-24.
License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: The Go Authors, go/token; The Go Authors, go/token source. BSD-3-Clause (https://go.dev/LICENSE). Copyright The Go Authors. Text was condensed and changed from the originals.
License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: The Go Authors, go/token; The Go Authors, go/token source. BSD-3-Clause (https://go.dev/LICENSE). Copyright The Go Authors.
Cite this
iinventedlight. 2026. "Go token: lexical tokens of the Go language." iinventedlight Library, iil:note:bz1pt13x, version of 2026-11-24. https://iinventedlight.com/library/notes/go-token/. License: CC-BY-4.0.
@misc{iil_note_bz1pt13x,
author = {{iinventedlight}},
title = {{Go token: lexical tokens of the Go language}},
howpublished = {iinventedlight Library},
year = {2026},
date = {2026-11-24},
url = {https://iinventedlight.com/library/notes/go-token/},
note = {Permanent ID iil:note:bz1pt13x. License: CC-BY-4.0.},
}
Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com. Or Report a correction (no account needed).
Extra files beside this note
These files use this note's license, shown below. Paper extras retain their reproduction status; a link is not a reproduction.
- go-token.schema.json (schema; CC-BY-4.0)
- go-token.table.json (table; CC-BY-4.0)
For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/go-token.md.