mirror of
https://github.com/imjasonh/slight
synced 2026-07-07 00:33:20 +00:00
No description
|
|
||
|---|---|---|
| cmd/slight | ||
| pkg | ||
| testdata | ||
| .gitignore | ||
| CLAUDE.md | ||
| CURRENT-STATE.md | ||
| go-tool-nm-analysis.md | ||
| go.mod | ||
| go.sum | ||
| LICENSE | ||
| plan.md | ||
| README.md | ||
| rebloat.sh | ||
| SESSION-SUMMARY.md | ||
| ssa-comparison-analysis.md | ||
slight
A Go vendor debloating tool that removes unused symbols from vendored dependencies.
Installation
go install github.com/imjasonh/slight/cmd/slight@latest
Usage
Analyze a project to see what could be removed:
slight analyze /path/to/project
Debloat a project (removes unused code from vendor/):
slight debloat /path/to/project
Dry run to see what would be removed:
slight debloat -dry-run /path/to/project
How it works
- Loads all packages with full type information using
go/packages - Builds an inventory of all symbols in vendor packages
- Analyzes usage from main code and tests to mark used symbols
- Computes transitive closure of dependencies
- Marks interface implementations to preserve polymorphic behavior
- Removes unused symbols and entire unused files
- Verifies the debloated code compiles and tests pass
Limitations
- Build tags: Only analyzes files for the current platform
- Reflection: May incorrectly mark symbols as unused if accessed via reflection
- Cross-compilation: Code that cross-compiles to other platforms may break
- Experimental: This is a demo tool, not production-ready