Skip to content
masterclass Buddy

Go · Function

new

Go 1.26 extends the built-in new function. It can now take an expression and return a pointer to a variable initialized with that expression's value.

Last updated

Since
Go 1.26

Syntax

new(expression)

In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.

Subscribe
  • encoding/json
  • new
  • Go 1.26

Source: Go 1.26 Release Notes. Checked 2026-11-03.