Methods in Go

If you already have some programming experience (at least Python), you can understand it as method is something that you can apply on an instance of a class (object).

Method is a function but with receiver (such as struct).

In Go, pointer is denoted without * when used with struct or in method receiver etc -> you can directly reference it as p.username (if p is pointer to struct credentials)

Last updated

Was this helpful?