Re: [go-nuts] confused about string allocation
Ian Lance Taylor wrote: > On Sat, Jul 9, 2016 at 4:38 PM, Erich Rickheit KSC > wrote: > > I found myself writing code like this: > > > > s := make([]byte, len) > > for i := 0; i < len; i++ { > > // fill in s with stringy go
[go-nuts] confused about string allocation
I found myself writing code like this: s := make([]byte, len) for i := 0; i < len; i++ { // fill in s with stringy goodness } return string(s) Does this reuse the memory in s for the string, or does it allocate new memory and copy? Or does escape an