From 0d7a0823028725711b197fc4a9cf0bb6d6a6c664 Mon Sep 17 00:00:00 2001 From: Alexander Sharov Date: Sun, 28 Apr 2024 18:00:30 +0300 Subject: [PATCH] fix: linter errors Signed-off-by: Alexander Sharov --- pkg/check/binary/check.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/check/binary/check.go b/pkg/check/binary/check.go index 1bbf478f..a5acf3ec 100644 --- a/pkg/check/binary/check.go +++ b/pkg/check/binary/check.go @@ -31,20 +31,20 @@ func Check(filename string) (bool, error) { const maxBytes = 8000 // Read up to 8000 bytes for analysis bytes := make([]byte, maxBytes) - n, err := file.Read(bytes) + numberOfBytes, err := file.Read(bytes) if err != nil { return false, err } // Check for the presence of a null byte within the read bytes - for i := 0; i < n; i++ { + for i := 0; i < numberOfBytes; i++ { if bytes[i] == 0 { return true, nil // Null byte found, file is binary } } // If no null byte found, check for a UTF-8 encoding signature (BOM) - if n >= 3 && bytes[0] == 0xEF && bytes[1] == 0xBB && bytes[2] == 0xBF { + if numberOfBytes >= 3 && bytes[0] == 0xEF && bytes[1] == 0xBB && bytes[2] == 0xBF { return false, nil // UTF-8 encoded text file }