fix: report no timestamp when a task's sources match no file - #2960
Open
vmaerten wants to merge 2 commits into
Open
fix: report no timestamp when a task's sources match no file#2960vmaerten wants to merge 2 commits into
vmaerten wants to merge 2 commits into
Conversation
vmaerten
added a commit
that referenced
this pull request
Aug 9, 2026
vmaerten
added a commit
that referenced
this pull request
Aug 9, 2026
vmaerten
force-pushed
the
fix/timestamp-empty-sources
branch
from
August 9, 2026 20:58
c9ac146 to
7551ba0
Compare
TimestampChecker.Value returned a sentinel for "no source found": first
the string "0", then time.Unix(0, 0) once the value became a time.Time
exposed to templates. Rendered, that sentinel reads as a genuine date,
1970-01-01 01:00:00 +0100 CET, whose zone depends on the machine — so a
command interpolating {{.TIMESTAMP}} gets a plausible but meaningless
multi-word value instead of nothing.
Return an empty string, like NoneChecker already does for a checker with
nothing to report.
vmaerten
force-pushed
the
fix/timestamp-empty-sources
branch
from
August 10, 2026 14:12
7551ba0 to
0c6c941
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
TimestampChecker.Valuereturns a sentinel when a task'ssourcesmatch no file: originally the string"0", thentime.Unix(0, 0)once the value became atime.Timeexposed to templates. Rendered, that sentinel reads as a genuine date —1970-01-01 01:00:00 +0100 CET, with a zone that depends on the machine — so a command interpolating{{.TIMESTAMP}}receives a plausible, meaningless, multi-word value instead of nothing. It now returns an empty string, likeNoneCheckeralready does for a checker with nothing to report.This is user-visible: a task with
method: timestampwhose glob matches nothing used to print1970-01-01 01:00:00 +0100 CETand now prints nothing.Test plan
TestTimestampCheckerValuecovers both branches of the checker: a real modification time when a source matches, and no value when the glob matches nothing.mainand from this branch, on a Taskfile withmethod: timestampandsources: ['./gen/**/*.go']in a directory with nogen/:mainprintsts=[1970-01-01 01:00:00 +0100 CET], this branch printsts=[].