feat(go): step 1 — total wall-clock latency per URL

probe.Measure performs an HTTP GET and records total elapsed time from
request start to body fully read. main.go prints URL, status code, and
total for each positional URL argument, exiting 1 on any failure.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-07-01 00:21:12 +02:00
parent 8d5631795b
commit a588eb3b0e
5 changed files with 114 additions and 10 deletions

View File

@@ -0,0 +1,57 @@
# Step 1 — Simple Total Latency
## What this step delivers
`latprobe` accepts one or more URLs and prints the total wall-clock time of
each HTTP GET request (including body download). No per-phase breakdown yet —
that comes in Step 2.
## Build
```sh
cd go
go build -o latprobe .
```
## Usage
```sh
latprobe <url> [url ...]
```
## Examples
Single URL:
```sh
$ ./latprobe https://example.com
https://example.com 200 70ms
```
Multiple URLs:
```sh
$ ./latprobe https://example.com https://www.google.com
https://example.com 200 70ms
https://www.google.com 200 127ms
```
Error (unreachable host):
```sh
$ ./latprobe https://doesnotexist.invalid
error https://doesnotexist.invalid: Get "https://doesnotexist.invalid": ...
# exits with code 1
```
## Output columns
| Column | Description |
|--------|-------------|
| URL | The requested URL |
| Status | HTTP response status code |
| Total | Wall-clock time from request start to body fully received |
## Flags accepted (not yet functional)
`-n`/`--count` and `--json` are parsed but produce no effect until Steps 34.