package builder type Builder interface { Build() } func NewDirector(b Builder) Director { return Director{build: b} } type Director struct { build Builder } func (d *Director) Construct() { d.build.Build() } type ConcreateBuilder struct { Built bool } func NewConcreateBuilder() ConcreateBuilder { return ConcreateBuilder{Built: false} } func (b *ConcreateBuilder) Build() { b.Built = true } type Product struct { Built bool } func NewProduct() Product { return Product{Built: false} } func (b *ConcreateBuilder) GetResult() Product { return Product{b.Built} }