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 8 · Feb 16 – 22, 2026

go/token: add (*File).String method

Nice to knowtooling

What changed
token.File.String() now returns a brief description of the file, e.g., "foo.go(1-0)".
Production impact
The source does not say.
Try it
fmt.Println(token.NewFileSet().AddFile("foo.go", -1, 0)).
Source
github.com/golang/go/issues/76285

Understand it, then run it

token.File.String() now prints a short description of a file instead of a long, unreadable struct. Previously, printing a *token.File produced a verbose output that included the file name, size, and internal slices, which was hard to read. The new method formats the file as "name(base-end)", for example "foo.go(1-0)". This makes debugging and logging easier for beginners who want to see which file a token.File refers to.

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