Software Development
Go 1.22: Loop Variables and ServeMux, What Still Applies in 2026
Go 1.22, from February 2024, brought two changes that still define idiomatic Go in Go 1.27: each for-loop iteration gets its own variable when go.mod declares go 1.22 or later, and net/http.ServeMux routes by method and wildcards such as GET /users/{id}. This guide checks both with Go 1.27.3 and notes what changed since.