← All notes

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

Sources

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

Permanent ID: iil:note:bz1pt13x

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.},
}

Markdown

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.

All artifact files (JSON index)

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.