mirror of
https://github.com/Luzifer/go-latestver.git
synced 2024-11-09 15:40:04 +00:00
Sort entries in catalog api
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
4b04b7db5a
commit
7838e8e037
1 changed files with 3 additions and 0 deletions
3
api.go
3
api.go
|
@ -6,6 +6,7 @@ import (
|
|||
"net/http"
|
||||
"net/url"
|
||||
"path"
|
||||
"sort"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
@ -157,6 +158,8 @@ func handleCatalogList(w http.ResponseWriter, r *http.Request) {
|
|||
out[i] = ae
|
||||
}
|
||||
|
||||
sort.Slice(out, func(i, j int) bool { return out[i].Key() < out[j].Key() })
|
||||
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
if err := json.NewEncoder(w).Encode(out); err != nil {
|
||||
log.WithError(err).Error("Unable to encode catalog entry list")
|
||||
|
|
Loading…
Reference in a new issue