A method is basically a function that you attach to a type

Define a person struct types.

type Person struct{
   name string
   age int

 attach a method to that type like this

func (p Person) GetName() string{
return p.name

The part between the func keyword and the function name, GetName(), is known as the receiver of the method.

Declare a value of type Person

var p = Person{
  name: "Jason",
  age: 29,

 Invoke the GetName method of value p