Miller is a command-line data processing tool for working with CSV, TSV, JSON, and other data formats. It's written in Go (v1.18+) and provides SQL-like operations on data.
The make staticcheck target requires the staticcheck tool. To set it up:
go install honnef.co/go/tools/cmd/staticcheck@latestThis installs staticcheck to ~/go/bin/ (the default Go binaries directory). For make staticcheck to work, you need ~/go/bin in your PATH.
Add to your shell profile (.bashrc, .zshrc, or equivalent):
export PATH="$PATH:$HOME/go/bin"Verify the installation:
staticcheck -versionIf this works, you can use make staticcheck without any further setup.
make build # Build the mlr executable
make quiet # Build silently (no output messages)make check # Run all tests (unit + regression)
make unit-test # Run unit tests only
make regression-test # Run regression tests only
make bench # Run benchmarksmake fmt # Format code with go fmt
make staticcheck # Run static analysis (see Initial Setup section above)make dev # Format, build, test, generate docs (comprehensive check before pushing)cmd/mlr- Main Miller executable entry pointpkg/- Core library code organized by functionalitypkg/lib/- Utility librariespkg/scan/- Input scanningpkg/mlrval/- Miller value typespkg/bifs/- Built-in functionspkg/input/- Input format handlers
regression_test.go- Regression test suitedocs/- Documentation (Markdown with live code samples)man/- Man page generation
- Follow Go conventions and
go fmtoutput - Use meaningful variable and function names
- Keep functions focused and testable
- Add unit tests for new functionality in
pkg/*/directories - Use
go testfor unit tests - Run
make regression-testfor integration testing - The
mlr regtestcommand provides more control for interactive debugging
- Update relevant
.md.infiles indocs/src/when adding features - These are processed into live documentation with actual code examples
- Run
make devto rebuild documentation
- Create descriptive commit messages
- Reference issue numbers when fixing bugs or implementing features
- Test locally with
make checkbefore committing - For major changes, run
make devto ensure docs and tests pass
Miller uses the Go standard library. Check go.mod for specific versions.
- Implement in appropriate package (likely
pkg/bifs/) - Add unit tests alongside
- Update documentation in
docs/src/ - Run
make checkto verify
- Create a minimal test case (unit test or regression test)
- Fix the code
- Verify with
make check - Commit with reference to issue number
- Run
make benchto establish baseline - Make changes
- Run benchmarks again to measure improvement
- Consider adding permanent benchmark in test files
Documentation is built from .md.in template files that contain live code samples executed via Miller itself. When you make changes that affect command output or behavior, you may need to update these templates and rebuild docs with make -C docs/src forcebuild.
Always run:
make devThis ensures code formatting, builds successfully, passes all tests, and documentation is up to date.