mirror of
https://github.com/owncast/owncast.git
synced 2024-11-25 06:12:23 +03:00
Handle filepath.Walk errors (#351)
This commit is contained in:
parent
00129c5942
commit
2c504eb8be
1 changed files with 6 additions and 2 deletions
|
@ -46,9 +46,8 @@ func getAllFilesRecursive(baseDirectory string) (map[string][]os.FileInfo, error
|
||||||
var files = make(map[string][]os.FileInfo)
|
var files = make(map[string][]os.FileInfo)
|
||||||
|
|
||||||
var directory string
|
var directory string
|
||||||
filepath.Walk(baseDirectory, func(path string, info os.FileInfo, err error) error {
|
err := filepath.Walk(baseDirectory, func(path string, info os.FileInfo, err error) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf(err.Error())
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,6 +62,11 @@ func getAllFilesRecursive(baseDirectory string) (map[string][]os.FileInfo, error
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
log.Fatalf(err.Error())
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
// Sort by date so we can delete old files
|
// Sort by date so we can delete old files
|
||||||
for directory := range files {
|
for directory := range files {
|
||||||
sort.Slice(files[directory], func(i, j int) bool {
|
sort.Slice(files[directory], func(i, j int) bool {
|
||||||
|
|
Loading…
Reference in a new issue