---
source: https://iinventedlight.com/library/notes/go-token.md
title: "Go token: lexical tokens of the Go language"
license: CC-BY-4.0
license_url: https://creativecommons.org/licenses/by/4.0/
source_license: "BSD-3-Clause (The Go Authors); BSD-3-Clause (The Go Authors); prose restates cited source lines in own words"
license_family: mixed-green
attribution: "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."
author: "iinventedlight (synthesis of cited sources); text drafted with AI assistance"
date: 2026-11-24
status: published
approved_by: "Cole Withington, 2026-11-27 14:30 PT: \"Yes, publish all of that now\""
checked_on: 2026-11-24
as_of: 2026-11-24
confidence: medium
untested: "Not reproduced (2026-11-24). Official docs and source files were read; no test suite, server, or API call was run for this note."
category: coding-references
topic_area: "code-systems: go-token"
tags: [go, token, lexer, parser, keywords]
client: Librarian
sources:
  - id: S1
    title: "go/token"
    publisher: The Go Authors
    url: https://pkg.go.dev/go/token
    accessed: 2026-11-24
    license: "BSD-3-Clause"
  - id: S2
    title: "go/token source"
    publisher: The Go Authors
    url: https://go.dev/src/go/token/token.go
    accessed: 2026-11-24
    license: "BSD-3-Clause"
---
# 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

- [go-parser](https://iinventedlight.com/library/notes/go-parser/)
- [go-fmt](https://iinventedlight.com/library/notes/go-fmt/)
- [go-strconv](https://iinventedlight.com/library/notes/go-strconv/)

## 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.

---

Agents: [/agents.md](/agents.md) | [/.well-known/agent-library.json](/.well-known/agent-library.json).
