mirror of
https://github.com/go-task/task.git
synced 2025-01-22 05:10:17 +02:00
checksum: save them in a subdir .task/checksum
future-proof since the .task directory can be used to save other state in the future
This commit is contained in:
parent
2022551b26
commit
44a52359dc
@ -36,7 +36,7 @@ func (c *Checksum) IsUpToDate() (bool, error) {
|
|||||||
return false, nil
|
return false, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
_ = os.MkdirAll(filepath.Join(c.Dir, ".task"), 0755)
|
_ = os.MkdirAll(filepath.Join(c.Dir, ".task", "checksum"), 0755)
|
||||||
if err = ioutil.WriteFile(checksumFile, []byte(newMd5+"\n"), 0644); err != nil {
|
if err = ioutil.WriteFile(checksumFile, []byte(newMd5+"\n"), 0644); err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
@ -76,7 +76,7 @@ func (c *Checksum) OnError() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *Checksum) checksumFilePath() string {
|
func (c *Checksum) checksumFilePath() string {
|
||||||
return filepath.Join(c.Dir, ".task", c.normalizeFilename(c.Task))
|
return filepath.Join(c.Dir, ".task", "checksum", c.normalizeFilename(c.Task))
|
||||||
}
|
}
|
||||||
|
|
||||||
var checksumFilenameRegexp = regexp.MustCompile("[^A-z0-9]")
|
var checksumFilenameRegexp = regexp.MustCompile("[^A-z0-9]")
|
||||||
|
@ -289,7 +289,7 @@ func TestStatusChecksum(t *testing.T) {
|
|||||||
|
|
||||||
files := []string{
|
files := []string{
|
||||||
"generated.txt",
|
"generated.txt",
|
||||||
".task/build",
|
".task/checksum/build",
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, f := range files {
|
for _, f := range files {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user