Hacker News new | ask | show | jobs
by ainar-g 3845 days ago
It shouldn't. The method you're calling takes a pointer receiver, and the Go Spec[1] says:

>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()

In other words, if a type T no method M, it will look for M in *T's methods.

[1] https://golang.org/ref/spec#Calls