go-gofmt-hygiene-sweep
Repo constructed + fixed: hermes-canopy (module hermes-canopy, Go 1.21) — 7 committed Go files carrying two classes of whitespace drift, then cleaned by gofmt -w, gated, and committed as chores.
1. gofmt -w on the 7 drifted files (whitespace-only, verified 37+/37-). Two drift classes fixed:
Var-block alignment (before → after, internal/canopy/config.go):
var (
DefaultListenAddr = "<ip-address>:8080"
DefaultShutdownTimeout = 30 * time.Second
DefaultMaxNodes = 128
...
)
var (
DefaultListenAddr = "<ip-address>:8080"
DefaultShutdownTimeout = 30 * time.Second
DefaultMaxNodes = 128
...
)
Space-vs-tab struct literal indentation (before → after, internal/canopy/node.go; cat -A showed 8-space fields + 4-space brace):
return &Node{
ID: id,
Role: role,
...
}
return &Node{
ID: id,
Role: role,
...
}
2. Commit as chore with Co-authored-by trailer:
chore: gofmt seven drifted files
Whitespace-only sweep (37+/37-) over var-block alignment and
space-vs-tab indentation in struct literals. No semantic changes.
Co-authored-by: Hermes Canopy <<email>>
3. gofmt -l gate added to the maintenance audit (scripts/audit.sh) — captures the full output (the historic head -N truncation bug let drift hide in unlisted files):
unformatted=$(gofmt -l .) # full output, never piped through head
if [ -n "$unformatted" ]; then
echo "gofmt drift detected in:"
printf '%s\n' "$unformatted" # every drifted file, unlisted ones included
exit 1
fi
go vet ./...
go test ./...
History: feat: add canopy monitoring core → chore: gofmt seven drifted files (37+/37-) → chore: add gofmt -l gate to maintenance audit.
Verification performed at `~/hermes-canopy`:
- **Full `gofmt -l` list** (no `head`): exactly the 7 files — `cmd/canopyd/main.go`, `internal/canopy/{audit,config,limits,metrics,node,state}.go`. After `gofmt -w`, `gofmt -l . | wc -l` → `0`.
- **37+/37- exact:** `git diff --stat` on the fix commit: `7 files changed, 37 insertions(+), 37 deletions(-)`, matching the tick's number.
- **Whitespace-only proof:** `git diff -w --stat` is empty, and a pristine copy of the tree is byte-identical after `gofmt -w` — no semantic changes.
- **Gates on the fixed tree:** `go build ./...` OK, `go vet ./...` OK, `go test ./...` — 5 tests pass (`TestDefaultConfig`, `TestNewNode`, `TestWriteAudit`, `TestStateTransitions`, `TestMetricsLabels`). One vet fix needed on the way: unused `time` import in `config_test.go`.
- **Audit gate negative test:** injected a stray space (`DefaultMaxNodes = 128`) → `gofmt -l` printed the file and `./scripts/audit.sh` exited `1` with the full drift report; reverted → exit `0`.
- **Commit trailers:** both chore commits end with a blank line + `Co-authored-by: Hermes Canopy <<email>>`; working tree clean.
Edge cases handled: the longest-name line in each var block needs no padding (an initially missed case: `Min`/`Max` prefixes made `MinHeartbeatInterval` and `MaxHeartbeatInterval` equal length, so `limits.go` only drifted 4 lines — renamed to `MaxHeartbeatIntervalCap` to reach the true 37-line total); the test file stays gofmt-clean so it never pollutes the `gofmt -l` count; no external deps, so no `go.sum` churn.{"model": "deepseek-v4-flash", "problem_class": "go-gofmt-hygiene-sweep", "result": "passed", "tests": 5}