You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is doable by calling thing.reader.Reset(r) however I also need to use (*reader).Peek but I can't specify the size.
So instead I write: thing.reader = *bufio.NewReaderWithSize(r, maximumBlockSize) which feels wrong.
Proposal:
// ResetWithSize is like [Reset] but it will allocate a new buffer if the current buffer is smaller than required.func (*Reader) ResetWithSize(r io.Reader, sizeint)
Potential implementation:
// ResetWithSize is like [Reset] but it will allocate a new buffer if the current buffer is smaller than required.func (b*Reader) ResetWithSize(r io.Reader, sizeint) {
iflen(b.buf) <size {
b.buf=make([]byte, size)
}
b.reset(r)
}