Skip to content

#Go

9 posts tagged Go. All posts

  1. GoRate limiting in Go with golang.org/x/time/rateToken-bucket rate limiting in Go: rate.NewLimiter, when to use Allow, Wait or Reserve, per-client limiters with cleanup, and HTTP middleware that returns 429.
  2. GoFinding slow code in Go with pprofProfile Go code with pprof: net/http/pprof in a service, CPU and memory profiles from go test, top and list, heap versus allocs, and fixing a hot allocation.
  3. GoType-safe SQL in Go with sqlcGenerate typed Go code from plain SQL with sqlc: a version 2 sqlc.yaml, :one, :many and :exec queries, using pgx or database/sql, and transactions with WithTx.
  4. GoShipping a single Go binary with embedBundle static files and templates into a Go binary with //go:embed and embed.FS, serve them with http.FileServerFS, and keep a dev mode that reads from disk.
  5. GoIterators in Go: range over functions and the iter packageWrite Go iterators with iter.Seq and Seq2: generators, tree walks, early break and the yield contract, slices.Collect and maps.Keys, and merging with iter.Pull.
  6. GoTable-driven tests and native fuzzing in GoWrite table-driven Go tests with t.Run and t.Parallel, keep fixtures in testdata, then add a fuzz target that finds a real bug in a small version parser.
  7. GoRouting in Go's net/http with method and wildcard patternsHow Go's ServeMux patterns work: methods, {id} and {path...} wildcards, {$}, precedence and conflicts, automatic 405s, and middleware as plain functions.
  8. GoStructured logging in Go with log/slogUse Go's log/slog: attributes, text and JSON handlers, levels with LevelVar, With and groups, LogValuer for redacting secrets, and a context-aware handler.
  9. GoGo generics in practice: constraints, generic types and when to skip themGo 1.25 type parameters: constraints with ~ and unions, cmp.Ordered, a generic Set, Map and Filter helpers, slices and maps, and when an interface is simpler.

© 2026 David Li · Home · Blog · RSS ·Classic site · Built with Astro, Starlight and three.js · Logos:Font Awesome Free (CC BY 4.0)