backupExistingFile renames target to target.backup. .
(target string)
| 154 | |
| 155 | // backupExistingFile renames target to target.backup.<YYYYMMDD-HHMMSS>. |
| 156 | func backupExistingFile(target string) error { |
| 157 | ts := time.Now().Local().Format("20060102-150405") |
| 158 | backup := target + ".backup." + ts |
| 159 | return os.Rename(target, backup) |
| 160 | } |
| 161 | |
| 162 | // instructionForFile returns the instruction whose managed file equals path. |
| 163 | func (s *Store) instructionForFile(ctx context.Context, path string) (Instruction, bool) { |
no test coverage detected