refactor: FilterReadMeScripts (#8154 close #8150)

* refactor: FilterReadMeScripts

* .
This commit is contained in:
j2rong4cn
2025-03-18 22:02:33 +08:00
committed by GitHub
parent 3499c4db87
commit b4e6ab12d9
7 changed files with 51 additions and 98 deletions

View File

@ -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
}