Files
http-latency-prober/docs/usage/makefile.md
Jan Novak 9a69ba946f Add URL-level concurrency (-c flag, Step 7)
Probe multiple URLs in parallel with a bounded worker pool; the N samples
of each URL remain sequential to preserve accurate min/avg/max statistics.
Default auto-concurrency is min(numURLs, 8); -c 1 restores serial mode.
Output is always buffered and printed in original input order. Verified
clean with go test -race.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-01 01:33:03 +02:00

97 lines
2.6 KiB
Markdown

# Makefile
The root `Makefile` provides a single entry point for all common development
tasks. Targets are namespaced by language (`go-*`, `py-*` when the Python port
lands) with short umbrella targets (`build`, `test`, …) that delegate to the
language-specific ones.
## Quick reference
```sh
make # same as: make help
make help # list all targets with descriptions
```
## Umbrella targets
| Target | Description |
|--------|-------------|
| `all` | Run `check` then `build` |
| `build` | Build the binary (→ `go-build`) |
| `test` | Run all tests (→ `go-test`) |
| `check` | Pre-commit gate: fmt + vet + test (→ `go-check`) |
| `fmt` | Format source (→ `go-fmt`) |
| `vet` | Static analysis (→ `go-vet`) |
| `clean` | Remove binary and coverage artifacts |
## Go targets
| Target | Description |
|--------|-------------|
| `go-build` | Compile `go/latprobe` |
| `go-run` | Build and run (pass flags via `ARGS=`) |
| `go-test` | `go test ./...` |
| `go-test-verbose` | `go test -v ./...` — per-case PASS/FAIL output |
| `go-test-race` | `go test -race ./...` — run tests with the data-race detector |
| `go-check` | `go-fmt` + `go-vet` + `go-test` |
| `go-cover` | Coverage report → `go/coverage.html` |
| `go-fmt` | `gofmt -w go/` |
| `go-vet` | `go vet ./...` |
| `go-tidy` | `go mod tidy` |
| `go-install` | Install binary to `$GOBIN` |
| `go-lint` | `golangci-lint run` (must be installed) |
| `go-clean` | Remove `go/latprobe`, `go/coverage.out`, `go/coverage.html` |
## Examples
```sh
# Build and run a quick probe
make go-run ARGS="https://example.com"
make go-run ARGS="-n 5 --json https://example.com https://www.google.com"
# Run the full test suite
make test
# Verbose output showing each test case
make go-test-verbose
# Run tests with the race detector (verify concurrency safety)
make go-test-race
# Pre-commit gate (format, vet, test all in one)
make check
# Generate and open coverage report
make go-cover
open go/coverage.html # macOS
# Lint
make go-lint
# Clean up artifacts
make clean
```
## Passing arguments to `go-run`
```sh
make go-run ARGS="<url> [url ...] [flags]"
# Examples
make go-run ARGS="https://example.com"
make go-run ARGS="--timeout 2s --fail https://example.com"
make go-run ARGS="--json -n 3 https://example.com https://www.google.com"
```
## Adding Python targets (when the port lands)
The umbrella targets are designed to accept Python targets alongside the Go ones.
The pattern will be:
```make
test: go-test py-test # py-test added here during the port
```
`go-lint` requires `golangci-lint` to be installed. If it's missing the target
prints an install link and exits 1.