Skip to content

Commit 1f9a408

Browse files
committed
fix: var name
1 parent 25e5ea8 commit 1f9a408

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

buffer.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ func (f FlushFunc[T]) Flush(elements []T) error {
3535
}
3636

3737
// DefaultErrHandler prints error and the size of elements to stderr.
38-
func DefaultErrHandler[T any](err error, flat []T) {
38+
func DefaultErrHandler[T any](err error, elements []T) {
3939
fmt.Fprintf(
4040
os.Stderr,
41-
"async-buffer: error while flushing error = %v, backup size = %d\n", err, len(flat))
41+
"async-buffer: error while flushing error = %v, backup size = %d\n", err, len(elements))
4242
}
4343

4444
// Option for New the buffer.
@@ -56,7 +56,7 @@ type Option[T any] struct {
5656
// There is automatic flushing if zero FlushInterval.
5757
FlushInterval time.Duration
5858
// ErrHandler handles errors, print error and the size of elements to stderr in default.
59-
ErrHandler func(error, []T)
59+
ErrHandler func(err error, elements []T)
6060
}
6161

6262
// Buffer represents an async buffer.
@@ -205,13 +205,13 @@ func (b *Buffer[T]) run() {
205205
}
206206
}
207207

208-
func (b *Buffer[T]) internalFlush(ts []T) {
209-
if len(ts) == 0 {
208+
func (b *Buffer[T]) internalFlush(elements []T) {
209+
if len(elements) == 0 {
210210
return
211211
}
212212

213-
flat := make([]T, len(ts))
214-
copy(flat, ts)
213+
flat := make([]T, len(elements))
214+
copy(flat, elements)
215215

216216
done := make(chan struct{}, 1)
217217
go func() {

0 commit comments

Comments
 (0)