Conversation
0xmohit
force-pushed
the
feat/go-code-graph-extractor
branch
from
September 23, 2026 02:15
b18cd05 to
ce98025
Compare
Add code-graph extraction support for Go, wired through the contributor seam in docs/extractors.md: a GoWalker over the tree-sitter-go grammar, registered in the extractor registry and the grammar map. - Extract structs (class), interfaces, type aliases, functions, methods, generics, imports, calls, struct instantiations, and struct field types, with signatures, docstrings, visibility, and export state. - Methods bind to their receiver type through a deferred second pass, so a method resolves to a type declared later in the file with a single containment parent and a receiver-stable identity. - Vendor the grammar's own published wasm, tree-sitter-go@0.25.0 (https://github.com/tree-sitter/tree-sitter-go), at src/graph/wasm/tree-sitter-go.wasm. - Add fixture sample.go and 12 tests covering declarations, containment, references, generics, docstrings, multi-name declarations, and declaration-order independence. - Retarget the coverage-histogram fixtures to .java now that .go is an indexed source extension, so unindexed-source examples stay accurate. - Document Go support in docs/code-graph-support.md and the grammar provenance in docs/extractors.md. Fixes mex-memory#93
0xmohit
force-pushed
the
feat/go-code-graph-extractor
branch
from
September 23, 2026 02:44
ce98025 to
8e54feb
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add code-graph extraction support for Go, wired through the contributor
seam in docs/extractors.md: a GoWalker over the tree-sitter-go grammar,
registered in the extractor registry and the grammar map.
methods, generics, imports, calls, struct instantiations, and struct
field types, with signatures, docstrings, visibility, and export state.
a method resolves to a type declared later in the file with a single
containment parent and a receiver-stable identity.
(https://github.com/tree-sitter/tree-sitter-go), at
src/graph/wasm/tree-sitter-go.wasm.
references, generics, docstrings, multi-name declarations, and
declaration-order independence.
indexed source extension, so unindexed-source examples stay accurate.
provenance in docs/extractors.md.
Fixes #93
What
Add code-graph extraction support for Go. A new
GoWalker(insrc/graph/extraction/languages/go.ts) parses.gofiles with thetree-sitter-go@0.25.0grammar and emits:file,class(structs),interface,type_alias,function,method,property,variable, andconstantnodescontains,imports,calls,instantiates, andtype_ofedgesMethods bind to their receiver type via a deferred second pass, so a method resolves to a type declared later in the same file with a single containment parent and a receiver-stable identity.
The extractor is registered in
src/graph/extraction/languages/index.tsandsrc/graph/extraction/grammars.ts(.goextension), and the grammar's own publishedtree-sitter-go.wasm(v0.25.0) is vendored undersrc/graph/wasm/.Why
Closes #93. Go is one of the highest-demand languages for the code-graph; this is the first extractor for it, following the contributor workflow in
docs/extractors.md.Type of change
How to test
npm run typechecknpm test(full suite, 4188 passing)npm run buildnpx vitest run src/graph/__tests__/extractor-go.test.ts— 12 tests covering structs, interfaces, type aliases, functions, methods, generics, imports, calls, struct field types, docstrings, multi-name declarations, and declaration-order independence.mex graph rebuildon a 526-file Go repository (not public code) indexed 5826 files (5826/5826parse ok, 0 failed), creating 262,054 nodes / 297,812 edges;mex graph query where-definedresolves project-internal functions exactly, andmex graph scopereturns source-backed symbols with resolvedcalls/instantiatesflows at confidence 1.Checklist
npm test)Code-graph changes
mainLanguageExtractororFrameworkResolverinterfacecore / discuss-firstissue is linked above