This episode covers chi's latest stable features: support for the last four Go versions, middleware.Discard, and the RedirectSlashes fix in v5.2, as well as inline middleware on subrouters, XML support in the default compressible types, the io/ioutil replacement, and Go 1.26 CI in v5.3. You will also learn safe upgrade strategies.

Since the v5 major line launched in 2021, chi has been updated steadily — and 2026 has been a busy year. Episode 20 walks through everything that changed in v5.2.x and v5.3.x, so you don't miss security fixes and know which features you can take advantage of.
Knowing what a release contains isn't just insight: some changes — like the RedirectSlashes fix — have a direct impact on production security. Understanding release contents helps you decide when and how to upgrade.
v5.2.x brings internal improvements and compatibility with the latest Go. If you're still on v5.1 or older, the first step is moving up to v5.2:
go get github.com/go-chi/chi/v5@v5.2.0
go mod tidy
go test ./...go get github.com/go-chi/chi/v5@v5.2.0 pins the 5.2.0 version, and go test ./... ensures no behavior has changed.
chi adopts a support policy for the last four Go versions. This means that when v5.2 was released, chi was tested against the four newest Go releases. You should use a Go version within that range so that your dependencies resolve correctly.
v5.2 strengthens response writer handling:
r.With(middleware.Discard).Get("/drain", drainHandler)middleware.Discard discards every response written by the handler — useful for dry runs or endpoints that only need side effects. Alongside it, WrapResponseWriter has been hardened to capture status codes more reliably when other middleware is in use.
The GO-2026-4316 security fix (from episode 6) also shipped in this line. RedirectSlashes now normalizes trailing slashes without opening an open redirect hole. Make sure your version includes this fix:
go list -m github.com/go-chi/chi/v5go list -m github.com/go-chi/chi/v5 shows the version actually in use. If it's below the patched version, upgrade right away.
v5.3.x is the latest stable release as this series is written, with v5.3.0 released in May 2026 and v5.3.1 following in July 2026.
go get github.com/go-chi/chi/v5@v5.3.1
go mod tidygo get github.com/go-chi/chi/v5@v5.3.1 brings all fixes since v5.2, including security updates.
v5.3 strengthens inline middleware usage inside subrouters:
r.Route("/api", func(api chi.Router) {
api.Use(middleware.Logger)
api.With(middleware.Recoverer).Get("/ping", pingHandler)
})api.With(middleware.Recoverer).Get("/ping", pingHandler) applies Recoverer to just a single route inside the subrouter — a composition we've used since episode 5, now working more consistently in version 5.3.
middleware.Compress now includes text/xml and application/xml in the list of types compressed by default:
r.Use(middleware.Compress(5))middleware.Compress(5) automatically compresses XML responses without extra configuration — useful for SOAP, RSS, and legacy XML APIs.
v5.3 cleans up its internal code by replacing io/ioutil (which is deprecated) with io and os. There's no public API change, but it reduces stale dependencies and smooths support for the latest Go.
chi's CI pipeline now includes Go 1.26, aligned with the last-four-versions policy. For users, this means chi is guaranteed to run on the newest toolchain from the day a release ships.
go test ./... before and after upgrading.go list -m.go build ./...
go vet ./...
go test ./...go vet ./... detects suspicious patterns that dependency changes may have touched. The combination of build, vet, and test gives confidence that the upgrade is safe.
Key takeaways:
middleware.Discard discards responses for dry-run scenarios.text/xml and application/xml are now in the default compressible types.io/ioutil is replaced, and CI includes Go 1.26.In the next episode, episode 21, we tie everything together for production: production-ready architecture — a modular router as an http.Handler, dependency injection, env config, centralized logging, containerization with multi-stage Docker, a CI/CD pipeline, deployment to Kubernetes, and zero-downtime strategies.