mirror of
https://github.com/go-task/task.git
synced 2025-07-17 01:43:07 +02:00
refactor isUpToDate()
This commit is contained in:
9
task.go
9
task.go
@ -132,6 +132,12 @@ func (e *Executor) runDeps(ctx context.Context, task string) error {
|
||||
|
||||
func (t *Task) isUpToDate(ctx context.Context) (bool, error) {
|
||||
if len(t.Status) > 0 {
|
||||
return t.isUpToDateStatus(ctx)
|
||||
}
|
||||
return t.isUpToDateTimestamp(ctx)
|
||||
}
|
||||
|
||||
func (t *Task) isUpToDateStatus(ctx context.Context) (bool, error) {
|
||||
environ, err := t.getEnviron()
|
||||
if err != nil {
|
||||
return false, err
|
||||
@ -149,8 +155,9 @@ func (t *Task) isUpToDate(ctx context.Context) (bool, error) {
|
||||
}
|
||||
}
|
||||
return true, nil
|
||||
}
|
||||
}
|
||||
|
||||
func (t *Task) isUpToDateTimestamp(ctx context.Context) (bool, error) {
|
||||
if len(t.Sources) == 0 || len(t.Generates) == 0 {
|
||||
return false, nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user