---
title: "The one with Go 1.22 everywhere"
publication: "Go Weekly"
issue: 495
published_at: "2024-02-13"
canonical_url: "https://golangweekly.com/issues/495"
---

Plus feeding a hungry mouse, why to start with the standard libraries, and how Mat Ryer writes Go HTTP services after all these years. |        

#​495 — February 13, 2024 

[Unsub](https://golangweekly.com/leave/*|UID|*)|[Web Version](https://golangweekly.com/issues/495)  

Together with [![Ardan Labs\](https://res.cloudinary.com/cpress/image/upload/e_make_transparent/co_white,e_outline:7,q_auto/uf5bdgdgdbgcbdrzi6r7.png)](https://www.ardanlabs.com/consulting/?utm_source=cooperpress)  

Go Weekly 

[![\](https://res.cloudinary.com/cpress/image/upload/w_1280,e_sharpen:60,q_auto/heblx3cal5dvoa65cbfz.jpg)](https://go.dev/blog/go1.22)  

[Go 1.22 Released](https://go.dev/blog/go1.22) — Keeping in tradition with _most_ even numbered Go releases landing in February, Go 1.22 is here! In theory, the upgrade is as simple as updating the version in `go.mod` (just be careful of any [`net/http.ServeMux` breakages..](https://go.dev/doc/go1.22#enhanced_routing_patterns)) whereupon you'll be able to enjoy a variety of improvements: 

- Small performance improvements, though with larger potential gains through improvements to [profile-guided optimization.](https://go.dev/doc/pgo)
- Variables defined in `for` loops are made anew on each iteration.
- `for` loops may now `range` over integers.
- [range-over function iterators](https://go.dev/wiki/RangefuncExperiment) make an appearance, behind a flag for now.
- Big enhancements to [`http/ServeMux`](https://pkg.go.dev/net/http#ServeMux) and its routing abilities. Here's [a quick comparison.](https://me.samuelsh.com/blog/new-http-router-in-go-122)
- [`math/rand/v2`](https://go.dev/doc/go1.22#math_rand_v2) – the motivation was [explained here.](https://github.com/golang/go/issues/61716)
- A cute enhancement that stood out to me: _"When `io.Copy` copies from a `TCPConn` to a `UnixConn` it will now use Linux's `splice(2)` system call if possible, using the new method `TCPConn.WriteTo.`"_ 

To go through _everything_, [the full Go 1.22 release notes](https://go.dev/doc/go1.22) are the place to.._Go._ 

Eli Bendersky and the Go team   

💡 We linked to it a month ago, but it's worth revisiting [these interactive (unofficial) release notes for Go 1.22](https://antonz.org/go-1-22/) by Anton Zhiyanov. It's a neat way to noodle with some of the new code features without leaving your browser.  [![\](https://copm.s3.amazonaws.com/bcc68a3c.png)](https://www.ardanlabs.com/consulting/?utm_source=cooperpress) 

[Go! Experts at Your Service](https://www.ardanlabs.com/consulting/?utm_source=cooperpress) — Do you need help filling skill gaps, speeding up development & creating high performing software with Go, Docker, K8s, Terraform and Rust? We’ll help you maximize your architecture, structure, tech-debt and human capital. 

Ardan Labs Consulting sponsor   

[How I Write HTTP Services in Go After 13 Years](https://grafana.com/blog/2024/02/09/how-i-write-http-services-in-go-after-13-years/) — Mat Ryer, host of the _Go Time_ podcast, wrote a post several years ago about [how he wrote HTTP services after _eight_ years of experience](https://pace.dev/blog/2018/05/09/how-I-write-http-services-after-eight-years.html) – now he's back for a thirteen year redux, covering what’s changed since 2018, and going into more depth overall. 

Mat Ryer (Grafana Lab)   

[Reducing Go Dependencies](https://dgt.hashnode.dev/reducing-go-dependencies) — A case study of dependency reduction in [Huma](https://huma.rocks/), a Go framework for creating HTTP REST APIs using OpenAPI, which might inspire you to consider similar options for your own projects. 

Daniel Taylor   

_QUICK BITS:_ 

- Kashyap Kondamudi observed that [Go can only read 1GB per `Read` call.](https://kgrz.io/go-file-read-max-size-buffer.html) In reality, this isn't a big deal, but interesting to know.
- ▶️ Matt Boyle has [a free '_Go 1.22 in 22 minutes_' course](https://www.bytesizego.com/what-s-new-in-go-1-22)available.
- John Arundel says he's [updated all his Go books](https://bitfieldconsulting.com/books) for Go 1.22.
- Ever wondered [how SSH ended up on port 22?](https://www.ssh.com/academy/ssh/port#how-ssh-port-became-22) _(that number again!)_
- 📺 GitHub co-founder Scott Chacon gave [▶️ a fantastic talk about Git](https://www.youtube.com/watch?v=aolI_Rz0ZqY) at FOSDEM 2024 covering numerous things you might not know about its capabilities. I _really_ enjoyed this.
- Google has [given $1M to the Rust Foundation.](https://www.theregister.com/2024/02/05/google_rust_donation/)   

[Start with the Go Standard Library](https://matthewsanabria.dev/posts/start-with-the-go-standard-library/) — Go has a great standard library, so _"you should start with it"_, says Matthew. He also takes time to compare a few of the libraries against third party alternatives. 

Matthew Sanabria   

[I Wish Go Had a `retry` Block](https://xeiaso.net/blog/2024/retry-block/) — _“I kinda wish that Go had some kind of language-level construct for ‘an action that is composed of multiple parts that can fail, and when one fails in a non-permanent way, then the program will wait for some time before trying again’.”_ 

Xe Iaso   

[WorkOS, the modern identity platform for B2B SaaS](https://workos.com/?utm_source=cpgolang&utm_medium=newsletter&utm_campaign=q12024) — WorkOS provides easy-to-use APIs for authentication, user identity, and complex enterprise features like SSO and SCIM. 

WorkOS sponsor   

[`jsonfile`: A Quick Hack for Tinkering](https://crawshaw.io/blog/jsonfile) — Tailscale’s CTO has a bit of a thing for using JSON files as small scale, _ad hoc_ databases. He explains why, the pros and cons, and shares an implementation in the form of [jsonfile.go.](https://github.com/crawshaw/jsonfile/blob/main/jsonfile.go) 

David Crawshaw   

🐭🧀 [Feeding a Hungry Mouse Using `chromedp` and Go](https://www.pacenthink.io/post/feeding-a-hungry-mouse-using-chromedp-and-golang/) — [chromedp](https://github.com/chromedp/chromedp) is a package for remotely controlling a Chrome instance over [its DevTools protocol](https://chromedevtools.github.io/devtools-protocol/). The developer in this post tried using it to automate the playing of a browser-based game. 

Bhupesh Varshney  

🛠 Code & Tools 

[![\](https://res.cloudinary.com/cpress/image/upload/w_1280,e_sharpen:60/lumxdamlgnkcidxyibpi.jpg)](https://github.com/dundee/gdu)  

[gdu / go DiskUsage() 5.26.0: A Disk Usage Analyzer with a Terminal Interface](https://github.com/dundee/gdu) — Written in Go, of course. This is a neat tool. Rapidly analyze your disk space usage – it benchmarks well against other tools in the space. 

Daniel Milde   

[errcheck 1.7: It Checks That You Checked for Errors](https://github.com/kisielk/errcheck) — Checking for errors is a fundamental part of the Go experience and this tool will help you check that you checked! 

Kamil Kisiel      

📰 Classifieds   

🪝[Hookdeck](https://hookdeck.com?ref=goweekly-495): A managed reliability & observability layer for webhooks & async messaging. [Receive, transform, route, & deliver events at scale](https://hookdeck.com?ref=goweekly-495).      

[Wire 0.6.0: Compile-Time Dependency Injection for Go](https://github.com/google/wire) — Wire’s job is to [simplify the management of initialization code](https://blog.golang.org/wire) when doing dependency injection. The first release in three years! 

Google   

[sh 3.8: Shell Code Parser, Formatter, and Interpreter](https://github.com/mvdan/sh) — Supporting sh, bash, and Korn/mksh formats. Now requires Go 1.21 at a minimum. 

Daniel Martí   

- [FastHTTP 1.52](https://github.com/valyala/fasthttp/releases/tag/v1.52.0) – Performance-oriented alternative to `net/http` for [specific high-volume scenarios.](https://github.com/valyala/fasthttp#fasthttp-might-not-be-for-you)
- [Garble 0.12](https://github.com/burrowers/garble) – Obfuscation for Go builds. Now supporting Go 1.22.
- [Wails 2.8](https://github.com/wailsapp/wails) – Built desktop apps with Go + Web technologies.
- [go-github 59.0](https://github.com/google/go-github) – Client library for the GitHub v3 API.
- [fq 0.10](https://github.com/wader/fq/releases/tag/v0.10.0) – Imagine `jq` but for binary formats.
- [go-imap 2.0 Beta 1](https://github.com/emersion/go-imap/releases/tag/v2.0.0-beta.1) - IMAP4 client library.         

Curated by Peter Cooper and [Glenn Goodrich](https://twitter.com/ruprict). 

[Change your email](https://golangweekly.com/edit_subscription/*|UID|*)
[Stop getting this newsletter](https://golangweekly.com/leave/*|UID|*) 

© Cooper Press Ltd · Fairfield Enterprise Centre, Louth, LN11 0LS, United Kingdom
