Skip to content
This repository has been archived by the owner on Sep 23, 2021. It is now read-only.

Commit

Permalink
Merge pull request #36 from msoedov/sort_stash
Browse files Browse the repository at this point in the history
Sort stash by file modified time
  • Loading branch information
msoedov committed Feb 24, 2018
2 parents 9509610 + 45d74b4 commit df65ad1
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"fmt"
"io/ioutil"
"os"
"sort"
"strings"

log "github.com/Sirupsen/logrus"
Expand Down Expand Up @@ -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() {
Expand Down

0 comments on commit df65ad1

Please sign in to comment.