Let's say I have the following code
//var mystruct *MyStruct // method 1
//var mystruct MyStruct // method 2
type MyStruct struct {
// struct fields
}
I understand the basic differences between method 1 and method 2 in terms of declaring the mystruct variable. Both of them requires allocating the same amount of memory and the first method requires an additional pointer. The first method allocates memory on heap and the second method allocates on stack. I imagine the first method is preferred if stack memory can be under pressure.
Does it have any other practical differences between these two ways of declaring a struct variable as a global variable within the package?