fix(contrib/trivy): fix convert for src package (#1842)

This commit is contained in:
MaineK00n
2024-02-02 15:35:05 +09:00
committed by GitHub
parent 76267a54fc
commit 7e91f5ef7e
3 changed files with 339 additions and 19 deletions

View File

@@ -6,6 +6,7 @@ import (
"regexp"
"strings"
"golang.org/x/exp/slices"
"golang.org/x/xerrors"
)
@@ -234,15 +235,10 @@ type SrcPackage struct {
// AddBinaryName add the name if not exists
func (s *SrcPackage) AddBinaryName(name string) {
found := false
for _, n := range s.BinaryNames {
if n == name {
return
}
}
if !found {
s.BinaryNames = append(s.BinaryNames, name)
if slices.Contains(s.BinaryNames, name) {
return
}
s.BinaryNames = append(s.BinaryNames, name)
}
// SrcPackages is Map of SrcPackage