Skip to content

Commit

Permalink
Restore modified time after rewrite
Browse files Browse the repository at this point in the history
  • Loading branch information
lflare committed Jan 9, 2022
1 parent b965336 commit 33fe7c7
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,11 @@ func Rewrite(path string, info os.FileInfo, err error) error {
}
}

// Set modified time back
if err := os.Chtimes(path, info.ModTime(), info.ModTime()); err != nil {
log.Errorf("Failed to set modified time for file '%s'", path)
}

// Log
log.Infof("Rewritten file '%s'", path)

Expand Down

0 comments on commit 33fe7c7

Please sign in to comment.