1
0
mirror of https://github.com/go-task/task.git synced 2025-03-17 21:08:01 +02:00

checksum: also sum the name of the files, so it changes after renaming

This commit is contained in:
Andrey Nering 2017-11-02 10:31:34 -02:00
parent baac067a1a
commit 2022551b26

View File

@ -58,7 +58,11 @@ func (c *Checksum) checksum(files ...string) (string, error) {
if info.IsDir() {
continue
}
if _, err := io.Copy(h, f); err != nil {
// also sum the filename, so checksum changes for renaming a file
if _, err = io.Copy(h, strings.NewReader(info.Name())); err != nil {
return "", err
}
if _, err = io.Copy(h, f); err != nil {
return "", err
}
}