Skip to content

Comments

feat(go): Add Go stdlib extraction tool for registry generation (PR-21)#548

Open
shivasurya wants to merge 1 commit intoshiva/go-stdlib-support-pr01from
shiva/go-stdlib-support-pr02
Open

feat(go): Add Go stdlib extraction tool for registry generation (PR-21)#548
shivasurya wants to merge 1 commit intoshiva/go-stdlib-support-pr01from
shiva/go-stdlib-support-pr02

Conversation

@shivasurya
Copy link
Owner

Summary

  • Add tools/internal/goextract package implementing Extractor for walking $GOROOT/src and extracting the full exported API surface of Go stdlib packages via go/parser and go/ast
  • Extract functions (signatures, params, returns, generics, variadic, methods), types (struct/interface/alias with fields and methods), constants (iota detection), and package-level variables with docstrings and deprecation markers
  • Generate per-package JSON files ({pkg}_stdlib.json) and manifest.json with SHA256 checksums and aggregate statistics (186 packages from Go 1.26 stdlib)
  • Add CLI entry point tools/generate_go_stdlib_registry.go with --go-version, --output-dir, and --goroot flags
  • Achieve 100% test coverage with 40+ unit tests and integration tests against real Go 1.26 stdlib

Test plan

  • go build ./... passes with zero errors
  • golangci-lint run ./... reports 0 issues
  • go test ./tools/internal/goextract/ — 100% coverage, all tests pass
  • Integration test extracts 186 packages from Go 1.26 stdlib, verifies fmt.Println variadic, slices.Sort generic, os.Stdin variable
  • Full module test suite go test ./... — all 29 packages pass
  • JSON output uses snake_case keys (import_path, is_variadic, is_generic, etc.) matching core types from PR-01

🤖 Generated with Claude Code

- Add tools/internal/goextract package with Extractor struct for walking
  GOROOT/src and extracting full API surface of stdlib packages
- Extract functions (with generics, variadic, methods), types (struct,
  interface, alias), constants (iota detection), and variables
- Generate per-package JSON files ({pkg}_stdlib.json) and manifest.json
  with SHA256 checksums and aggregate statistics
- Add CLI entry point tools/generate_go_stdlib_registry.go with
  --go-version, --output-dir, and --goroot flags
- Achieve 100% test coverage with unit and integration tests (186 packages
  extracted from Go 1.26 stdlib in integration test)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@shivasurya shivasurya added enhancement New feature or request go Pull requests that update go code labels Feb 21, 2026
@shivasurya shivasurya self-assigned this Feb 21, 2026
@shivasurya shivasurya added enhancement New feature or request go Pull requests that update go code labels Feb 21, 2026
@safedep
Copy link

safedep bot commented Feb 21, 2026

SafeDep Report Summary

Green Malicious Packages Badge Green Vulnerable Packages Badge Green Risky License Badge

No dependency changes detected. Nothing to scan.

This report is generated by SafeDep Github App

@codecov
Copy link

codecov bot commented Feb 21, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.14%. Comparing base (5f008bf) to head (d0b0db7).

Additional details and impacted files
@@                       Coverage Diff                        @@
##           shiva/go-stdlib-support-pr01     #548      +/-   ##
================================================================
+ Coverage                         82.68%   83.14%   +0.45%     
================================================================
  Files                               140      141       +1     
  Lines                             17143    17610     +467     
================================================================
+ Hits                              14174    14641     +467     
  Misses                             2427     2427              
  Partials                            542      542              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request go Pull requests that update go code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant