title: Why Golang object property of byte array will be wiped when assigned to another variable
body: <p>We need to wipe out some variables after use. But it seems really weird when it's assigned with a <code>[]byte</code> field in a struct. </p>
  
  <p>Why this assignment of <code>[]byte</code> is not a copy but a pointer? </p>
  
  <p>What should I do to keep the value in struct <code>a.bs</code>, but wipe out the <code>b</code> as local variable?
  <a href="http://play.golang.org/p/MT_wAHj2OM" rel="nofollow">http://play.golang.org/p/MT_wAHj2OM</a></p>
  
  <pre><code>package main
  
  import "fmt"
  
  type so struct {
      bs []byte
  }
  
  func zeroes(n int) []byte {
      return make([]byte, n)
  }
  
  func wipeBytes(b []byte) {
      copy(b, zeroes(len(b)))
  }
  
  
  func main() {
      a := so{bs: []byte{0x01, 0x02}}
      b := a.bs
      wipeBytes(b)
      fmt.Println(b)    //b == []byte{}
      fmt.Println(a.bs) //a.bs == []byte{}
  }
  </code></pre>