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 16 · Apr 14 – 20, 2025

Pluggable history API for `golang.org/x/term`

Worth knowingecosystem

What changed
The proposal adds a History interface and a Terminal field that records input lines read by ReadLine.
Production impact
The source does not say.
Try it
Create a Terminal, call ReadLine, and use History.Add and History.At to inspect the history.
Source
github.com/golang/go/issues/68780

Understand it, then run it

The golang.org/x/term package now lets you plug in your own history mechanism. When you type a line in a terminal, the library keeps a record of that line so you can press the up arrow to see previous commands. The new History interface lets you decide how many lines to keep, whether to drop empty lines, or to store them in a file. Terminal now has a History field that holds whatever implementation you choose.

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