1
0
mirror of https://github.com/go-task/task.git synced 2025-11-23 22:24:45 +02:00

Only run task once for #53

This commit is contained in:
Ross Hammermeister
2020-08-17 13:25:17 -06:00
committed by Andrey Nering
parent a7b59e5b12
commit 97c85e39c3
12 changed files with 173 additions and 0 deletions

23
internal/hash/hash.go Normal file
View File

@@ -0,0 +1,23 @@
package hash
import (
"fmt"
"github.com/go-task/task/v3/taskfile"
"github.com/mitchellh/hashstructure/v2"
)
type HashFunc func(*taskfile.Task) (string, error)
func Empty(*taskfile.Task) (string, error) {
return "", nil
}
func Name(t *taskfile.Task) (string, error) {
return t.Task, nil
}
func Hash(t *taskfile.Task) (string, error) {
h, err := hashstructure.Hash(t, hashstructure.FormatV2, nil)
return fmt.Sprintf("%s:%d", t.Task, h), err
}