Skip to content

printer: fix --stats for --json#3190

Merged
BurntSushi merged 1 commit intomasterfrom
ag/fix-json-stats
Oct 16, 2025
Merged

printer: fix --stats for --json#3190
BurntSushi merged 1 commit intomasterfrom
ag/fix-json-stats

Conversation

@BurntSushi
Copy link
Owner

Somehow, the JSON printer seems to have never emitted correct summary
statistics. And I believe #3178 is the first time anyone has ever
reported it. I believe this bug has persisted for years. That's
surprising.

Anyway, the problem here was that we were bailing out of finish() on
the sink if we weren't supposed to print anything. But we bailed out
before we tallied our summary statistics. Obviously we shouldn't do
that.

Fixes #3178

Somehow, the JSON printer seems to have never emitted correct summary
statistics. And I believe #3178 is the first time anyone has ever
reported it. I believe this bug has persisted for years. That's
surprising.

Anyway, the problem here was that we were bailing out of `finish()` on
the sink if we weren't supposed to print anything. But we bailed out
before we tallied our summary statistics. Obviously we shouldn't do
that.

Fixes #3178
@BurntSushi BurntSushi merged commit 63209ae into master Oct 16, 2025
21 checks passed
@BurntSushi BurntSushi deleted the ag/fix-json-stats branch October 16, 2025 01:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant