lib: replace Readdir(-1) with os.ReadDir (#8901)

This commit is contained in:
Eng Zer Jun
2023-05-11 15:35:52 +00:00
committed by GitHub
parent b2fb2ef276
commit 089320aadc
2 changed files with 8 additions and 15 deletions
+7 -8
View File
@@ -200,22 +200,21 @@ func dbIsLarge(location string) bool {
return false
}
dir, err := os.Open(location)
if err != nil {
return false
}
fis, err := dir.Readdir(-1)
entries, err := os.ReadDir(location)
if err != nil {
return false
}
var size int64
for _, fi := range fis {
if fi.Name() == "LOG" {
for _, entry := range entries {
if entry.Name() == "LOG" {
// don't count the size
continue
}
fi, err := entry.Info()
if err != nil {
continue
}
size += fi.Size()
}