1
0
mirror of https://github.com/tw93/Mole.git synced 2026-02-13 01:00:13 +00:00

Reconstruct the structure of go

This commit is contained in:
Tw93
2025-12-01 19:26:03 +08:00
parent 4bd4ffc7be
commit 36a84e5211
20 changed files with 1441 additions and 1273 deletions

View File

@@ -56,14 +56,19 @@ func deletePathWithProgress(root string, counter *int64) (int64, error) {
return nil
})
if err != nil {
return count, err
// Track walk error separately
if err != nil && firstErr == nil {
firstErr = err
}
if err := os.RemoveAll(root); err != nil {
return count, err
// Try to remove remaining directory structure
// Even if this fails, we still report files deleted
if removeErr := os.RemoveAll(root); removeErr != nil {
if firstErr == nil {
firstErr = removeErr
}
}
// Return the first error encountered during deletion if any
// Always return count (even if there were errors), along with first error
return count, firstErr
}