From 5a9aa93c5ebcd1ccd5f74dc444384af378a94446 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emil=20W=C3=A5reus?= Date: Mon, 9 Oct 2023 16:04:12 +0200 Subject: [PATCH] remove normalization and checkout unix style --- .github/workflows/test.yml | 5 +++++ internal/file/fingerprint.go | 11 ++--------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7fb5b8ed..78ccde68 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -14,6 +14,11 @@ jobs: os: [ 'ubuntu-latest', 'windows-latest', 'macos-latest' ] runs-on: ${{ matrix.os }} steps: + - name: Set git to use LF + run: | + git config --global core.autocrlf input + git config --global core.eol lf + - uses: actions/checkout@v3 - name: Set up Go diff --git a/internal/file/fingerprint.go b/internal/file/fingerprint.go index d76639c1..feb3141f 100644 --- a/internal/file/fingerprint.go +++ b/internal/file/fingerprint.go @@ -148,26 +148,19 @@ func shouldProcessFile(fileInfo os.FileInfo, exclusions []string, path string) b return true } -func normalizeLineEndings(data []byte) []byte { - // Convert to Unix line endings - return []byte(strings.ReplaceAll(string(data), "\r\n", "\n")) -} - func computeMD5(filename string) (FileFingerprint, error) { data, err := os.ReadFile(filename) if err != nil { return FileFingerprint{}, err } - normalizedData := normalizeLineEndings(data) - hash := md5.New() // #nosec - if _, err := hash.Write(normalizedData); err != nil { + if _, err := hash.Write(data); err != nil { return FileFingerprint{}, err } - contentLength := int64(len(normalizedData)) + contentLength := int64(len(data)) if err != nil { return FileFingerprint{}, err