3 ms·
> is that bytes.Reader implies a copy Yes, that's what "smelled" wrong to me too. Is it avoidable or does Go's stdlib force you to go through xxx.Reader readin
by nottorp 1y ago
> is that bytes.Reader implies a copy
Yes, that's what "smelled" wrong to me too. Is it avoidable or does Go's stdlib force you to go through xxx.Reader reading from yyy.Reader that is made from a zzz.Reader and a ttt.Reader?
- masklinn 1y agoUnless you know the concrete reader types and they expose their underlying reader or concrete type, short of unsafe yes. And as the essay points out, neither bytes.Reader nor bufio.Reader expose the underlying type.
- mholt 1y agoThere's io.ReaderFrom and io.WriterTo, which can avoid internal buffering.