Find, verify, and analyze leaked credentials
Go credentialsdevsecopsdynamic-analysisprecommitscanningsecretsecret-managementsecretssecuritysecurity-toolstrufflehogverification
[chore] - Update Chunk struct comment (#2317)
ahravd3d551d24eb9
diff --git a/pkg/sources/sources.go b/pkg/sources/sources.goindex dca8ed939..c0cc03fbf 100644--- a/pkg/sources/sources.go+++ b/pkg/sources/sources.go@@ -17,6 +17,11 @@ type ()// Chunk contains data to be decoded and scanned along with context on where it came from.+//+// **Important:** The order of the fields in this struct is specifically designed to optimize+// struct alignment and minimize memory usage. Do not change the field order without carefully considering+// the potential impact on memory consumption.+// Ex: https://go.dev/play/p/Azf4a7O-DhCtype Chunk struct {// Data is the data to decode and scan.Data []bytediff --git a/pkg/sources/sources_test.go b/pkg/sources/sources_test.gonew file mode 100644index 000000000..49fd853fb--- /dev/null+++ b/pkg/sources/sources_test.go@@ -0,0 +1,14 @@+package sources++import (+ "testing"+ "unsafe"++ "github.com/stretchr/testify/assert"+)++// TestChunkSize ensures that the Chunk struct does not exceed 80 bytes.+func TestChunkSize(t *testing.T) {+ t.Parallel()+ assert.Equal(t, unsafe.Sizeof(Chunk{}), uintptr(80), "Chunk struct size exceeds 80 bytes")+}