Merge pull request #36 from msoedov/sort_stash
Sort stash by file modified time
Šī revīzija ir iekļauta:
revīzija
df65ad18c1
1 mainīti faili ar 6 papildinājumiem un 0 dzēšanām
6
main.go
6
main.go
|
@ -5,6 +5,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
log "github.com/Sirupsen/logrus"
|
log "github.com/Sirupsen/logrus"
|
||||||
|
@ -125,6 +126,11 @@ func NewApp() *gin.Engine {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sort.Slice(files, func(i, j int) bool {
|
||||||
|
return files[i].ModTime().Unix() > files[j].ModTime().Unix()
|
||||||
|
})
|
||||||
|
|
||||||
var stash []string
|
var stash []string
|
||||||
for _, file := range files {
|
for _, file := range files {
|
||||||
if file.IsDir() {
|
if file.IsDir() {
|
||||||
|
|
Notiek ielāde…
Atsaukties uz šo jaunā problēmā