updated todo because i oofed

This commit is contained in:
Bel LaPointe
2021-12-31 22:37:47 -05:00
parent 3ed7d8cd9e
commit 967a02c90a
3 changed files with 23 additions and 12 deletions

View File

@@ -92,7 +92,10 @@ func edit(dry bool, filepath string) error {
return nil
}
verify := func() error {
return dump(true, io.Discard, tempFile)
if err := dump(true, io.Discard, tempFile); err != nil {
return fmt.Errorf("failed to verify %s: %v", tempFile, err)
}
return nil
}
save := func() error {
if dry {
@@ -104,12 +107,12 @@ func edit(dry bool, filepath string) error {
for _, foo := range []func() error{cp, vi, verify, save} {
if err := foo(); err != nil {
if tempFile != "" && !dry {
os.Remove(tempFile)
}
return err
}
}
if !dry {
os.Remove(tempFile)
}
return nil
}