Skip to content

Glossary: Software Design Patterns in Go

Constructor function

Also written: NewX function, constructor

A plain function, named like `NewOrderLog`, that builds and returns a ready-to-use value. Go has no constructors, so this is the convention; it is where dependencies are passed in.

Where the book teaches it

Related terms

Constructor injection