[chore]: Bump codeberg.org/gruf/go-byteutil from 1.1.2 to 1.2.0 (#2389)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
This commit is contained in:
parent
66b77acb1c
commit
1fa206c230
2
go.mod
2
go.mod
|
@ -6,7 +6,7 @@ toolchain go1.21.3
|
||||||
|
|
||||||
require (
|
require (
|
||||||
codeberg.org/gruf/go-bytesize v1.0.2
|
codeberg.org/gruf/go-bytesize v1.0.2
|
||||||
codeberg.org/gruf/go-byteutil v1.1.2
|
codeberg.org/gruf/go-byteutil v1.2.0
|
||||||
codeberg.org/gruf/go-cache/v3 v3.5.6
|
codeberg.org/gruf/go-cache/v3 v3.5.6
|
||||||
codeberg.org/gruf/go-debug v1.3.0
|
codeberg.org/gruf/go-debug v1.3.0
|
||||||
codeberg.org/gruf/go-errors/v2 v2.2.0
|
codeberg.org/gruf/go-errors/v2 v2.2.0
|
||||||
|
|
4
go.sum
4
go.sum
|
@ -44,8 +44,8 @@ codeberg.org/gruf/go-bytes v1.0.2 h1:malqE42Ni+h1nnYWBUAJaDDtEzF4aeN4uPN8DfMNNvo
|
||||||
codeberg.org/gruf/go-bytes v1.0.2/go.mod h1:1v/ibfaosfXSZtRdW2rWaVrDXMc9E3bsi/M9Ekx39cg=
|
codeberg.org/gruf/go-bytes v1.0.2/go.mod h1:1v/ibfaosfXSZtRdW2rWaVrDXMc9E3bsi/M9Ekx39cg=
|
||||||
codeberg.org/gruf/go-bytesize v1.0.2 h1:Mo+ITi+0uZ4YNSZf2ed6Qw8acOI39W4mmgE1a8lslXw=
|
codeberg.org/gruf/go-bytesize v1.0.2 h1:Mo+ITi+0uZ4YNSZf2ed6Qw8acOI39W4mmgE1a8lslXw=
|
||||||
codeberg.org/gruf/go-bytesize v1.0.2/go.mod h1:n/GU8HzL9f3UNp/mUKyr1qVmTlj7+xacpp0OHfkvLPs=
|
codeberg.org/gruf/go-bytesize v1.0.2/go.mod h1:n/GU8HzL9f3UNp/mUKyr1qVmTlj7+xacpp0OHfkvLPs=
|
||||||
codeberg.org/gruf/go-byteutil v1.1.2 h1:TQLZtTxTNca9xEfDIndmo7nBYxeS94nrv/9DS3Nk5Tw=
|
codeberg.org/gruf/go-byteutil v1.2.0 h1:YoxkpUOoHS82BcPXfiIcWLe/YhS8QhpNUHdfuhN09QM=
|
||||||
codeberg.org/gruf/go-byteutil v1.1.2/go.mod h1:cWM3tgMCroSzqoBXUXMhvxTxYJp+TbCr6ioISRY5vSU=
|
codeberg.org/gruf/go-byteutil v1.2.0/go.mod h1:cWM3tgMCroSzqoBXUXMhvxTxYJp+TbCr6ioISRY5vSU=
|
||||||
codeberg.org/gruf/go-cache/v3 v3.5.6 h1:TJnNOuij5DF/ZK9pDB61SlYzxidRQeYjYYW3dfFSznc=
|
codeberg.org/gruf/go-cache/v3 v3.5.6 h1:TJnNOuij5DF/ZK9pDB61SlYzxidRQeYjYYW3dfFSznc=
|
||||||
codeberg.org/gruf/go-cache/v3 v3.5.6/go.mod h1:NbsGQUgEdNFd631WSasvCHIVAaY9ovuiSeoBwtsIeDc=
|
codeberg.org/gruf/go-cache/v3 v3.5.6/go.mod h1:NbsGQUgEdNFd631WSasvCHIVAaY9ovuiSeoBwtsIeDc=
|
||||||
codeberg.org/gruf/go-debug v1.3.0 h1:PIRxQiWUFKtGOGZFdZ3Y0pqyfI0Xr87j224IYe2snZs=
|
codeberg.org/gruf/go-debug v1.3.0 h1:PIRxQiWUFKtGOGZFdZ3Y0pqyfI0Xr87j224IYe2snZs=
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
MIT License
|
MIT License
|
||||||
|
|
||||||
Copyright (c) 2022 gruf
|
Copyright (c) gruf
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,8 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
// ensure we conform to interfaces.
|
// ensure we conform
|
||||||
|
// to interfaces.
|
||||||
_ interface {
|
_ interface {
|
||||||
io.Writer
|
io.Writer
|
||||||
io.ByteWriter
|
io.ByteWriter
|
||||||
|
@ -15,6 +16,8 @@ var (
|
||||||
io.StringWriter
|
io.StringWriter
|
||||||
io.WriterAt
|
io.WriterAt
|
||||||
WriteStringAt(string, int64) (int, error)
|
WriteStringAt(string, int64) (int, error)
|
||||||
|
io.ReaderFrom
|
||||||
|
io.WriterTo
|
||||||
} = (*Buffer)(nil)
|
} = (*Buffer)(nil)
|
||||||
|
|
||||||
// ErrBeyondBufferLen is returned if .WriteAt() is attempted beyond buffer length.
|
// ErrBeyondBufferLen is returned if .WriteAt() is attempted beyond buffer length.
|
||||||
|
@ -81,6 +84,43 @@ func (buf *Buffer) WriteStringAt(s string, start int64) (int, error) {
|
||||||
return copy(buf.B[start:], s), nil
|
return copy(buf.B[start:], s), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ReadFrom will read bytes from reader into buffer, fulfilling io.ReaderFrom.
|
||||||
|
func (buf *Buffer) ReadFrom(r io.Reader) (int64, error) {
|
||||||
|
var nn int64
|
||||||
|
|
||||||
|
// Ensure there's cap
|
||||||
|
// for a first read.
|
||||||
|
buf.Guarantee(512)
|
||||||
|
|
||||||
|
for {
|
||||||
|
// Read into next chunk of buffer.
|
||||||
|
n, err := r.Read(buf.B[len(buf.B):cap(buf.B)])
|
||||||
|
|
||||||
|
// Reslice buf + update count.
|
||||||
|
buf.B = buf.B[:len(buf.B)+n]
|
||||||
|
nn += int64(n)
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
if err == io.EOF {
|
||||||
|
// mask EOF.
|
||||||
|
err = nil
|
||||||
|
}
|
||||||
|
return nn, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(buf.B) == cap(buf.B) {
|
||||||
|
// Add capacity (let append pick).
|
||||||
|
buf.B = append(buf.B, 0)[:len(buf.B)]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// WriteTo will write bytes from buffer into writer, fulfilling io.WriterTo.
|
||||||
|
func (buf *Buffer) WriteTo(w io.Writer) (int64, error) {
|
||||||
|
n, err := w.Write(buf.B)
|
||||||
|
return int64(n), err
|
||||||
|
}
|
||||||
|
|
||||||
// Len returns the length of the buffer's underlying byte slice.
|
// Len returns the length of the buffer's underlying byte slice.
|
||||||
func (buf *Buffer) Len() int {
|
func (buf *Buffer) Len() int {
|
||||||
return len(buf.B)
|
return len(buf.B)
|
||||||
|
|
|
@ -10,7 +10,7 @@ codeberg.org/gruf/go-bytes
|
||||||
# codeberg.org/gruf/go-bytesize v1.0.2
|
# codeberg.org/gruf/go-bytesize v1.0.2
|
||||||
## explicit; go 1.17
|
## explicit; go 1.17
|
||||||
codeberg.org/gruf/go-bytesize
|
codeberg.org/gruf/go-bytesize
|
||||||
# codeberg.org/gruf/go-byteutil v1.1.2
|
# codeberg.org/gruf/go-byteutil v1.2.0
|
||||||
## explicit; go 1.16
|
## explicit; go 1.16
|
||||||
codeberg.org/gruf/go-byteutil
|
codeberg.org/gruf/go-byteutil
|
||||||
# codeberg.org/gruf/go-cache/v3 v3.5.6
|
# codeberg.org/gruf/go-cache/v3 v3.5.6
|
||||||
|
|
Loading…
Reference in New Issue