W dniu wtorek, 30 sierpnia 2016 05:30:48 UTC+2 użytkownik [email protected] 
napisał:
>
> How to efficiently create a new []byte slice that's not shared?
> The simple way I can think of is to []byte(string(bytes)).
>

Alternatively, I'd expect the following should work:

  outChannel <- append([]byte(nil), scanner.Bytes()...)
  // or:
  outChannel <- append([]byte{}, scanner.Bytes()...)

though as to efficiency, I can't say much.

/M.

-- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to