From 02a2e42fbb239e6a3366fd53c75083402de0d33d Mon Sep 17 00:00:00 2001 From: Nicholas Sun Date: Fri, 29 Oct 2021 10:37:17 -0700 Subject: [PATCH] README.md: Don't print excess characters in example --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 6f077f810..57ffdf5f5 100644 --- a/README.md +++ b/README.md @@ -118,11 +118,11 @@ batch := conn.ReadBatch(10e3, 1e6) // fetch 10KB min, 1MB max b := make([]byte, 10e3) // 10KB max per message for { - _, err := batch.Read(b) + n, err := batch.Read(b) if err != nil { break } - fmt.Println(string(b)) + fmt.Println(string(b[:n])) } if err := batch.Close(); err != nil {