(path string)
| 509 | } |
| 510 | |
| 511 | func checkIfCleanupIsNeeded(path string) (cleanup bool, cleanParent bool, err error) { |
| 512 | fi, err := osfs.Default.Stat(path) |
| 513 | if err != nil { |
| 514 | if os.IsNotExist(err) { |
| 515 | return true, true, nil |
| 516 | } |
| 517 | |
| 518 | return false, false, err |
| 519 | } |
| 520 | |
| 521 | if !fi.IsDir() { |
| 522 | return false, false, fmt.Errorf("path is not a directory: %s", path) |
| 523 | } |
| 524 | |
| 525 | files, err := osfs.Default.ReadDir(path) |
| 526 | if err != nil { |
| 527 | return false, false, err |
| 528 | } |
| 529 | |
| 530 | if len(files) == 0 { |
| 531 | return true, false, nil |
| 532 | } |
| 533 | |
| 534 | return false, false, nil |
| 535 | } |
| 536 | |
| 537 | func cleanUpDir(path string, all bool) error { |
| 538 | if all { |
no test coverage detected
searching dependent graphs…