1
0
mirror of https://github.com/go-task/task.git synced 2025-12-01 22:52:02 +02:00

Changes per feedback

This commit is contained in:
Stephen Prater
2019-08-25 10:30:00 -07:00
parent e0f72a6193
commit db36bc67f1
7 changed files with 60 additions and 41 deletions

View File

@@ -46,10 +46,6 @@ func (c *Checksum) IsUpToDate() (bool, error) {
return oldMd5 == newMd5, nil
}
func (t *Checksum) Kind() string {
return "checksum"
}
func (c *Checksum) checksum(files ...string) (string, error) {
h := md5.New()
@@ -77,7 +73,7 @@ func (c *Checksum) checksum(files ...string) (string, error) {
return fmt.Sprintf("%x", h.Sum(nil)), nil
}
// Value implements the Chcker Interface
// Value implements the Checker Interface
func (c *Checksum) Value() (string, error) {
return c.checksum()
}
@@ -87,6 +83,11 @@ func (c *Checksum) OnError() error {
return os.Remove(c.checksumFilePath())
}
// Kind implements the Checker Interface
func (t *Checksum) Kind() string {
return "checksum"
}
func (c *Checksum) checksumFilePath() string {
return filepath.Join(c.Dir, ".task", "checksum", c.normalizeFilename(c.Task))
}

View File

@@ -18,6 +18,10 @@ type Templater struct {
err error
}
func (r *Templater) RefreshStringMap() {
r.strMap = r.Vars.ToStringMap()
}
func (r *Templater) Replace(str string) string {
if r.err != nil || str == "" {
return ""