Skip to content

Commit 9df2015

Browse files
authored
Fix readme examples by using the right interface
1 parent 612b799 commit 9df2015

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,11 @@ func main() {
3838
// buffer can hold up to 5 items
3939
buffer.WithSize(5),
4040
// call this function when the buffer needs flushing
41-
buffer.WithFlusher(func(items []interface{}) {
41+
buffer.WithFlusher(buffer.FlusherFunc(func(items []interface{}) {
4242
for _, item := range items {
4343
println(item.(string))
4444
}
45-
}),
45+
})),
4646
)
4747
// ensure the buffer
4848
defer buff.Close()
@@ -54,7 +54,7 @@ func main() {
5454
buff.Push("item 5")
5555

5656
// block the current goroutine
57-
time.Sleep(3*time.Second)
57+
time.Sleep(3 * time.Second)
5858

5959
println("done")
6060
}
@@ -79,11 +79,11 @@ func main() {
7979
// how many items were pushed
8080
buffer.WithFlushInterval(time.Second),
8181
// call this function when the buffer needs flushing
82-
buffer.WithFlusher(func(items []interface{}) {
82+
buffer.WithFlusher(buffer.FlusherFunc(func(items []interface{}) {
8383
for _, item := range items {
8484
println(item.(string))
8585
}
86-
}),
86+
})),
8787
)
8888
defer buff.Close()
8989

@@ -92,7 +92,7 @@ func main() {
9292
buff.Push("item 3")
9393

9494
// block the current goroutine
95-
time.Sleep(3*time.Second)
95+
time.Sleep(3 * time.Second)
9696

9797
println("done")
9898
}
@@ -114,11 +114,11 @@ func main() {
114114
// buffer can hold up to 5 items
115115
buffer.WithSize(5),
116116
// call this function when the buffer needs flushing
117-
buffer.WithFlusher(func(items []interface{}) {
117+
buffer.WithFlusher(buffer.FlusherFunc(func(items []interface{}) {
118118
for _, item := range items {
119119
println(item.(string))
120120
}
121-
}),
121+
})),
122122
)
123123
defer buff.Close()
124124

0 commit comments

Comments
 (0)