Repository navigation
Description
Environment
- graphifyy 0.9.31 (PyPI,
uv tool install), macOS Apple Silicon, Python 3.11 - Extraction invoked directly via
graphify.extract.extract(files, parallel=False) - Also reproduced end-to-end on a ~1,300-file Go + TypeScript repo (20.7k nodes)
Summary
The Go extractor does not emit nodes for package-level var or const declarations. graphify/extractors/go.py's walk() matches exactly four declaration types:
if t == "function_declaration": # L209
if t == "method_declaration": # L223
if t == "type_declaration": # L256
if t == "import_declaration": # L325There is no var_declaration or const_declaration branch, so Go constants and package-level data are absent from the node table entirely. Questions like "where is ReasonDisallowedObject defined", "what is in DefaultBlacklist", or "who references CheckQRStatus" are unanswerable, because the identifier is not in the graph at any confidence level.
This is the same bug class as #1700 (Kotlin/Java enum constants), which was accepted and fixed, applied to Go.
Reproducer (2 files)
policy.go
package demo
var DefaultBlacklist = []string{"vape", "box cutter", "power bank"}
const ReasonDisallowedObject = "DISALLOWED_OBJECT"
const (
CheckQRStatus = "qr_status"
CheckDisallowedObject = "disallowed_object"
)
func Blacklist() []string { return DefaultBlacklist }use.go
package demo
func Classify(obj string) string {
for _, b := range DefaultBlacklist {
if b == obj {
return ReasonDisallowedObject
}
}
return CheckQRStatus
}Current behavior (0.9.31)
Complete node list for both files:
policy.go <- policy.go L1
Blacklist() <- policy.go L13
use.go <- use.go L1
Classify() <- use.go L3
DefaultBlacklist, ReasonDisallowedObject, CheckQRStatus and CheckDisallowedObject produce no nodes, and the Classify() -> DefaultBlacklist reference edge is therefore also absent.
Expected behavior
Package-level var and const identifiers get nodes (as Go's own go/doc and gopls treat them: package-level declared identifiers), with contains edges from the file node and references edges from functions that use them. Matching the treatment of type_declaration would be consistent.
Why this matters beyond one symbol
Go codebases conventionally express enums, sentinel values, error codes, status strings and policy data as package-level const blocks and var slices/maps. In our repo, every screening reason code (DISALLOWED_OBJECT, QR_UNREGISTERED, ...) and every policy list is a Go const/var, so none of that domain vocabulary exists in the graph.
That has a second-order effect on query quality. The Step 0 constrained vocabulary expansion in references/query.md builds .vocab.txt from node labels. Because Go consts are absent but the TypeScript/JS path (via engine.py, which does handle lexical_declaration/variable_declaration) indexes frontend constants fine, the vocabulary is systematically skewed toward the frontend. In our case, asking about a domain term whose only indexed occurrence was a frontend display constant seeded traversal from UI labels and returned noise, while the backend logic that actually implements it was unreachable through query expansion.
So in mixed Go + TypeScript repos this does not just hide symbols, it biases query seeding away from the backend.
Suggested fix
Add var_declaration / const_declaration handling to walk() in graphify/extractors/go.py, iterating var_spec / const_spec children and emitting one node per declared name (mirroring how type_declaration iterates type_spec). Happy to open a PR if the approach looks right.
Activity
fix(go): credit calls in a package-level var initialiser to the file (#…
safishamsi commentedon Oct 30, 2026
Fixed in v0.9.99 via #4867 (pip install graphifyy==0.9.99). A call in a package-level var initialiser is now credited to the file node. Thanks for the report, @Baker21ai.
fix(go): reference the types a package-level var initialiser names (#…
Merge pull request #4932 from nothariharan/fix/go-package-var-type-re…