Skip to content

chore(repo): pin .go files to LF line endings via .gitattributes#250

Merged
CalvinAllen merged 1 commit intomainfrom
chore/repo/gitattributes-go-eol-lf
May 6, 2026
Merged

chore(repo): pin .go files to LF line endings via .gitattributes#250
CalvinAllen merged 1 commit intomainfrom
chore/repo/gitattributes-go-eol-lf

Conversation

@CalvinAllen
Copy link
Copy Markdown
Contributor

Summary

Add a .gitattributes file pinning *.go files to LF line endings.

Why

On Windows with the default core.autocrlf=true, Git checks out .go files with CRLF, but gofmt always writes LF. Result: every gofmt run (including ./rnr check) leaves .go files appearing "modified" in git status. Staging them re-normalizes to the LF stored in HEAD, so the diff disappears, but the next gofmt brings the churn right back.

Pinning *.go to eol=lf tells Git to keep the working copy as LF on every platform, matching gofmt's output. The cycle stops.

Notes

  • The Go files in this repo are already stored as LF in the object store (running git add --renormalize . was a no-op against .go), so this is purely a working-copy / checkout-time fix. No file content actually changes.
  • Scope kept minimal: only .go files. Other file types can be added in follow-ups if they cause similar issues.

Test plan

  • On a Windows checkout, run ./rnr check and confirm no .go files appear in git status afterwards.
  • On macOS/Linux: confirm git status still clean after running ./rnr check.

@CalvinAllen CalvinAllen merged commit a01abc6 into main May 6, 2026
2 checks passed
@CalvinAllen CalvinAllen deleted the chore/repo/gitattributes-go-eol-lf branch May 6, 2026 22:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant