Skip to content

feat(core): Go scanner - registry integration and 90%+ test coverage #131

@prosdev

Description

@prosdev

Summary

Complete Go scanner integration into the scanner registry with comprehensive test coverage and production hardening.

Background

Part of Epic #128: Go Language Support
Depends on: #129 (Core Scanner), #130 (Methods & Generics)

Tasks

Registry Integration

  • Register GoScanner in createDefaultRegistry()
  • Add .go to supported extensions list
  • Update scanner auto-detection logic
  • Export from packages/core/src/scanner/index.ts

Generated File Handling

  • Skip files starting with // Code generated
  • Skip vendor/ directory
  • Skip common build artifacts (bin/, dist/)
  • Add isGenerated detection helper

Test Coverage (Target: 90%+)

  • Unit tests for all extraction types
  • Edge cases: empty files, syntax errors, partial files
  • Generated file skip logic tests
  • Integration test with realistic Go project structure
  • Test file detection (*_test.goisTest: true)

Documentation

  • Update packages/core/src/scanner/README.md with Go section
  • Add Go input/output examples
  • Document supported constructs table
  • Add troubleshooting notes

Edge Cases

  • Handle build tags: //go:build linux
  • Handle blank identifiers: var _ Interface = (*Impl)(nil)
  • Handle init functions: func init() {}
  • Handle embedded structs
  • Handle multiple declarations: var a, b, c int

Acceptance Criteria

  • Go scanner registered in default registry
  • dev index . works on Go repositories out of the box
  • Generated files (.gen.go, .pb.go) are skipped
  • Test coverage ≥ 90% (matching TypeScript scanner)
  • README updated with Go documentation
  • All edge cases handled gracefully (no crashes)

Test File Structure

packages/core/src/scanner/
├── go.ts                    # GoScanner implementation
├── go.test.ts               # Comprehensive test suite
├── __fixtures__/
│   └── go/
│       ├── simple.go        # Basic functions, structs
│       ├── methods.go       # Receiver methods
│       ├── generics.go      # Generic types and functions
│       ├── generated.go     # Should be skipped
│       └── edge-cases.go    # Build tags, init, embedded

References

  • TypeScript scanner coverage: 94.94%
  • Scanner test patterns: packages/core/src/scanner/scanner.test.ts

Metadata

Metadata

Assignees

No one assigned

    Labels

    pkg:corepackages/core - indexer, scanner, vectortype:featureNew functionality

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions