package main import "fmt" type A struct { id int } type Builder interface { add() A remove() A } func (a A) add(el int) A{ a.id = el return a } func (a A) remove() A{ a.id = 0 return a } func main() { n := A{1} fmt.Println(n.add(2).remove()) }