Skip to content

style: gofmt six drifted files - #329

Merged
shadowbrush merged 1 commit into
mainfrom
claude/gofmt-drift
Jul 31, 2026
Merged

style: gofmt six drifted files#329
shadowbrush merged 1 commit into
mainfrom
claude/gofmt-drift

Conversation

@shadowbrush

Copy link
Copy Markdown
Member

gofmt -l . flagged six files on main. Running gofmt -w over them; whitespace only.

Follow-up to #328, where a blanket gofmt -w internal/cmd/ incidentally touched four of these. I reverted them there to keep that PR to one change — this is the separate cleanup, and it turned out to be six files rather than four (my earlier scan only covered internal/cmd).

What changed

File Change
internal/cmd/memory/member.go cobra field block re-aligned after a longer Use: string
internal/cmd/node_import_content_cmd_test.go struct-tag alignment
internal/cmdutil/memref_test.go trailing-comment alignment in a map literal
internal/nodedoc/markdown_test.go trailing-comment alignment in a slice literal
internal/cmd/access_cmd_test.go doubled blank line → single
internal/cmd/node/export.go trailing blank line at EOF

Verification

Each file is byte-identical to its previous version once all whitespace is stripped:

IDENTICAL ignoring all whitespace: internal/cmd/access_cmd_test.go
IDENTICAL ignoring all whitespace: internal/cmd/memory/member.go
IDENTICAL ignoring all whitespace: internal/cmd/node/export.go
IDENTICAL ignoring all whitespace: internal/cmd/node_import_content_cmd_test.go
IDENTICAL ignoring all whitespace: internal/cmdutil/memref_test.go
IDENTICAL ignoring all whitespace: internal/nodedoc/markdown_test.go

gofmt -l . is now empty. go test ./... — 16 packages green. make lint — 0 issues.

Why it drifted

Nothing enforces gofmt in this repo: .golangci.yml is golangci-lint v2 with linters.default: standard and no formatters section, and no workflow shells out to gofmt. So formatting drift is invisible to CI and accumulates.

Adding a gate — a formatters: enable: [gofmt] block in .golangci.yml, or a gofmt -l step in the lint workflow — would stop it recurring. I've left that out of this PR since it changes CI behaviour; happy to open it separately if you want it.

🤖 Generated with Claude Code

`gofmt -l .` flagged six files: struct-tag and trailing-comment alignment, a
cobra field block, one doubled blank line, and one trailing blank line at EOF.

Whitespace only — each file is byte-identical to its previous version once all
whitespace is stripped.

Nothing enforces this today: the golangci-lint v2 config has no `formatters`
section and no workflow runs gofmt, so the drift accumulated silently. Adding a
gate is left as a separate call.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR applies gofmt to six previously drifted Go files, bringing formatting back in sync with standard Go tooling without changing behavior or semantics.

Changes:

  • Reformatted composite literals and struct tag alignment in several tests to match gofmt output.
  • Normalized spacing/alignment in a Cobra command definition block.
  • Removed extraneous blank lines (including an EOF trailing blank line).

Reviewed changes

Copilot reviewed 2 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
internal/cmd/memory/member.go gofmt alignment updates in a cobra.Command literal.
internal/cmd/node_import_content_cmd_test.go gofmt alignment for struct field + tag formatting in test helper types.
internal/cmdutil/memref_test.go gofmt alignment in a map literal’s trailing comments.
internal/nodedoc/markdown_test.go gofmt alignment in a slice literal’s trailing comments.
internal/cmd/access_cmd_test.go Removes an extra blank line between tests/comments.
internal/cmd/node/export.go Removes trailing blank line at EOF.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@shadowbrush

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 👍

Reviewed commit: 7976d3a2c5

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@shadowbrush
shadowbrush merged commit a0a588e into main Jul 31, 2026
5 checks passed
@shadowbrush
shadowbrush deleted the claude/gofmt-drift branch July 31, 2026 11:31
shadowbrush added a commit that referenced this pull request Jul 31, 2026
Nothing enforced formatting before this: .golangci.yml had no `formatters`
section and no workflow ran gofmt, so six files drifted unnoticed until #329.
This closes the loop so it can't recur silently.

Enabling the gofmt formatter means `golangci-lint run` reports a formatting diff
as an issue and exits non-zero — which gates both `make lint` locally and the CI
lint job (golangci-lint-action runs `run` by default), so no workflow change is
needed.

Generated code is excluded via `exclusions.generated: strict`: genqlient's
output carries the standard "Code generated by … DO NOT EDIT." header, and a
formatting complaint there isn't hand-fixable since `make generate` rewrites the
file. Verified — drift injected into internal/api/gen/generated.go is seen by
`gofmt -l` but correctly ignored by the linter.

`make fmt` (golangci-lint fmt) applies the fixes, so a failing gate has an
obvious remedy. Verified end to end: clean tree passes; injected drift fails
`make lint`; `make fmt` repairs it byte-for-byte; `make lint` passes again.

Co-authored-by: Holger Selover-Stephan <holger@baragaun.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants