Sets up project structure, working conventions (CLAUDE.md), README with the full assignment and roadmap, seeded CHANGELOG, and a buildable Go scaffold (Step 0) with flag parsing and stub probe types. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
45 lines
1016 B
Go
45 lines
1016 B
Go
package main
|
|
|
|
import (
|
|
"flag"
|
|
"fmt"
|
|
"os"
|
|
)
|
|
|
|
const usageText = `latprobe — measure per-phase HTTP request latency
|
|
|
|
Usage:
|
|
latprobe [flags] <url> [url ...]
|
|
|
|
Flags:
|
|
-n, --count int Number of requests per URL (default 1)
|
|
--json Output results as JSON instead of text
|
|
-h, --help Show this help
|
|
|
|
Examples:
|
|
latprobe https://example.com
|
|
latprobe -n 5 https://example.com https://www.google.com
|
|
latprobe --json https://example.com | jq .
|
|
`
|
|
|
|
func main() {
|
|
count := flag.Int("count", 1, "number of requests per URL")
|
|
flag.IntVar(count, "n", 1, "number of requests per URL (shorthand)")
|
|
jsonOut := flag.Bool("json", false, "output results as JSON")
|
|
|
|
flag.Usage = func() { fmt.Fprint(os.Stderr, usageText) }
|
|
flag.Parse()
|
|
|
|
urls := flag.Args()
|
|
if len(urls) == 0 {
|
|
fmt.Fprint(os.Stderr, usageText)
|
|
os.Exit(1)
|
|
}
|
|
|
|
// Placeholders — implementations wired in per step.
|
|
_, _ = count, jsonOut
|
|
|
|
fmt.Fprintf(os.Stderr, "latprobe: not yet implemented (scaffold only)\n")
|
|
os.Exit(1)
|
|
}
|