Merge pull request #458 from switchupcb/patch-1

remove redundant call in filesys RemoveDir
This commit is contained in:
go-jet 2025-03-16 18:50:17 +01:00 committed by GitHub
commit 06530363f5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 5 additions and 35 deletions

View file

@ -56,34 +56,3 @@ func EnsureDirPathExist(dirPath string) error {
return nil
}
// RemoveDir deletes everything at folder dir.
func RemoveDir(dir string) error {
exist, err := DirExists(dir)
if err != nil {
return err
}
if exist {
err := os.RemoveAll(dir)
if err != nil {
return err
}
}
return nil
}
// DirExists checks if folder at path exist.
func DirExists(path string) (bool, error) {
_, err := os.Stat(path)
if err == nil {
return true, nil
}
if os.IsNotExist(err) {
return false, nil
}
return true, err
}