go
package realtime

import (
  "fmt"
  "net/http"
  "time"

Server-Sent Events (SSE) with heartbeats and client cleanup

go http sse
by Leah Thompson 1 tab
go
package limit

import (
  "context"

  "golang.org/x/sync/semaphore"

Concurrency limiting with a context-aware semaphore

go concurrency context
by Leah Thompson 1 tab
go
package deps

import (
  "context"
  "net/http"
  "time"

Circuit breaker around flaky dependencies

go reliability circuit-breaker
by Leah Thompson 1 tab
go
package main

import (
  "context"
  "net/http"
  "time"

HTTP server timeouts that prevent slowloris and stuck connections

go http reliability
by Leah Thompson 1 tab
go
package store

import (
  "context"

  sq "github.com/Masterminds/squirrel"

Safe dynamic SQL with squirrel (optional filters, stable ordering)

go sql postgres
by Leah Thompson 1 tab
go
package store

import (
  "context"
  "time"

pgxpool initialization with max connections and statement timeout

go postgres pgx
by Leah Thompson 1 tab
go
package metrics

import (
  "net/http"
  "strconv"
  "time"

Prometheus metrics middleware capturing status + duration

go prometheus metrics
by Leah Thompson 1 tab
go
package observability

import (
  "context"

  "go.opentelemetry.io/otel"

OpenTelemetry tracer provider with ratio-based sampling

go observability opentelemetry
by Leah Thompson 1 tab
go
package grpcmw

import (
  "context"
  "time"

gRPC unary interceptor for auth and timing logs

go grpc observability
by Leah Thompson 1 tab
go
package middleware

import (
  "context"
  "net/http"
  "strings"

JWT verification with cached JWKS (handles key rotation)

go http security
by Leah Thompson 1 tab
go
package api

import (
  "io"
  "net/http"
  "os"

Safe multipart uploads using temp files (bounded memory)

go http uploads
by Leah Thompson 1 tab
go
package api

import (
  "encoding/json"
  "errors"
  "io"

Streaming JSON decoding with DisallowUnknownFields

go http json
by Leah Thompson 1 tab