/* * Go is value model, so structs are deep copy!!! * @author gtowell * Created: Aug 19, 2021 */ package main import "fmt" type AA struct { a1 int } type BB struct { aa AA b1 int } func main() { b1 := BB{AA{1}, 1} b2 := b1 b2.aa.a1 = 7 fmt.Printf("B1 %v\n", b1) fmt.Printf("B2 %v\n", b2) }