Find, verify, and analyze leaked credentials
Go credentialsdevsecopsdynamic-analysisprecommitscanningsecretsecret-managementsecretssecuritysecurity-toolstrufflehogverification
test: fix compile errors (#2964)
Richard Gomez4addd81e29c1
diff --git a/pkg/detectors/gcpapplicationdefaultcredentials/gcpapplicationdefaultcredentials_test.go b/pkg/detectors/gcpapplicationdefaultcredentials/gcpapplicationdefaultcredentials_test.goindex 7bed123d1..c161e420a 100644--- a/pkg/detectors/gcpapplicationdefaultcredentials/gcpapplicationdefaultcredentials_test.go+++ b/pkg/detectors/gcpapplicationdefaultcredentials/gcpapplicationdefaultcredentials_test.go@@ -44,9 +44,8 @@ func TestGcpapplicationdefaultcredentials_Pattern(t *testing.T) {for _, test := range tests {t.Run(test.name, func(t *testing.T) {- chunkSpecificDetectors := make(map[ahocorasick.DetectorKey]detectors.Detector, 2)- ahoCorasickCore.FindDetectorMatches(test.input, chunkSpecificDetectors)- if len(chunkSpecificDetectors) == 0 {+ detectorMatches := ahoCorasickCore.FindDetectorMatches([]byte(test.input))+ if len(detectorMatches) == 0 {t.Errorf("keywords '%v' not matched by: %s", d.Keywords(), test.input)return}diff --git a/pkg/detectors/groq/groq_test.go b/pkg/detectors/groq/groq_test.goindex 5a836bb80..08d78e188 100644--- a/pkg/detectors/groq/groq_test.go+++ b/pkg/detectors/groq/groq_test.go@@ -35,9 +35,8 @@ func TestGroq_Pattern(t *testing.T) {for _, test := range tests {t.Run(test.name, func(t *testing.T) {- chunkSpecificDetectors := make(map[ahocorasick.DetectorKey]detectors.Detector, 2)- ahoCorasickCore.PopulateMatchingDetectors(test.input, chunkSpecificDetectors)- if len(chunkSpecificDetectors) == 0 {+ detectorMatches := ahoCorasickCore.FindDetectorMatches([]byte(test.input))+ if len(detectorMatches) == 0 {t.Errorf("keywords '%v' not matched by: %s", d.Keywords(), test.input)return}diff --git a/pkg/detectors/intra42/intra42_test.go b/pkg/detectors/intra42/intra42_test.goindex b89950ee5..bbbe6ae44 100644--- a/pkg/detectors/intra42/intra42_test.go+++ b/pkg/detectors/intra42/intra42_test.go@@ -11,6 +11,7 @@ import ("github.com/google/go-cmp/cmp""github.com/google/go-cmp/cmp/cmpopts"+"github.com/trufflesecurity/trufflehog/v3/pkg/common""github.com/trufflesecurity/trufflehog/v3/pkg/detectors""github.com/trufflesecurity/trufflehog/v3/pkg/engine/ahocorasick"@@ -39,9 +40,8 @@ intra_client_secret = 's-s4t2ud-d91c558a2ba6b47f60f690efc20a33d28c252d5bed840034for _, test := range tests {t.Run(test.name, func(t *testing.T) {- chunkSpecificDetectors := make(map[ahocorasick.DetectorKey]detectors.Detector, 2)- ahoCorasickCore.PopulateMatchingDetectors(test.input, chunkSpecificDetectors)- if len(chunkSpecificDetectors) == 0 {+ detectorMatches := ahoCorasickCore.FindDetectorMatches([]byte(test.input))+ if len(detectorMatches) == 0 {t.Errorf("keywords '%v' not matched by: %s", d.Keywords(), test.input)return}diff --git a/pkg/detectors/openai/openai_test.go b/pkg/detectors/openai/openai_test.goindex 6035aa206..db2853377 100644--- a/pkg/detectors/openai/openai_test.go+++ b/pkg/detectors/openai/openai_test.go@@ -45,9 +45,8 @@ func TestOpenAI_Pattern(t *testing.T) {for _, test := range tests {t.Run(test.name, func(t *testing.T) {- chunkSpecificDetectors := make(map[ahocorasick.DetectorKey]detectors.Detector, 2)- ahoCorasickCore.PopulateMatchingDetectors(test.input, chunkSpecificDetectors)- if len(chunkSpecificDetectors) == 0 {+ detectorMatches := ahoCorasickCore.FindDetectorMatches([]byte(test.input))+ if len(detectorMatches) == 0 {t.Errorf("keywords '%v' not matched by: %s", d.Keywords(), test.input)return}diff --git a/pkg/detectors/snykkey/snykkey_test.go b/pkg/detectors/snykkey/snykkey_test.goindex 296d2e601..f239810ee 100644--- a/pkg/detectors/snykkey/snykkey_test.go+++ b/pkg/detectors/snykkey/snykkey_test.go@@ -48,9 +48,8 @@ set PATH=%PATH%;C:\Program Files\nodejs\;C:\Program Files\Git\cmd`,for _, test := range tests {t.Run(test.name, func(t *testing.T) {- chunkSpecificDetectors := make(map[ahocorasick.DetectorKey]detectors.Detector, 2)- ahoCorasickCore.FindDetectorMatches(test.input, chunkSpecificDetectors)- if len(chunkSpecificDetectors) == 0 {+ matches := ahoCorasickCore.FindDetectorMatches([]byte(test.input))+ if len(matches) == 0 {t.Errorf("keywords '%v' not matched by: %s", d.Keywords(), test.input)return}diff --git a/pkg/sources/github/github_integration_test.go b/pkg/sources/github/github_integration_test.goindex 2b0cddb98..3ece02a16 100644--- a/pkg/sources/github/github_integration_test.go+++ b/pkg/sources/github/github_integration_test.go@@ -59,7 +59,7 @@ func TestSource_Token(t *testing.T) {memberCache: map[string]struct{}{},repoInfoCache: newRepoInfoCache(),}- s.filteredRepoCache = s.newFilteredRepoCache(memory.New(), nil, nil)+ s.filteredRepoCache = s.newFilteredRepoCache(memory.New[string](), nil, nil)installationClient, err := s.enumerateWithApp(ctx, "https://api.github.com", conn.GetGithubApp())assert.NoError(t, err)