[chore] Update all but bun libraries (#526)

* update all but bun libraries

Signed-off-by: kim <grufwub@gmail.com>

* remove my personal build script changes

Signed-off-by: kim <grufwub@gmail.com>
This commit is contained in:
kim
2022-05-02 14:05:18 +01:00
committed by GitHub
parent e06bf9cc9a
commit b56dae8120
350 changed files with 305366 additions and 5943 deletions

View File

@ -1,14 +1,29 @@
package buffer
import (
"io"
)
// Writer implements an io.Writer over a byte slice.
type Writer struct {
buf []byte
buf []byte
err error
expand bool
}
// NewWriter returns a new Writer for a given byte slice.
func NewWriter(buf []byte) *Writer {
return &Writer{
buf: buf,
buf: buf,
expand: true,
}
}
// NewStaticWriter returns a new Writer for a given byte slice. It does not reallocate and expand the byte-slice.
func NewStaticWriter(buf []byte) *Writer {
return &Writer{
buf: buf,
expand: false,
}
}
@ -17,6 +32,10 @@ func (w *Writer) Write(b []byte) (int, error) {
n := len(b)
end := len(w.buf)
if end+n > cap(w.buf) {
if !w.expand {
w.err = io.EOF
return 0, io.EOF
}
buf := make([]byte, end, 2*cap(w.buf)+n)
copy(buf, w.buf)
w.buf = buf
@ -39,3 +58,8 @@ func (w *Writer) Bytes() []byte {
func (w *Writer) Reset() {
w.buf = w.buf[:0]
}
// Close returns the last error.
func (w *Writer) Close() error {
return w.err
}