]> Cypherpunks.ru repositories - goredo.git/blobdiff - run.go
Warn simultaneous ifcreate/ifchange usage
[goredo.git] / run.go
diff --git a/run.go b/run.go
index a6401480d032f2b3c63536f9922084637942ac1f..0b77d499613f5549704b528fbfff49b440282ebd 100644 (file)
--- a/run.go
+++ b/run.go
@@ -731,6 +731,26 @@ func runScript(tgtOrig string, errs chan error, traced bool) error {
                                goto Finish
                        }
                }
+
+               // Post-commit .rec sanitizing
+               fdDep.Close()
+               if fdDepR, err := os.Open(fdDepPath); err == nil {
+                       depInfo, err := depRead(fdDepR)
+                       fdDepR.Close()
+                       if err != nil {
+                               goto Finish
+                       }
+                       ifchangeSeen := make(map[string]struct{}, len(depInfo.ifchanges))
+                       for _, dep := range depInfo.ifchanges {
+                               ifchangeSeen[dep["Target"]] = struct{}{}
+                       }
+                       for _, dep := range depInfo.ifcreates {
+                               if _, exists := ifchangeSeen[dep]; exists {
+                                       tracef(CWarn, "simultaneous ifcreate and ifchange records: %s", tgt)
+                               }
+                       }
+               }
+
        Finish:
                runErr.Err = err
                errs <- runErr