@rulepack/go-stdlib

v0.1.3

Idiomatic Go 1.22+ rules: stdlib net/http with mux, error wrapping, context discipline, no framework lock-in.

Updated 6/4/20265 files | 4.1 KB
$pnpm dlx rulepack add go-stdlib

Drops CLAUDE.md / .cursor/rules/* and friends into your project.

Downloads

0

Stars

0

Views

0

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.ServeMux and 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 can errors.Is / errors.As, with package-level sentinel errors and typed errors that Unwrap()
  • Context discipline: context.Context as the first param of any blocking call, never stored in a struct, with a clear goroutine shutdown path
  • Concurrency with errgroup.Group for fan-out plus first-error semantics; no fire-and-forget goroutines
  • JSON via encoding/json with explicit struct tags, plus gofmt -s, goimports, go vet, and staticcheck cleanliness

Source

Rules align with the Go standard library & official documentation: https://pkg.go.dev/std

License

MIT