The terminology we would generally use is '*dog' is a pointer, not a "type address".
The difference really has nothing to do with structs, but is the difference between a value and a pointer to a value. If you understand pointers in general, then this more complicated case will make sense. I suggest searching "pointers in go explained", which will give you a number of tutorials that explain pointers. In this case, the biggest difference is that each instance of B will always contain its own 'dog' value, but instances of A may share a 'dog' value, if d points to the same 'dog' value. Seehttps://go.dev/play/p/NlSsMc8b7To for a demonstration. On Sunday, August 28, 2022 at 6:56:30 AM UTC-4 mandel...@gmail.com wrote: > the difference between type and type address in struct > type dog struct { > age int > name string > } > type A struct { > d *dog > } > type B struct { > d dog > } > the difference between struct A and struct B. > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/2ea28cbb-7a3c-457d-a461-0f52a1a26866n%40googlegroups.com.