1
0
Fork 0

Before allocation of these three vars try to read a dir first.

This commit is contained in:
Alexander Andreev 2023-09-20 04:55:38 +04:00
parent d6463e81e8
commit cbe0292e4c
Signed by: Arav
GPG Key ID: D22A817D95815393
1 changed files with 4 additions and 4 deletions

View File

@ -23,15 +23,15 @@ type DirEntry struct {
}
func ScanDirectory(path, urlBase string) (entries []DirEntry, stats DirStat, err error) {
var dirEntries []DirEntry = make([]DirEntry, 0)
var fileEntries []DirEntry = make([]DirEntry, 0)
var totalFilesSize int64 = 0
dir, err := os.ReadDir(path)
if err != nil {
return
}
var dirEntries []DirEntry = make([]DirEntry, 0)
var fileEntries []DirEntry = make([]DirEntry, 0)
var totalFilesSize int64 = 0
for _, ent := range dir {
entry, _ := ent.Info()