title: Goroutine called in a loop on function with pointer overwrites value?
body: <p>I have just started playing with Go and stumbled upon problem how the pointers are handled in this language.</p>
  
  <p>I have such code and can`t figure out how to fix it to get the correct response. </p>
  
  <p>Changing <code>func (me *Str) Start()</code> to <code>func (me Str) Start()</code> fixes the problem, but I need this as reference to write this structure (it will have channel in it).</p>
  
  <p>Sample code (<a href="https://play.golang.org/p/EsPejyCrX7" rel="nofollow noreferrer">https://play.golang.org/p/EsPejyCrX7</a>):</p>
  
  <pre><code>package main
  
  import (
      "fmt"
      "sync"
  )
  
  var wg1 sync.WaitGroup
  
  type Str struct {
      id int
  }
  
  func (me *Str) Start() {
      wg1.Add(1)
      fmt.Println("F1 ", me)
      go me.startFn()
  }
  
  func (me *Str) startFn() {
      defer wg1.Done()
      fmt.Println("F2 ", me)
  }
  
  func main() {
      Fl2 := []Str{
          {1},
          {2},
          {3},
      }
  
      for _, fl := range Fl2 {
          fl.Start()
      }
      wg1.Wait()
  }
  </code></pre>
  
  <p>Response:</p>
  
  <pre><code>F1  &amp;{1}
  F1  &amp;{2}
  F1  &amp;{3}
  F2  &amp;{3}
  F2  &amp;{3}
  F2  &amp;{3}
  </code></pre>
  
  <p>Expected response (F2 can be random):</p>
  
  <pre><code>F1  &amp;{1}
  F1  &amp;{2}
  F1  &amp;{3}
  F2  &amp;{3}
  F2  &amp;{2}
  F2  &amp;{1}
  </code></pre>