I am new of Go, and pretty curious of structs. Let's define a struct T
type T struct {
size int
}
-
I have seen different types of struct initialization. What are the differences?
new(T) // 1 T{size:1} // 2 &T{size:1} // 3
-
And the two types of method declarations:
func (r *T) area() int // 1 func (r T) area() int // 2
What should be the right way?