1
0
Fork 0
mirror of https://github.com/imjasonh/slight synced 2026-07-07 00:33:20 +00:00
No description
Find a file
Jason Hall ccb2a32090 license and readme
Signed-off-by: Jason Hall <jason@chainguard.dev>
2026-01-13 13:29:18 -05:00
cmd/slight debloat command 2026-01-12 18:01:45 -05:00
pkg debloating works, incl test-only deps 2026-01-13 13:28:14 -05:00
testdata debloating works, incl test-only deps 2026-01-13 13:28:14 -05:00
.gitignore debloating works, incl test-only deps 2026-01-13 13:28:14 -05:00
CLAUDE.md debloating works, incl test-only deps 2026-01-13 13:28:14 -05:00
CURRENT-STATE.md debloating works, incl test-only deps 2026-01-13 13:28:14 -05:00
go-tool-nm-analysis.md debloating works, incl test-only deps 2026-01-13 13:28:14 -05:00
go.mod initial commit 2026-01-12 17:15:36 -05:00
go.sum initial commit 2026-01-12 17:15:36 -05:00
LICENSE license and readme 2026-01-13 13:29:18 -05:00
plan.md debloating works, incl test-only deps 2026-01-13 13:28:14 -05:00
README.md license and readme 2026-01-13 13:29:18 -05:00
rebloat.sh debloating works, incl test-only deps 2026-01-13 13:28:14 -05:00
SESSION-SUMMARY.md debloating works, incl test-only deps 2026-01-13 13:28:14 -05:00
ssa-comparison-analysis.md debloating works, incl test-only deps 2026-01-13 13:28:14 -05:00

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

  1. Loads all packages with full type information using go/packages
  2. Builds an inventory of all symbols in vendor packages
  3. Analyzes usage from main code and tests to mark used symbols
  4. Computes transitive closure of dependencies
  5. Marks interface implementations to preserve polymorphic behavior
  6. Removes unused symbols and entire unused files
  7. 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