refactor(config): keyword map (#1538)

This commit is contained in:
Richard Gomez authored and GitHub committed 2024-09-30 07:32:25 -05:00
1 parent a971a324fa
commit c5b15c9d74
5 files changed
+57 -42

No files matched your search

+2 -1
View File
@@ -17,6 +17,7 @@ import (
"github.com/rs/zerolog/log"
"github.com/spf13/viper"
"golang.org/x/exp/maps"
)
const (
@@ -108,7 +109,7 @@ func NewDetector(cfg config.Config) *Detector {
findingMutex: &sync.Mutex{},
findings: make([]report.Finding, 0),
Config: cfg,
prefilter: *ahocorasick.NewTrieBuilder().AddStrings(cfg.Keywords).Build(),
prefilter: *ahocorasick.NewTrieBuilder().AddStrings(maps.Keys(cfg.Keywords)).Build(),
Sema: semgroup.NewGroup(context.Background(), 40),
}
}