Files in checkout have EOL changed from LF to CRLF


#1

The checkout is changing line endings of files. This can lead to automated checks such as go fmt failing. In my case I have testdata where the byte offset of tokens is important, leading to my tests failing.

I use the following step to adjust files back to LF

- find . -name '*.go' -type f -print0 | xargs -0 sed -i ':a;N;$!ba;s/\r//g'

I tried to unset the “text” gitattribute, which according to gits documentation should prevent automatic line ending changes. However, the issue still persisted. For reference I have the following for my .gitattributes:

# We have tests which parse files and fail if file offsets change. So disable
# EOL conversions.
**/testdata/* -text

The PR which enabled windows support is https://github.com/sourcegraph/go-langserver/pull/329
I originally mentioned this issue in another discussion Go can't find GCC with go1.11.1 on Windows


Go can't find GCC with go1.11.1 on Windows
#2

You might be able to do it with gitattributes, but a bit different syntax. For example:
* text=auto
*.js text eol=lf
*.sass text eol=lf
*.json text eol=lf
*.css text eol=lf
*.html text eol=lf
*.htm text eol=lf