Repository navigation
analyzers: add tree-sitter based Go analyzer - #140
Merged
Merged
Conversation
Functions, methods, structs, interfaces (with their method signatures),
and other defined types (type Kind int) become components; call,
field-type, embedding, composite-literal, signature/local-var type, and
interface-implementation edges connect them. Methods are keyed by their
receiver type (Buffer.Push, pointer or value receiver alike) across all
files of the package. _test.go files and vendor/ are skipped.
A Go package is a directory, so names not defined in the file are
emitted as package references ("sub/*.go::Name") and resolved by
CallGraphAnalyzer inside that package, the way Dart resolution is
scoped. Imports of the repo's own packages map to directories through
the module path in go.mod (and local replace directives); standard
library and third-party calls are dropped. Types are linked to the
interfaces of their own package whose methods they declare.
Wires .go through the call-graph dispatch, supported-language lists,
extension maps, CLI validators, and MCP change detection. The grammar
comes from tree-sitter-language-pack, so no new dependency.
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.
Adds Go to the dependency analyzer, following the Rust analyzer (#0dbacb6).
Components: functions, methods keyed by receiver type (
Buffer.Push, pointer or value receiver, from any file of the package), structs, interfaces (and their methods), other named types. Ids arepath/file.go::Name.Edges: calls, struct literals, field types, embedded types, types in parameters/results/locals/type assertions/conversions, and a type → interface link when it has the interface's methods (same package).
Resolution: a Go name resolves only inside the package (folder) it names. Repo packages are found through
go.mod's module path (and localreplacelines); standard-library and outside-module calls are dropped rather than bound by name to an unrelated component (same rule as Dart).Skipped:
_test.gofiles andvendor/.The grammar comes from
tree-sitter-language-pack, so there is no new dependency. Wired through the call-graph dispatch, supported-language lists, extension maps, CLI validators and MCP change detection;guides/development.md, README and CHANGELOG updated.Tests:
tests/test_go_analyzer.py(15 tests). Full suite 331 passed;ruff checkandruff format --checkclean. On tidwall/gjson: 120 components, 235 edges, every call ingjson.goresolved. On go-chi/chi, calls frommiddleware/into the root package resolve through the module path.Known limits: method calls on a value of unknown type match only a unique method name among visible packages; methods promoted through an embedded type from another package, type aliases, package-level vars/consts and dot imports are not followed.