Thanks!!! Very helpful blog post!! So, in proc, the slice header is copied, then an entirely new array is created - []byte{5,6,7,8} - and the slice header copy is set to point at that new array, and then discarded, whereas in proc 2, the slice header is not reset, and so still points to the original array?
On Thursday, January 4, 2018 at 1:23:33 PM UTC-5, Jan Mercl wrote: > > On Thu, Jan 4, 2018 at 7:08 PM Frank Davidson <ffdav...@gmail.com > <javascript:>> wrote: > > > I'm sure this has probably been answered before, but I have a question > about when a slice's underlying array is copied? In this code: > > In your code the underlying arrays are never copied when passed around. > > > > -- > > -j > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.