summaryrefslogtreecommitdiff
path: root/pkg
diff options
context:
space:
mode:
Diffstat (limited to 'pkg')
-rw-r--r--pkg/app/handler/cvetool/index.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/pkg/app/handler/cvetool/index.go b/pkg/app/handler/cvetool/index.go
index 76da7b3..3ab9a36 100644
--- a/pkg/app/handler/cvetool/index.go
+++ b/pkg/app/handler/cvetool/index.go
@@ -14,6 +14,7 @@ import (
"glsamaker/pkg/models/users"
"html"
"net/http"
+ "sort"
"strconv"
"strings"
)
@@ -139,6 +140,10 @@ func CveData(w http.ResponseWriter, r *http.Request) {
}
}
+ // sort the comments by creation date
+ sort.Slice(cve.Comments, func(p, q int) bool {
+ return cve.Comments[p].Date.Before(cve.Comments[q].Date) })
+
comments, _ := json.Marshal(cve.Comments)
packages, _ := json.Marshal(cve.Packages)