Archive · Week 16 · Apr 14 – 20, 2025from 2 items
This week the Go team accepted two proposals that will shape future releases. One adds a pluggable history API to the `golang.org/x/term` package, and the other removes unused build tools from the binary distribution to shrink its size.
Worth knowingecosystem
Pluggable history API for `golang.org/x/term`
- What changed
- The proposal adds a
Historyinterface and aTerminalfield that records input lines read byReadLine. - Production impact
- The source does not say.
- Try it
- Create a
Terminal, callReadLine, and useHistory.AddandHistory.Atto inspect the history. - Source
- github.com/golang/go/issues/68780
Explain it
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.
Worth knowingtooling
Remove unused build tools from the binary distribution
- What changed
- The proposal will stop including tools such as
addr2line,buildid,nm,objdump,pprof,test2json, andtracein the binary distribution. - Production impact
- The source does not say.
- Try it
- Run
go toolon one of the omitted tools and observe that it is built on demand. - Source
- github.com/golang/go/issues/71867
Exercise
Write a small program that uses the new History API from golang.org/x/term. The program should create a terminal, read a line from standard input, add it to the history, and then print the most recent history entry.
The 60-second version
Good morning, everyone. This week the Go team accepted two proposals that will shape future releases. First, they added a pluggable history API to the `golang.org/x/term` package, giving developers a way to record and retrieve input lines read by the terminal. Second, they decided to stop shipping a handful of unused build tools with the binary distribution, which should shrink the distribution size by about twenty percent. Both changes are worth knowing for anyone building or maintaining Go tools or applications. The source does not say how these changes will affect production, but you can experiment with the new history API by creating a terminal, reading a line, adding it to the history, and then printing the most recent entry. For the distribution shrinkage, you can try running one of the omitted tools with `go tool` and see that it is built on demand. Thank you.
Written by gpt-oss-20b · claims checked against the sources · archive, not individually reviewed