feat(go): step 4 — --json output flag

Add --json flag that emits all results as a JSON array. Schema always
uses min/avg/max per phase (consistent regardless of -n); phases absent
from the request are omitted from the phases object. Output is buffered
until all URLs complete, then printed as one pretty-printed array.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-07-01 00:31:54 +02:00
parent 8ec926bbcd
commit 3affc05996
4 changed files with 227 additions and 46 deletions

View File

@@ -93,7 +93,7 @@ https://example.com (5 samples)
| 1 | Simple total latency — single URL, wall-clock time | ✅ Done |
| 2 | Per-phase breakdown — DNS, TCP, TLS, TTFB, transfer (`net/http/httptrace`) | ✅ Done |
| 3 | Multiple URLs + `--count`/`-n` — min/avg/max aggregates | ✅ Done |
| 4 | `--json` output flag | ⬜ Pending |
| 4 | `--json` output flag | ✅ Done |
### Python