src/go/tools/expandstructs/README.md
expandstructs forces keyed struct composite literals to one field per line —
the second stage of this repository's recommended Go formatting pipeline
(see src/go/AGENTS.md → "Go Formatting").
golines -m 120 -t 4 -w <paths> # split >120 cols; SKIP if golines not installed
go run ./tools/expandstructs <paths>
goimports -w <paths>
expandstructs formats source in-process with go/format after each pass, so
it leaves files gofmt-clean without invoking an external formatter.
go run ./tools/expandstructs <path> [path ...]
A path may be a Go file or a directory; directories are walked for *.go
(skipping vendor, testdata, and dot directories). Example:
go run ./tools/expandstructs ./plugin/agent/jobmgr
T{...}, pkg.T{...},
T[X]{...}, optionally behind &) — one field per line with a trailing comma.T{},
elided-type nested literals, and any literal with a comment inside its braces
(so element comments are never dropped).This style is recommended, not CI-enforced. gofmt/goimports cannot express
it, so re-run the pipeline if code drifts.