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:
committed by
Andrey Nering
parent
a7b59e5b12
commit
97c85e39c3
23
internal/hash/hash.go
Normal file
23
internal/hash/hash.go
Normal 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
|
||||
}
|
||||
Reference in New Issue
Block a user