go
package middleware

import (
  "net/http"
)

CORS allowlist middleware (no wildcard surprises)

go http security
by Leah Thompson 1 tab
go
package webhooks

import (
  "bytes"
  "crypto/hmac"
  "crypto/sha256"

Webhook signature verification with HMAC (timing-safe compare)

go security http
by Leah Thompson 1 tab
go
package hotpath

import "testing"

func BenchmarkParse(b *testing.B) {
  b.ReportAllocs()

Benchmarking hot paths (allocs and throughput)

go performance benchmarking
by Leah Thompson 1 tab
go
package api_test

import (
  "encoding/json"
  "net/http"
  "net/http/httptest"

Table-driven tests for HTTP handlers with httptest

go testing http
by Leah Thompson 1 tab
go
package flags

import (
  "context"
  "encoding/json"
  "sync/atomic"

Feature flag snapshot with periodic refresh and atomic reads

go config reliability
by Leah Thompson 1 tab
go
package files

import (
  "context"
  "time"

Presigned S3 upload URLs (AWS SDK v2)

go aws s3
by Leah Thompson 1 tab
go
package store

import (
  "context"

  "github.com/jackc/pgx/v5"

Row-level locking with SELECT ... FOR UPDATE in a transaction

go postgres transactions
by Leah Thompson 1 tab
sql
ALTER TABLE documents ADD COLUMN version BIGINT NOT NULL DEFAULT 0;

Optimistic locking with a version column

go postgres sql
by Leah Thompson 2 tabs
go
package auth

import "golang.org/x/crypto/bcrypt"

func HashPassword(pw string, cost int) ([]byte, error) {
  if cost == 0 {

Password hashing with bcrypt and a calibrated cost

go security auth
by Leah Thompson 1 tab
go
package config

import (
  "errors"
  "os"
  "strconv"

Config parsing with env defaults and strict validation

go config reliability
by Leah Thompson 1 tab
go
package api

import (
  "encoding/json"
  "net/http"
)

Consistent JSON responses (content-type + error envelopes)

go http json
by Leah Thompson 1 tab
go
package api

import "net/http"

func ETag(w http.ResponseWriter, r *http.Request, etag string) bool {
  w.Header().Set("ETag", etag)

ETag handling for conditional GETs (cheap caching)

go http caching
by Leah Thompson 1 tab