mirror of
https://github.com/go-task/task.git
synced 2025-11-06 09:09:13 +02:00
Don't persist new checksum on the disk if dry mode is enabled
Fixes #166
This commit is contained in:
@@ -17,6 +17,7 @@ type Checksum struct {
|
||||
Dir string
|
||||
Task string
|
||||
Sources []string
|
||||
Dry bool
|
||||
}
|
||||
|
||||
// IsUpToDate implements the Checker interface
|
||||
@@ -36,9 +37,11 @@ func (c *Checksum) IsUpToDate() (bool, error) {
|
||||
return false, nil
|
||||
}
|
||||
|
||||
_ = os.MkdirAll(filepath.Join(c.Dir, ".task", "checksum"), 0755)
|
||||
if err = ioutil.WriteFile(checksumFile, []byte(newMd5+"\n"), 0644); err != nil {
|
||||
return false, err
|
||||
if !c.Dry {
|
||||
_ = os.MkdirAll(filepath.Join(c.Dir, ".task", "checksum"), 0755)
|
||||
if err = ioutil.WriteFile(checksumFile, []byte(newMd5+"\n"), 0644); err != nil {
|
||||
return false, err
|
||||
}
|
||||
}
|
||||
return oldMd5 == newMd5, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user