Skip to content

Add Go repository graph extractor #64

Description

@RomanEmreis

What problem does this solve?

The generic extractor exposes Go files and manifests, but Ferrus cannot navigate packages, declarations, imports, receiver methods, or module relationships as structured graph facts.

Proposed solution

Add a deterministic Go extractor through the existing Extractor boundary.

Scope:

  • Support .go source files plus statically readable go.mod and go.work metadata.
  • Emit packages, functions, methods, receiver types, structs, interfaces, aliases, named types, constants, variables, and bounded declaration metadata with evidence spans.
  • Emit imports, package membership, embedding, receiver-method, module, workspace, replacement, and declared dependency relationships when statically provable.
  • Resolve repository-local packages and workspace modules conservatively without invoking go list, the compiler, generators, cgo, or module downloads.
  • Treat build constraints and platform-specific files explicitly so facts are not presented as universally active when the configuration is unknown.
  • Preserve dot imports, generated targets, external packages, and ambiguous build-tag results as unresolved or qualified evidence.

Acceptance criteria

  • Identical immutable input produces deterministic node, edge, semantic-key, and diagnostic output.
  • Incomplete or malformed source produces bounded diagnostics while preserving recoverable facts.
  • Parser time, file, fact, value, and diagnostic limits are enforced during extraction.
  • Source bodies, initializer values, secrets, and absolute local paths are not persisted.
  • Add/change/delete/rename and module/workspace fixtures invalidate only the required fragments and resolution facts.
  • Tests cover packages, methods, embedding, interfaces, aliases, internal packages, modules, workspaces, replacements, build constraints, and unresolved imports.
  • User documentation lists supported syntax and known resolution limits.

Impact on workflow

None. This extends optional derived repository context and must not alter task, run, lease, review, or approval state.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions