Skip to content

Glossary: Go Basics

Constructor

Also written: constructor function, NewX

By convention a function named `New` plus the type name, such as `NewProduct`, that makes and checks a new value. It usually returns a pointer, or `nil` and an error.

Where the book teaches it