fix: unaligned 64-bit atomic operation panic (#1696)

This commit is contained in:
Richard Gomez authored and GitHub committed 2025-01-15 06:45:37 -06:00
1 parent a211b1601f
commit 977236cb5f
2 files changed
+4 -5

No files matched your search

+1 -2
View File
@@ -6,7 +6,6 @@ import (
"os"
"path/filepath"
"strings"
"sync/atomic"
"time"
"github.com/rs/zerolog"
@@ -362,7 +361,7 @@ func bytesConvert(bytes uint64) string {
}
func findingSummaryAndExit(detector *detect.Detector, findings []report.Finding, exitCode int, start time.Time, err error) {
totalBytes := atomic.LoadUint64(&detector.TotalBytes)
totalBytes := detector.TotalBytes.Load()
bytesMsg := fmt.Sprintf("scanned ~%d bytes (%s)", totalBytes, bytesConvert(totalBytes))
if err == nil {
logging.Info().Msgf("%s in %s", bytesMsg, FormatDuration(time.Since(start)))