A CLI tool that combines Go files from a module or directory into a single file for easy sharing with LLMs.
- Merges Go files while preserving package structure
- Excludes test files and unwanted directories/extensions
- Supports multiple packages
- Handles imports deduplication
- Outputs in a format suitable for LLM prompts
go install github.com/kndrad/mergo@latest
Or build from source:
git clone https://github.com/kndrad/mergo.git
cd mergo
go build
Merge Go module files:
mergo /path/to/module /path/to/output
Merge directory files:
mergo dir --path=/path/to/dir --out=/path/to/output
--exclude
: Exclude directories (default: .git, .gitignore)--exclude-ext
: Exclude file extensions (default: .sum, .md, .mod)
- Go 1.23.3 or later
MIT License - see LICENSE