go.mod,go.sum: update dependency on x/exp/slices
Update to latest of x/exp/slices so we can use new functions (such as
DeleteFunc) in later CLs.
Change-Id: I6239c1f51bd012647e5eef4f4a338ed44962112c
Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/529836
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
diff --git a/go.mod b/go.mod
index ae8f714..7f7c223 100644
--- a/go.mod
+++ b/go.mod
@@ -23,7 +23,7 @@
github.com/shurcooL/githubv4 v0.0.0-20220115235240-a14260e6f8a2
go.opentelemetry.io/otel v1.11.2
go.opentelemetry.io/otel/sdk v1.4.0
- golang.org/x/exp v0.0.0-20230522175609-2e198f4a06a1
+ golang.org/x/exp v0.0.0-20230905200255-921286631fa9
golang.org/x/exp/event v0.0.0-20220218215828-6cf2b201936e
golang.org/x/mod v0.12.0
golang.org/x/oauth2 v0.12.0
diff --git a/go.sum b/go.sum
index 8e0d440..0ab7ed5 100644
--- a/go.sum
+++ b/go.sum
@@ -376,8 +376,8 @@
golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM=
golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU=
-golang.org/x/exp v0.0.0-20230522175609-2e198f4a06a1 h1:k/i9J1pBpvlfR+9QsetwPyERsqu1GIbi967PQMq3Ivc=
-golang.org/x/exp v0.0.0-20230522175609-2e198f4a06a1/go.mod h1:V1LtkGg67GoY2N1AnLN78QLrzxkLyJw7RJb1gzOOz9w=
+golang.org/x/exp v0.0.0-20230905200255-921286631fa9 h1:GoHiUyI/Tp2nVkLI2mCxVkOjsbSXD66ic0XW0js0R9g=
+golang.org/x/exp v0.0.0-20230905200255-921286631fa9/go.mod h1:S2oDrQGGwySpoQPVqRShND87VCbxmc6bL1Yd2oYrm6k=
golang.org/x/exp/event v0.0.0-20220218215828-6cf2b201936e h1:K2AuHMC+jaRTzAcivRwKOzjTZ1925Yx4xHMg07YoBQc=
golang.org/x/exp/event v0.0.0-20220218215828-6cf2b201936e/go.mod h1:AVlZHjhWbW/3yOcmKMtJiObwBPJajBlUpQXRijFNrNc=
golang.org/x/exp/typeparams v0.0.0-20221208152030-732eee02a75a h1:Jw5wfR+h9mnIYH+OtGT2im5wV1YGGDora5vTv/aa5bE=
diff --git a/internal/database/database.go b/internal/database/database.go
index 05bf7f8..52c886b 100644
--- a/internal/database/database.go
+++ b/internal/database/database.go
@@ -56,12 +56,26 @@
func (m ModulesIndex) MarshalJSON() ([]byte, error) {
modules := maps.Values(m)
- slices.SortFunc(modules, func(m1, m2 *Module) bool {
- return m1.Path < m2.Path
+ slices.SortStableFunc(modules, func(m1, m2 *Module) int {
+ switch {
+ case m1.Path < m2.Path:
+ return -1
+ case m1.Path > m2.Path:
+ return 1
+ default:
+ return 0
+ }
})
for _, module := range modules {
- slices.SortFunc(module.Vulns, func(v1, v2 ModuleVuln) bool {
- return v1.ID < v2.ID
+ slices.SortStableFunc(module.Vulns, func(v1, v2 ModuleVuln) int {
+ switch {
+ case v1.ID < v2.ID:
+ return -1
+ case v1.ID > v2.ID:
+ return 1
+ default:
+ return 0
+ }
})
}
return json.Marshal(modules)
@@ -117,8 +131,15 @@
func (v VulnsIndex) MarshalJSON() ([]byte, error) {
vulns := maps.Values(v)
- slices.SortFunc(vulns, func(v1, v2 *Vuln) bool {
- return v1.ID < v2.ID
+ slices.SortStableFunc(vulns, func(v1, v2 *Vuln) int {
+ switch {
+ case v1.ID < v2.ID:
+ return -1
+ case v1.ID > v2.ID:
+ return 1
+ default:
+ return 0
+ }
})
return json.Marshal(vulns)
}