title: Why can't I duplicate a slice with `copy()`?
body: <p>I need to make a copy of a slice in Go and reading the docs there is a <a href="http://golang.org/pkg/builtin/#copy" rel="noreferrer">copy</a> function at my disposal. </p>
  
  <blockquote>
    <p>The copy built-in function copies elements from a source slice into a
    destination slice. (As a special case, it also will copy bytes from a
    string to a slice of bytes.) The source and destination may overlap.
    Copy returns the number of elements copied, which will be the minimum
    of len(src) and len(dst).</p>
  </blockquote>
  
  <p>But when I do:</p>
  
  <pre><code>arr := []int{1, 2, 3}
  tmp := []int{}
  copy(tmp, arr)
  fmt.Println(tmp)
  fmt.Println(arr)
  </code></pre>
  
  <p>My <code>tmp</code> is empty as it was before (I even tried to use <code>arr, tmp</code>):</p>
  
  <pre><code>[]
  [1 2 3]
  </code></pre>
  
  <p>You can check it on go <a href="https://play.golang.org/p/iE6TarF8-S" rel="noreferrer">playground</a>. So why can not I copy a slice?</p>