mirror of
https://github.com/gocsaf/csaf.git
synced 2025-12-22 05:40:11 +01:00
parent
be3dfcd542
commit
8032d47b50
8 changed files with 40 additions and 40 deletions
|
|
@ -90,18 +90,18 @@ func NewROLIECategoryDocument(categories ...string) *ROLIECategoryDocument {
|
|||
// Merge merges the given categories into the existing ones.
|
||||
// The results indicates if there were changes.
|
||||
func (rcd *ROLIECategoryDocument) Merge(categories ...string) bool {
|
||||
index := make(map[string]bool)
|
||||
index := util.Set[string]{}
|
||||
for i := range rcd.Categories.Category {
|
||||
index[rcd.Categories.Category[i].Term] = true
|
||||
index.Add(rcd.Categories.Category[i].Term)
|
||||
}
|
||||
|
||||
oldLen := len(index)
|
||||
|
||||
for _, cat := range categories {
|
||||
if index[cat] {
|
||||
if index.Contains(cat) {
|
||||
continue
|
||||
}
|
||||
index[cat] = true
|
||||
index.Add(cat)
|
||||
rcd.Categories.Category = append(
|
||||
rcd.Categories.Category, ROLIECategory{Term: cat})
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue