6 ms·
Oh I see, thanks for the clarification! Personally, I'm fine without that and with something like func Foo(r io.Reader) { var m MyStruct binary.R
by mrbadguy 2y ago
Oh I see, thanks for the clarification! Personally, I'm fine without that and with something like
func Foo(r io.Reader) {
var m MyStruct
binary.Read(r, binary.LittleEndian, &m)
}
but we may be operating in different contexts where the underlying copy is or isn't a problem. That said, depending on the implementation of the reader passed in, the bytes might be being streamed from elsewhere, in which case the copying is minimised.