The problem
In cmd/history/log.go under the logDate branch, the err variable is shadowed. When parsedDate, err := parseDateFlag(logDate) is called, a new err is declared inside the block. The subsequent query entries, err = db.GetEntriesByDateRange(start, end) assigns to this inner variable. The outer err (which is nil from storage.Initialize) is checked at the end of the block, meaning a failed date-range query produces an empty "No time entries found" message instead of returning the actual error.
Release version
0.8.6
Operating system
macOS
Steps to reproduce the behavior
- Run a
tmpo log --date command that forces a database error.
- Observe that the command exits gracefully with "No time entries found" instead of propagating the database error to the CLI output.
Screenshots
No response
Additional context
To fix this, declare parsedDate before the assignment or restructure the if-else chain to prevent shadowing the outer err variable.
The problem
In
cmd/history/log.gounder thelogDatebranch, theerrvariable is shadowed. WhenparsedDate, err := parseDateFlag(logDate)is called, a newerris declared inside the block. The subsequent queryentries, err = db.GetEntriesByDateRange(start, end)assigns to this inner variable. The outererr(which isnilfromstorage.Initialize) is checked at the end of the block, meaning a failed date-range query produces an empty "No time entries found" message instead of returning the actual error.Release version
0.8.6
Operating system
macOS
Steps to reproduce the behavior
tmpo log --datecommand that forces a database error.Screenshots
No response
Additional context
To fix this, declare
parsedDatebefore the assignment or restructure theif-elsechain to prevent shadowing the outererrvariable.