A minor incompatibility in Go 1.25

300 views
Skip to first unread message

Bob Glickstein

unread,
Aug 14, 2025, 1:12:46 AMAug 14
to golang-nuts
I just discovered the hard way (where hard == a few hours of debugging) that, beginning in Go 1.25, "any" type-checks (in the "go/types".Config.Check sense) as a *types.Alias. Previously it type-checked as a *types.Interface. This caused a test breakage when updating Modver, which I have fixed here.

Not sure whether this rises to the level of a bug report. It is at least a public-service announcement.

Cheers,
- Bob

David Harkness

unread,
Aug 20, 2025, 2:55:35 PMAug 20
to golang-nuts
According to the types.Alias documentation, this was changed because Go 1.24 added the ability for a type alias to have generic arguments, e.g. type Set[K comparable] = map[K]bool. You can use Unalias to get the underlying type.
Reply all
Reply to author
Forward
0 new messages