Editor's pick

WebGuide
The Go 1.22 Router Patterns With Methods and Wildcards
The Go 1.22 http.ServeMux pattern syntax with methods, wildcards, the {$} anchor and host patterns, plus precedence, 405 handling and conflicts.
14 min read
Tag
3 articles

The Go 1.22 http.ServeMux pattern syntax with methods, wildcards, the {$} anchor and host patterns, plus precedence, 405 handling and conflicts.

Use math/rand/v2 for dice, shuffles and simulations, seed a generator for reproducible tests, and use crypto/rand for tokens. See the API and the old traps.

Since Go 1.22 every loop iteration has its own variable, which fixes the closure and goroutine bug. See old against new output and how go.mod decides.