Generics arrived in Go in March 2022 with high expectations and some skepticism. Three years on, idiomatic code barely uses them on the surface, but they have transformed deep libraries: type-safe collections, database clients, concurrency primitives. This analysis examines what has taken hold and why.
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.
9 min2324.2
We use first- and third-party cookies to analyze site traffic. You can accept them, reject them, or configure your choice.
Learn more about cookies
Cookie preferences
NecessaryEssential for the site to work. Always on.
AnalyticsHelp us understand how the site is used (Google Analytics).