lib/fs: remove unused IsEmptyDir()

This function became unused after the commit 43b24164ef

The unused function has been found with deadode tool - https://go.dev/blog/deadcode
This commit is contained in:
Aliaksandr Valialkin 2023-12-14 19:38:21 +02:00
parent df88baef07
commit 72dbd24b22
No known key found for this signature in database
GPG key ID: 52C003EE2BCDB9EB

View file

@ -190,24 +190,6 @@ func mustSyncParentDirIfExists(path string) {
MustSyncPath(parentDirPath)
}
// IsEmptyDir returns true if path points to empty directory.
func IsEmptyDir(path string) bool {
// See https://stackoverflow.com/a/30708914/274937
f, err := os.Open(path)
if err != nil {
logger.Panicf("FATAL: cannot open dir: %s", err)
}
_, err = f.Readdirnames(1)
MustClose(f)
if err != nil {
if err == io.EOF {
return true
}
logger.Panicf("FATAL: unexpected error when reading directory %q: %s", path, err)
}
return false
}
// MustRemoveDirAtomic removes the given dir atomically.
//
// It uses the following algorithm: