Go spec says:
The method set of any other type T consists of all methods with receiver type T. The method set of the corresponding pointer type *T is
You cannot call a method of *T on T, but the compiler is smart enough to take the reference of the variable for you, effectively calling
(&user).SayWat()
This is explained here:
Calls: A method call x.m() is valid if the method set of (the type of) x contains m and the argument list can be assigned to the parameter list of m. If x is addressable and &x's method set contains m, x.m() is shorthand for (&x).m().
To understand the difference, you can for instance take a return value (non-addressable):
func aUser() User {
return User{}
}
...
aUser().SayWat()
Fails with error:
prog.go:40: cannot call pointer method on aUser()
prog.go:40: cannot take the address of aUser()
http://play.golang.org/p/HOTKiiOK7S