From 1f9fd24064e25ccbfb7465d4030cf47a6caea0f0 Mon Sep 17 00:00:00 2001 From: Andrey Nering Date: Sat, 10 Jul 2021 21:58:03 -0300 Subject: [PATCH] Small improvement and CHANGELOG for #477 --- CHANGELOG.md | 2 ++ status.go | 8 ++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a71ae25c..37b93940 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +- Allow using both `sources:` and `status:` in the same task + ([#411](https://github.com/go-task/task/issues/411), ([#427](https://github.com/go-task/task/issues/427)), [#477](https://github.com/go-task/task/pull/477)). - Small optimization and bug fix: don't compute variables if not needed for `dotenv:` ([#517](https://github.com/go-task/task/issues/517)). diff --git a/status.go b/status.go index 95aabafd..0924ac10 100644 --- a/status.go +++ b/status.go @@ -29,10 +29,11 @@ func (e *Executor) Status(ctx context.Context, calls ...taskfile.Call) error { } func (e *Executor) isTaskUpToDate(ctx context.Context, t *taskfile.Task) (bool, error) { - areChecksGiven := false + if len(t.Status) == 0 && len(t.Sources) == 0 { + return false, nil + } if len(t.Status) > 0 { - areChecksGiven = true isUpToDate, err := e.isTaskUpToDateStatus(ctx, t) if err != nil { return false, err @@ -43,7 +44,6 @@ func (e *Executor) isTaskUpToDate(ctx context.Context, t *taskfile.Task) (bool, } if len(t.Sources) > 0 { - areChecksGiven = true checker, err := e.getStatusChecker(t) if err != nil { return false, err @@ -57,7 +57,7 @@ func (e *Executor) isTaskUpToDate(ctx context.Context, t *taskfile.Task) (bool, } } - return areChecksGiven, nil + return true, nil } func (e *Executor) statusOnError(t *taskfile.Task) error {