On 2016-07-03 20:35, mhhcbon wrote: > r :=buf.Bytes()// read from encoder > buf.Truncate(0)
I did not understand your explanation of the problem, but surely there is a bug in the code quoted above. Read bytes.Buffer Bytes() function documentation: func (b *Buffer) Bytes() []byte Bytes returns a slice of length b.Len() holding the unread portion of the buffer. The slice is valid for use only until the next buffer modification (that is, only until the next call to a method like Read, Write, Reset, or Truncate). The slice aliases the buffer content at least until the next buffer modification, so immediate changes to the slice will affect the result of future reads. Janne Snabb sn...@epipe.com -- 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.