diff --git a/gitnexus/src/core/ingestion/languages/go/captures.ts b/gitnexus/src/core/ingestion/languages/go/captures.ts index 778ccce68..1946b58ff 100644 --- a/gitnexus/src/core/ingestion/languages/go/captures.ts +++ b/gitnexus/src/core/ingestion/languages/go/captures.ts @@ -12,6 +12,7 @@ import { getTreeSitterBufferSize } from '../../constants.js'; const GO_BUILTIN_TYPES = new Set([ 'bool', 'byte', + 'comparable', 'complex128', 'complex64', 'error', @@ -180,9 +181,11 @@ export function emitGoScopeCaptures( let raw = typeCap.text.trim(); while (raw.startsWith('*')) raw = raw.slice(1).trim(); if (raw.startsWith('[]')) raw = raw.slice(2).trim(); + // Strip chan prefix so element type gets qualified: + // chan Event → pkg.Event (correct for cross-receiver dispatch) + // chan int → excluded by GO_BUILTIN_TYPES below (no phantom pkg.int) if (raw.startsWith('chan ')) raw = raw.slice(5).trim(); if (raw.includes('.') || raw.startsWith('func(') || raw.startsWith('map[')) continue; - if (raw.startsWith('chan ')) continue; if (GO_BUILTIN_TYPES.has(raw)) continue; const idx = raw.indexOf('['); if (idx !== -1) raw = raw.slice(0, idx); diff --git a/gitnexus/src/core/ingestion/languages/go/import-decomposer.ts b/gitnexus/src/core/ingestion/languages/go/import-decomposer.ts index 1bf466316..7a20ca791 100644 --- a/gitnexus/src/core/ingestion/languages/go/import-decomposer.ts +++ b/gitnexus/src/core/ingestion/languages/go/import-decomposer.ts @@ -29,6 +29,9 @@ export function splitGoImportStatement(node: SyntaxNode): CaptureMatch[] { const kind = alias === '.' ? 'dot' : alias === '_' ? 'blank' : alias === undefined ? 'namespace' : 'alias'; + // Blank imports (import _ "pkg") are dropped in V1 — they represent + // side-effect registrations (e.g. database drivers), but emitting + // side-effect edges is deferred. See test: go-imports.test.ts. if (kind === 'blank') return []; const aliased = alias !== undefined && alias !== '.' && alias !== '_'; diff --git a/gitnexus/src/core/ingestion/scope-resolution/passes/imported-return-types.ts b/gitnexus/src/core/ingestion/scope-resolution/passes/imported-return-types.ts index 0127bfd63..239393b8c 100644 --- a/gitnexus/src/core/ingestion/scope-resolution/passes/imported-return-types.ts +++ b/gitnexus/src/core/ingestion/scope-resolution/passes/imported-return-types.ts @@ -197,7 +197,7 @@ export function propagateImportedReturnTypes( } // Namespace-import mirroring: for languages with namespace-style - // imports (Go `import "pkg"`), mirror exported typeBindings from all + // imports (e.g. `import "pkg"`), mirror exported typeBindings from all // target files' module scopes into the importer's module scope. This // covers the cross-package case where `x := pkg.Func()` creates a // function-scope typeBinding `x → Func`, and the module-scope chain- @@ -212,7 +212,7 @@ export function propagateImportedReturnTypes( if (moduleEdges === undefined) continue; // Collect namespace target files per localName (one namespace may - // expand to multiple files — e.g. Go multi-file packages). + // expand to multiple files — e.g. multi-file namespace-import packages). const nsTargets = new Map(); for (const edge of moduleEdges) { if (edge.kind !== 'namespace' || edge.targetFile === null) continue;