Go 1.26's Small But Clever New Function Change!
This title could be clearer and more informative.Try out Clickbait Shieldfor free (5 uses left this month).
Go 1.26 enhances the built-in `new` function to accept an initializer expression, allowing memory allocation and value assignment in a single step. Previously, developers had to allocate with `new(T)` and then dereference the pointer to assign a value, often requiring temporary variables. With Go 1.26, `new(42)` allocates an
•12m watch time
5 Comments
Sort: