tree-sitter-go

A fast, incremental Go grammar for the tree-sitter parsing library

Library
Cargo
v0.25.0
419stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
45/100Fair
Development Activity4
Maintenance20
Community76
Maturity60
Momentum20

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
72/100Good
Architecture77
Code Quality74
Innovation70
Learning Curve65

tree-sitter-go is the official Go language grammar for tree-sitter, the incremental parsing library used by editors and developer tools to build concrete syntax trees. It defines Go’s syntax (structs, interfaces, goroutines, generics) in a declarative grammar that compiles to a generated C parser plus bindings for Rust, Node.js, Python, Go, and Swift.

Editors, linters, and static-analysis tools consume this grammar to parse Go source incrementally and error-tolerantly, powering features like syntax highlighting, code folding, and structural navigation without invoking the full Go compiler toolchain.

What You Get

  • A complete, actively maintained Go grammar covering modern syntax including generics and goroutine/channel constructs
  • A generated, dependency-free C parser (parser.c) compiled from the grammar for use in any host language
  • Official bindings for Rust, Go, Node.js, Python, and Swift for embedding the grammar directly in tooling
  • Highlight and tag queries (queries/highlights.scm) mapping syntax nodes to editor highlighting categories
  • A corpus of test fixtures (test/corpus) validating grammar correctness against real Go code samples

Common Use Cases

  • Editor syntax highlighting - power tree-sitter-based highlighting for Go files in editors like Neovim, Helix, and Zed
  • Code navigation tooling - build ‘jump to definition’ and structural outlines by querying the parsed Go syntax tree
  • Static analysis and linters - traverse the concrete syntax tree to implement custom Go lint rules without invoking go/parser
  • Language server implementations - use the grammar as the incremental parsing layer underneath a Go LSP server

Under The Hood

Architecture - The grammar is authored in grammar.js as a JavaScript DSL describing Go’s syntax rules (declarations, statements, expressions, generics). The tree-sitter CLI compiles this into a generated, table-driven src/parser.c, with src/node-types.json describing the resulting AST node schema; unlike some other grammars, Go needs minimal external scanning since its syntax is largely context-free.

Tech Stack - The grammar source is JavaScript, but the shipped artifact is generated C code with zero runtime dependencies beyond tree-sitter-language; the repo ships first-class bindings for Rust (Cargo.toml), Go (go.mod), Node.js (package.json, binding.gyp), Python (pyproject.toml, setup.py), and Swift (Package.swift).

Code Quality - Correctness is validated through a test/corpus directory of annotated Go snippets paired with expected parse trees; CI runs across the various language bindings before each Cargo/npm/PyPI release, keeping the grammar in sync as Go language features (like generics) evolve.

API Design - Consumers interact through a minimal surface: a single exported language constant handed to the generic tree-sitter runtime API, so there’s effectively no Go-specific API to learn beyond tree-sitter’s own parser/query interface, keeping integration overhead low.

Used by 6 apps in this directory

TypeScript
72%
MIT

Claude Context

AI Code Assistants

12,498

An MCP server and VS Code extension by Zilliz that turns your entire codebase into semantically searchable context for Claude Code, Cursor, and Gemini CLI, using vector embeddings and Merkle-tree change detection.

View details
49
Repo Health
71
Technical
71
Dependency
Built with
TypeScript72%
Python13%
JavaScript11%
Updated 1 months ago
JavaScript
51%
Apache 2.0

claude-mem

AI Agents · AI Development

93,347

Give your AI coding agents persistent memory — claude-mem captures everything that happens during sessions, compresses it with AI, and surfaces the right context in every future session automatically.

View details
86
Repo Health
82
Technical
77
Dependency
Built with
JavaScript51%
TypeScript47%
Updated yesterday
Rust
52%
Apache 2.0

cocoindex

Data Engineering · AI Development

11,496

An incremental data indexing engine that keeps AI agent context perpetually fresh by reprocessing only what changed.

View details
86
Repo Health
85
Technical
64
Dependency
Built with
Rust52%
Python48%
Updated 2 days ago
C
86%
MIT

codegraph

Developer Tools · AI Code Assistants

69,843

A pre-indexed code knowledge graph that cuts AI tool calls by 58% and token costs by 16% — auto-syncing, 100% local, works with Claude Code, Cursor, Codex, and more.

View details
82
Repo Health
85
Technical
72
Dependency
Built with
C86%
TypeScript11%
Updated 1 weeks ago
TypeScript
92%
Other

GitNexus

Developer Tools · AI Code Assistants

47,086

Index any codebase into an interactive knowledge graph and give your AI agents deep architectural context via MCP — with zero servers required.

View details
88
Repo Health
86
Technical
73
Dependency
Built with
TypeScript92%
Updated yesterday
Rust
93%
Other

Tabby

AI Code Assistants

33,868

Self-hosted AI coding assistant — run GitHub Copilot-grade code completion on your own hardware with no cloud dependency.

View details
60
Repo Health
78
Technical
61
Dependency
Built with
Rust93%
Updated 2 months ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search