Repository navigation
v0.4.0 — httptimeout rule
What's new
New rule: httptimeout — gates HTTP calls and clients that have no timeout.
Flags:
http.Get,http.Post,http.Head,http.PostForm(all go throughhttp.DefaultClient, which has zeroTimeout)- Any call on
http.DefaultClient(e.g.http.DefaultClient.Do(req)) &http.Client{}/http.Client{}literals with noTimeoutfield set, orTimeout: 0
Does not flag:
&http.Client{Timeout: 30*time.Second}— explicit non-zero&http.Client{Timeout: cfg.Timeout}— non-constant expressions are trusted (the rule's job is to force a deliberate choice, not to verify it)client.Do(req)on a*http.Clientvariable other thanhttp.DefaultClient— the literal construction is the gate, not every use
Opt-out: `// timeout-ok: ` on the call line or on the opening brace of a multi-line client literal.
Drift fixes in README
- `errorlint` was previously added without a matching entry in the Rules table; both `errorlint` and `httptimeout` are now listed
- Coverage count bumped from 11 to 12