Format
Default workflow (small, safe diffs)
- •Run formatters:
- •
gofmtfor formatting - •
goimportsfor import grouping and unused imports
- •
- •Avoid drive-by refactors. Formatting should not change behavior.
- •After formatting, run a quick test pass:
- •prefer targeted package tests first; run all tests if requested or if changes are broad
Commands (examples)
Format everything:
bash
gofmt -w .
If goimports is available:
bash
goimports -w .
If you want to use the containerized toolchain (no local Go required), you can run tests in Docker afterward:
bash
docker run --rm -v "$PWD":/src -w /src golang:1.25.6-alpine sh -c "go test ./..."
Notes
- •
gofmtis non-negotiable for Go; keep code gofmt-clean. - •Import grouping should match Go conventions (std vs third-party).