Skip to content

fix: emit lint diff in conventional got→want direction#230

Open
cyphermox wants to merge 1 commit into
chainguard-dev:mainfrom
cyphermox:fix/diff-direction-convention
Open

fix: emit lint diff in conventional got→want direction#230
cyphermox wants to merge 1 commit into
chainguard-dev:mainfrom
cyphermox:fix/diff-direction-convention

Conversation

@cyphermox

Copy link
Copy Markdown

ExecDiff ran diff want got with labels --- want / +++ got, so the printed diff described how to turn the correctly-formatted file into the current (unformatted) one. That is the inverse of the convention used by gofmt -d, prettier and black --diff, where the diff goes from the current file to the expected output and can be applied directly as a patch to fix formatting.

Swap the operands and labels so the output is --- got / +++ want: removed lines are the current contents, added lines are the fix.

No behavioral change to formatting or lint pass/fail; only the direction and labels of the informational diff. lint_test.go asserts on the returned error only, so existing tests are unaffected.

ExecDiff ran `diff want got` with labels `--- want` / `+++ got`, so the
printed diff described how to turn the correctly-formatted file into the
current (unformatted) one. That is the inverse of the convention used by
`gofmt -d`, `prettier` and `black --diff`, where the diff goes from the
current file to the expected output and can be applied directly as a
patch to fix formatting.

Swap the operands and labels so the output is `--- got` / `+++ want`:
removed lines are the current contents, added lines are the fix.

No behavioral change to formatting or lint pass/fail; only the direction
and labels of the informational diff. lint_test.go asserts on the
returned error only, so existing tests are unaffected.

Co-Authored-By: Claude Opus 4.8 <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