This site is being rebuilt and some pages are out of date. For current details, write to [email protected]. This notice goes away when the rebuild is done.

No analytics unless you allow it, no tracking. This site keeps in your browser the language you pick, the theme, its colour, which site you chose, the currency on the pricing page and that you closed this notice; signing in adds session cookies. The legal page has the details.

Sign in

Radar · Go · Archive · Week 9 · Feb 24 – Mar 2, 2025

runtime: allow cleanups to run concurrently

Worth knowingruntime

What changed
Documentation for runtime.AddCleanup was updated to state that cleanups run concurrently with user goroutines and with each other.
Production impact
The source does not say.
Try it
Call runtime.AddCleanup from multiple goroutines and observe concurrent execution.
Source
github.com/golang/go/issues/71825

Understand it, then run it

The runtime.AddCleanup function lets a program register a function that will run when the program exits. Until recently the documentation said that all cleanup functions run in a single goroutine, one after another. The change removes that wording and says that cleanups now run concurrently with each other and with user goroutines. This means a long‑running cleanup will no longer block other cleanups or the rest of the program.

Written by gpt-oss-20b from the linked source · claims checked against the sources · archive, not individually reviewed