]> Cypherpunks.ru repositories - goredo.git/blobdiff - cleanup.go
Do not remove .lock
[goredo.git] / cleanup.go
index d25aa3de02e91b31aabf7b758564f3de739eb244..09a72203ad2be8bcb29162128fcfe8fc9be78dc3 100644 (file)
@@ -32,6 +32,7 @@ const (
        CleanupFull = "full"
        CleanupLog  = "log"
        CleanupTmp  = "tmp"
+       CleanupLock = "lock"
 )
 
 var DryRun *bool
@@ -75,6 +76,15 @@ func redoDirClean(root, what string) error {
                                                }
                                        }
                                }
+                       case CleanupLock:
+                               if strings.HasSuffix(fi.Name(), LockSuffix) {
+                                       fmt.Println(pth)
+                                       if !*DryRun {
+                                               if err = os.Remove(pth); err != nil {
+                                                       return err
+                                               }
+                                       }
+                               }
                        case CleanupTmp:
                                if strings.HasPrefix(fi.Name(), TmpPrefix) {
                                        fmt.Println(pth)