Radar · Go · Archive · Week 3 · Jan 12 – 18, 2026
Expose “no return” API in x/tools/go
Worth knowingecosystem
- What changed
- The proposal is accepted to expose the results of “no return” analysis from the x/tools CFG packages, adding APIs in cfg, ctrlflow, and ssa that allow callers to query or set the “no return” property.
- Production impact
- The source does not say.
- Try it
- Clone
golang.org/x/tools, importgolang.org/x/tools/go/cfg, and callcfg.NoReturn()on a CFG you build to see if the function can return. - Source
- github.com/golang/go/issues/76161
Understand it, then run it
The Go tools can now tell you when a function will never return. Previously you had to dig into the internals of the tools to find this out. Now the packages cfg, ctrlflow, and ssa expose a simple method called NoReturn. You can ask a control‑flow graph if it can return, or tell the SSA builder that a named function never returns, and the tools will use that information automatically.
Written by gpt-oss-20b from the linked source · claims checked against the sources · archive, not individually reviewed