Repository navigation
v0.2.0 — static assets, CSP, i18n, request logging, health endpoints
The second release of go-bananas closes the gaps identified after v0.1.0, with parallel security + code reviews applied on top.
Install
go get github.com/mikehelmick/go-bananas@v0.2.0Requires Go 1.26+.
Highlights
🐛 Static assets actually serve
The renderer's SRI tags pointed at /static/... but nothing served the files. New middleware.ConfigureStaticAssets adds dev/prod cache headers and rejects directory requests (no auto-listings); the example serves its embedded assets behind it.
🔒 Security
middleware.ContentSecurityPolicy— per-request CSP header whose{{nonce}}placeholder shares theProcessNoncenonce with templates.PopulateTraceIDnow validates the client-supplied trace ID before it can reach outbound headers.- The example defaults
DEV_MODE=false(fail-safe) and wires a 30-minute session idle timeout that logs idle users out.
🌍 Internationalization
New i18n package — a gotext-backed LocaleProvider (gettext .po loading with full Accept-Language matching via x/text/language), so ProcessLocale and the t/tDefault template functions work out of the box. The example ships en/es catalogs — try /?lang=es.
📊 Observability & ops
middleware.LogRequests— one structured access-log line per request (method, path, status, bytes, duration), tagged with request/trace IDs.server.HealthzHandler/server.ReadyzHandler— liveness and pluggable readiness probes. Readiness lists failing check names only (details stay in logs) and survives panicking checks.
Reviews
Parallel security and code review of the changes; all findings fixed before release (readyz error-string disclosure, static directory listings, an i18n reload-mode RWMutex hardening, CSP whitespace, idle-timeout logout). go test -race, golangci-lint, and govulncheck all clean.
New core dependency: golang.org/x/text (language matching).
Docs: https://mikehelmick.github.io/go-bananas · Full changelog: v0.1.0...v0.2.0