Here is an example of composite design pattern. Notice the Employee structure has a list of subordinates, which is the basis of Employee itself.
package mainimport ( "fmt")type Employee struct { name string subordinate []*Employee salary uint64}func newEmployee(name string, salary uint64) *Employee { return &Employee{ name: name, subordinate: []*Employee{}, salary: salary, }}func main() { dev1 := newEmployee("Conor Lex", 600000) dev2 := newEmployee("Luke Lex", 600000) manager := newEmployee("Sarah Ting", 1200000) manager.subordinate = append(manager.subordinate, dev1) manager.subordinate = append(manager.subordinate, dev2) ceo := newEmployee("John Smith", 1800000) fmt.Printf("CEO: %v\n", ceo) fmt.Printf("Manager: %v\n", manager) fmt.Printf("Dev 1: %v\n", dev1) fmt.Printf("Dev 2: %v\n", dev2)}