Sort stash by modified time

This commit is contained in:
Alex Myasoedov 2018-02-23 21:28:31 -05:00
parent 9509610841
commit 45d74b4d9b
No known key found for this signature in database
GPG key ID: D261413C245982F0

View file

@ -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() {