title: Slicing a slice pointer passed as argument
body: <p>I have the following code:</p>
  
  <pre><code>func main() {
      var buf []byte{1, 2, 3, 4, 5}
      buf = buf[2:]
      fmt.Println(buf)
      panic(1)
  }
  </code></pre>
  
  <p>However I want to pass a pointer to <code>buf</code> byte slice to another function, and slice it there, so something like:</p>
  
  <pre><code>func main() {
      var buf []byte{1, 2, 3, 4, 5}
      sliceArr(&amp;buf, 2)
      fmt.Println(buf)
      panic(1)
  }
  
  func sliceArr(buf *[]byte, i int) {
      *buf = *buf[i:]
  }
  </code></pre>
  
  <p>It gives me an error that I cannot use type <code>[]byte</code> as type <code>*[]byte</code> in argument to <code>sliceArr()</code> function, and that I cannot slice type <code>*[]byte</code>. What's wrong? Aren't slices passed by reference by default? I tried to do this without a pointer but it doesn't work - the array is being copied. How can I do this?</p>