'Location of methods in memory [duplicate]

I am new in Go world, the question could be obvious.

Let's say I have a struct Example, which has some methods:

type Example struct {}

func (e *Example) M1() {
  //do smth
}

func (e *Example) M2() {
  //do smth
}

func (e *Example) M3() {
  //do smth
}

I'm declaring a variable of type Example and want to pass it to another function.

func F1(example Example) {
  //do smth
}

How to determine whether I should pass the variable to another function by reference or by value? How are functions and methods located in memory?

Could you please share some articles or best practices?

Thanks a lot!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source