Go 1.26 Lets new() Take an Expression, Making Pointer Helpers Obsolete

Go 1.26, released February 10, 2026, extends the built-in new function to accept an expression as well as a type. This means new(42) or new(time.Now()) now compiles, letting developers create pointers to simple values directly. The change resolves a long-standing issue first proposed in 2021 and closed in October 2025. Developers who relied on helper functions such as ptr[T] or utility packages can often remove them, with go fix handling most of the migration. Libraries must declare Go 1.26 or later in go.mod to use the feature, which raises their minimum supported version.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in