#​495 — February 13, 2024

Unsub  |  Web Version

Together with  Ardan Labs

Go Weekly

Go 1.22 Released — 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..) 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.
  • Variables defined in for loops are made anew on each iteration.
  • for loops may now range over integers.
  • range-over function iterators make an appearance, behind a flag for now.
  • Big enhancements to http/ServeMux and its routing abilities. Here's a quick comparison.
  • math/rand/v2 – the motivation was explained here.
  • 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 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 by Anton Zhiyanov. It's a neat way to noodle with some of the new code features without leaving your browser.

Go! Experts at Your Service — 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 — 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 – 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 — A case study of dependency reduction in Huma, 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:

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“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 — 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 — 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.

David Crawshaw

🐭🧀  Feeding a Hungry Mouse Using chromedp and Gochromedp is a package for remotely controlling a Chrome instance over its DevTools protocol. The developer in this post tried using it to automate the playing of a browser-based game.

Bhupesh Varshney

🛠 Code & Tools

gdu / go DiskUsage() 5.26.0: A Disk Usage Analyzer with a Terminal Interface — 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 — 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: A managed reliability & observability layer for webhooks & async messaging. Receive, transform, route, & deliver events at scale.

Wire 0.6.0: Compile-Time Dependency Injection for Go — Wire’s job is to simplify the management of initialization code when doing dependency injection. The first release in three years!

Google

sh 3.8: Shell Code Parser, Formatter, and Interpreter — Supporting sh, bash, and Korn/mksh formats. Now requires Go 1.21 at a minimum.

Daniel Martí