Go Builder Pattern
Some objects are simple and can be created in single constructor call. Other objects require a lot of ceremondy to create. Peice wise construction. builder provides an API for constructing an object step-by-step.
type PersonBuilder struct{ person *Person }
func (b *PersonBuilder) Lives() *PersonAddressBuilder{ return PersonAddressBuilder{*b} } func NewPersonBuilder() *PersonBuilder{ return &PersonBuilder{&Person{}} } type PersonAddressBuilder struct{ PersonBuilder }