I've been looking in many, many places and I couldn't find any satisfying answer for my question: what is the benefit of using pointers to nested structs in Go?
Currently I am total newbie in Go, I started reading a book "Go programming language" and I do every excerice there to make sure I understand the syntax and use case. Until now. The goal of one of tasks was to create very simple GitHub client that retrieves a list of issues filtered by given params. It's an example showing how to use json unmarshalling. So there are some nested structs:
type SearchIssueResult {
TotalCount int
Issues []*Issue
}
type Issue {
Title string
Author *User
// ... other properties
}
And here's my question again: Why these nested structs have type of pointers to structs? I can use just struct type and it works as well (with slight modifications in usage of struct's instance) but I would like to understand when to use different approaches.
Thanks!