From 953bb257cfa8d235e3bd8e59f0b405e2ade5a11e Mon Sep 17 00:00:00 2001 From: Sathesh Sivashanmugam Date: Wed, 12 Jan 2022 20:46:11 -0700 Subject: [PATCH] Updated example: changed the len to CompressBlockBound func to determine the buffer size so that the code can be used to determine buf length for any length of string. --- example_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/example_test.go b/example_test.go index 456163d5..bc449bc7 100644 --- a/example_test.go +++ b/example_test.go @@ -35,7 +35,7 @@ func Example() { func ExampleCompressBlock() { s := "hello world" data := []byte(strings.Repeat(s, 100)) - buf := make([]byte, len(data)) + buf := make([]byte, lz4.CompressBlockBound(len(data))) var c lz4.Compressor n, err := c.CompressBlock(data, buf)