mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00:00
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:
parent
df88baef07
commit
72dbd24b22
1 changed files with 0 additions and 18 deletions
18
lib/fs/fs.go
18
lib/fs/fs.go
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue