To create a struct with a field of type pointer in Go, you can define a field with the * symbol, followed by the type you want the pointer to point to. Here's an example:
main.go170 chars13 lines
In this example, the Person struct has a field called Address which is defined as a pointer to the Address struct. This allows us to create a Person object and assign a different Address object to each person as needed.
gistlibby LogSnag