From 28efb746ef09573b62fcf6ed08d836af7dfa2f5d Mon Sep 17 00:00:00 2001 From: Ahrav Dutta Date: Fri, 19 Jan 2024 09:14:16 -0800 Subject: [PATCH] add compile time check --- pkg/sources/sources.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pkg/sources/sources.go b/pkg/sources/sources.go index c0cc03fbfa9c..b8dd1dc51075 100644 --- a/pkg/sources/sources.go +++ b/pkg/sources/sources.go @@ -2,6 +2,7 @@ package sources import ( "sync" + "unsafe" "google.golang.org/protobuf/types/known/anypb" @@ -11,6 +12,14 @@ import ( "github.com/trufflesecurity/trufflehog/v3/pkg/pb/sourcespb" ) +const ( + // Convert to int64 to handle potential negative size differences correctly. + sizeofChunk = int64(unsafe.Sizeof(Chunk{})) + maxChunkSize = 80 +) + +var _ = [1]bool{}[sizeofChunk-maxChunkSize] + type ( SourceID int64 JobID int64