mirror of
https://git.sr.ht/~ashkeel/strimertul
synced 2024-09-30 02:40:33 +00:00
19 lines
318 B
Go
19 lines
318 B
Go
package utils
|
|
|
|
import "os"
|
|
|
|
type ByDate []os.DirEntry
|
|
|
|
func (f ByDate) Len() int {
|
|
return len(f)
|
|
}
|
|
|
|
func (f ByDate) Swap(i, j int) {
|
|
f[i], f[j] = f[j], f[i]
|
|
}
|
|
|
|
func (f ByDate) Less(i, j int) bool {
|
|
firstInfo, _ := f[i].Info()
|
|
secondInfo, _ := f[j].Info()
|
|
return firstInfo.ModTime().Before(secondInfo.ModTime())
|
|
}
|