* refactor: FilterReadMeScripts * .
This commit is contained in:
@ -619,10 +619,9 @@ type Buf struct {
|
||||
// NewBuf is a buffer that can have 1 read & 1 write at the same time.
|
||||
// when read is faster write, immediately feed data to read after written
|
||||
func NewBuf(ctx context.Context, maxSize int) *Buf {
|
||||
d := make([]byte, 0, maxSize)
|
||||
return &Buf{
|
||||
ctx: ctx,
|
||||
buffer: bytes.NewBuffer(d),
|
||||
buffer: bytes.NewBuffer(make([]byte, 0, maxSize)),
|
||||
size: maxSize,
|
||||
}
|
||||
}
|
||||
@ -677,5 +676,5 @@ func (br *Buf) Write(p []byte) (n int, err error) {
|
||||
}
|
||||
|
||||
func (br *Buf) Close() {
|
||||
br.buffer.Reset()
|
||||
br.buffer = nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user