Skip to content

Commit

Permalink
fix: revert appendUniq due to performance hit
Browse files Browse the repository at this point in the history
  • Loading branch information
jdobes authored and psegedy committed Oct 1, 2024
1 parent b619b05 commit cda7483
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 19 deletions.
1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ go 1.21

require (
github.com/ezamriy/gorpm v0.0.0-20160905202458-25f7273cbf51
github.com/google/go-cmp v0.6.0
github.com/hashicorp/go-version v1.7.0
github.com/mattn/go-sqlite3 v1.14.22
github.com/pkg/errors v0.9.1
Expand Down
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/hashicorp/go-version v1.7.0 h1:5tqGy27NaOTB8yJKUZELlFAS/LTKJkrmONwQKeRZfjY=
github.com/hashicorp/go-version v1.7.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
github.com/mattn/go-sqlite3 v1.14.22 h1:2gZY6PC6kBnID23Tichd1K+Z0oS6nE/XwU+Vz/5o4kU=
Expand Down
17 changes: 1 addition & 16 deletions vmaas/vulnerabilities.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"sort"
"time"

"github.com/google/go-cmp/cmp"
"github.com/hashicorp/go-version"
"github.com/pkg/errors"
"github.com/redhatinsights/vmaas-lib/vmaas/utils"
Expand Down Expand Up @@ -438,21 +437,7 @@ func updateCves(cves map[string]VulnerabilityDetail, cve string, pkg Package, er
affectedPackage.ModuleStreamPtrs.Module = &module.Module
affectedPackage.ModuleStreamPtrs.Stream = &module.Stream
}
vulnDetail.Affected = appendUniq(vulnDetail.Affected, &affectedPackage)
vulnDetail.Affected = append(vulnDetail.Affected, affectedPackage)
}
cves[cve] = vulnDetail
}

func appendUniq(affected []AffectedPackage, item *AffectedPackage) []AffectedPackage {
if item == nil {
return affected
}

for _, a := range affected {
if cmp.Equal(a, *item) {
return affected
}
}
affected = append(affected, *item)
return affected
}

0 comments on commit cda7483

Please sign in to comment.