From 45d74b4d9b40de7293971aa1742bc6f55b8b35a1 Mon Sep 17 00:00:00 2001 From: Alex Myasoedov Date: Fri, 23 Feb 2018 21:28:31 -0500 Subject: [PATCH] Sort stash by modified time --- main.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/main.go b/main.go index 96d13e9..b35c521 100644 --- a/main.go +++ b/main.go @@ -5,6 +5,7 @@ import ( "fmt" "io/ioutil" "os" + "sort" "strings" log "github.com/Sirupsen/logrus" @@ -125,6 +126,11 @@ func NewApp() *gin.Engine { if err != nil { log.Fatal(err) } + + sort.Slice(files, func(i, j int) bool { + return files[i].ModTime().Unix() > files[j].ModTime().Unix() + }) + var stash []string for _, file := range files { if file.IsDir() {