Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"go fmt" converts line endings on Windows #17167

Closed
mikeharder opened this issue Feb 24, 2022 · 1 comment
Closed

"go fmt" converts line endings on Windows #17167

mikeharder opened this issue Feb 24, 2022 · 1 comment
Assignees
Labels
Central-EngSys This issue is owned by the Engineering System team.

Comments

@mikeharder
Copy link
Member

The .gitattributes in this repo is currently configured for auto, which means files are checked out with CRLF on Windows:

# Set the default behavior, in case people don't have core.autocrlf set.
* text=auto

This doesn't play well with go fmt, which always converts files to LF (golang/go#16355). If you run go fmt on unchanged source files, it creates a diff in line endings:

sdk\internal\perf\testdata\perf> go fmt .
main.go
no_op_perf.go
sleep_perf.go

sdk\internal\perf\testdata\perf> git diff
warning: LF will be replaced by CRLF in sdk/internal/perf/testdata/perf/main.go.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in sdk/internal/perf/testdata/perf/no_op_perf.go.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in sdk/internal/perf/testdata/perf/sleep_perf.go.
The file will have its original line endings in your working directory 

Perhaps this repo should be configured to always checkout files with LF, even on Windows, for better compat with go fmt?

@RickWinter RickWinter added the Central-EngSys This issue is owned by the Engineering System team. label Feb 25, 2022
Copy link

Hi @mikeharder, we deeply appreciate your input into this project. Regrettably, this issue has remained inactive for over 2 years, leading us to the decision to close it. We've implemented this policy to maintain the relevance of our issue queue and facilitate easier navigation for new contributors. If you still believe this topic requires attention, please feel free to create a new issue, referencing this one. Thank you for your understanding and ongoing support.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Mar 13, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Mar 13, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Central-EngSys This issue is owned by the Engineering System team.
Projects
Archived in project
Development

No branches or pull requests

3 participants