Reject scan --workers below 1 as a usage error (closes #10)
check / check (push) Failing after 1s

A --workers value of 0 or less used to be quietly raised to 1, so a
typo ran the whole scan on one worker with nothing on stderr to say
why. scan now refuses it before anything is scanned: one line on
stderr and exit 2, like the other usage errors. The clamp in runScan
is gone, and README states the rule and the default.

Model: opus-5-5
This commit is contained in:
2026-10-04 11:41:38 +00:00
parent 8032ea682b
commit e932aaef0d
5 changed files with 69 additions and 10 deletions
+2 -5
View File
@@ -98,14 +98,11 @@ type fileMeta struct {
// is released after it. When ctx is cancelled, as by the SIGINT or
// SIGTERM that interruptContext catches, the scan keeps what it has
// hashed (see syncScan), prints how many files its walk reached, and
// returns errInterrupted.
// returns errInterrupted. workers must be at least 1; the scan command
// rejects anything less.
func runScan(ctx context.Context, roots []string, workers int,
oneFS bool,
) error {
if workers < 1 {
workers = 1
}
roots, err := resolveRoots(roots)
if err != nil {
return err