This commit is contained in:
edoardottt
2021-11-28 12:48:07 +01:00
parent a3ffa5b005
commit 97088a89a0
2 changed files with 15 additions and 1 deletions
+14
View File
@@ -28,6 +28,7 @@ type Error struct {
type ErrorMatched struct {
Error Error
Url string
Match string
}
//GetErrorRegexes returns all the error regexes
@@ -48,3 +49,16 @@ func GetErrorRegexes() []Error {
}
return regexes
}
//RemoveDuplicateErrors removes duplicates from secrets found
func RemoveDuplicateErrors(input []ErrorMatched) []ErrorMatched {
keys := make(map[string]bool)
list := []ErrorMatched{}
for _, entry := range input {
if _, value := keys[entry.Match+entry.Url]; !value {
keys[entry.Url] = true
list = append(list, entry)
}
}
return list
}
+1 -1
View File
@@ -333,7 +333,7 @@ func RemoveDuplicateSecrets(input []SecretMatched) []SecretMatched {
keys := make(map[string]bool)
list := []SecretMatched{}
for _, entry := range input {
if _, value := keys[entry.Url]; !value {
if _, value := keys[entry.Match+entry.Url]; !value {
keys[entry.Url] = true
list = append(list, entry)
}