move all the buffer references to util/buf
This commit is contained in:
21
util/buf/buf.go
Normal file
21
util/buf/buf.go
Normal file
@@ -0,0 +1,21 @@
|
||||
package buf
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
)
|
||||
|
||||
type buffer struct {
|
||||
*bytes.Buffer
|
||||
}
|
||||
|
||||
func (b *buffer) Close() error {
|
||||
b.Buffer.Reset()
|
||||
return nil
|
||||
}
|
||||
|
||||
func New(b *bytes.Buffer) *buffer {
|
||||
if b == nil {
|
||||
b = bytes.NewBuffer(nil)
|
||||
}
|
||||
return &buffer{b}
|
||||
}
|
Reference in New Issue
Block a user