← back to Cli Printing Press
docs(cli): use go fmt ./... for formatting instructions (#324)
9b97201ff60b1a2201b54f9fdcce01d83448acc3 · 2026-04-26 19:52:43 -0700 · Trevin Chow
The documented `gofmt -w ./...` does not actually work — `gofmt` does
not accept Go package patterns. Switching to `go fmt ./...` runs cleanly
and skips `testdata` and `vendor` by convention, which matters here
because `testdata/golden/expected/` holds byte-frozen Go fixtures that
the golden harness verifies.
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Files touched
Diff
commit 9b97201ff60b1a2201b54f9fdcce01d83448acc3
Author: Trevin Chow <trevin@trevinchow.com>
Date: Sun Apr 26 19:52:43 2026 -0700
docs(cli): use go fmt ./... for formatting instructions (#324)
The documented `gofmt -w ./...` does not actually work — `gofmt` does
not accept Go package patterns. Switching to `go fmt ./...` runs cleanly
and skips `testdata` and `vendor` by convention, which matters here
because `testdata/golden/expected/` holds byte-frozen Go fixtures that
the golden harness verifies.
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
---
AGENTS.md | 4 ++--
README.md | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/AGENTS.md b/AGENTS.md
index 83cbc9ff..02b13f46 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -41,13 +41,13 @@ The rule is enforced in two places. The absorb manifest has a Kill Check (see `s
```bash
go build -o ./printing-press ./cmd/printing-press
go test ./...
-gofmt -w ./...
+go fmt ./...
golangci-lint run ./...
```
A pre-commit hook runs `gofmt -w` on staged Go files automatically. A pre-push hook runs `golangci-lint`. The same config (`.golangci.yml`: errcheck, govet, staticcheck, unused) runs in CI. To run lint manually: `golangci-lint run ./...`
-**Always run `gofmt -w ./...` after writing Go code.** Subagents and code generators often produce valid but unformatted Go. The pre-commit hook catches this for commits in the repo, but code written to external directories (e.g., `~/printing-press/library/`) must be formatted explicitly.
+**Always run `go fmt ./...` after writing Go code.** Use `go fmt`, not raw `gofmt` — `gofmt` doesn't accept Go package patterns, and `gofmt -w .` would walk into `testdata/golden/expected/` and rewrite frozen golden fixtures. `go fmt ./...` skips `testdata` and `vendor` by convention. Subagents and code generators often produce valid but unformatted Go. The pre-commit hook catches this for commits in the repo, but code written to external directories (e.g., `~/printing-press/library/`) must be formatted explicitly.
**IMPORTANT: Always use relative paths for build output.** Never build to `/tmp` or any shared absolute path. Multiple worktrees run concurrently and will stomp on each other. Use `./printing-press` exactly as shown above.
diff --git a/README.md b/README.md
index d9dda42a..16431c82 100644
--- a/README.md
+++ b/README.md
@@ -450,7 +450,7 @@ Safety: GET only, --limit 1, 10s timeout, stops on 401. Never creates, posts, or
```bash
go build -o ./printing-press ./cmd/printing-press
go test ./...
-gofmt -w ./...
+go fmt ./...
golangci-lint run ./...
```
← f9c9efd4 test(cli): speed up generator test suite (#323)
·
back to Cli Printing Press
·
refactor(cli): simplify generate orchestration (#325) 545ffb94 →