go-stdlib
Idiomatic Go 1.22+ rules: stdlib net/http with mux, error wrapping, context discipline, no framework lock-in.
npx rulepack add go-stdlib
What it covers
- HTTP with the standard library:
http.ServeMuxand method-aware patterns (mux.HandleFunc("GET /users/{id}", h)) — no gin/echo/chi without a hard requirement - Error wrapping via
fmt.Errorf("...: %w", err)so callers canerrors.Is/errors.As, with package-level sentinel errors and typed errors thatUnwrap() - Context discipline:
context.Contextas the first param of any blocking call, never stored in a struct, with a clear goroutine shutdown path - Concurrency with
errgroup.Groupfor fan-out plus first-error semantics; no fire-and-forget goroutines - JSON via
encoding/jsonwith explicit struct tags, plusgofmt -s,goimports,go vet, andstaticcheckcleanliness
Source
Rules align with the Go standard library & official documentation: https://pkg.go.dev/std
License
MIT