aboutsummaryrefslogtreecommitdiff
path: root/src/bytes
diff options
context:
space:
mode:
authorErin Masatsugu <erin.masatsugu@gmail.com>2018-08-30 18:27:07 +0000
committerIan Lance Taylor <iant@golang.org>2018-08-30 19:10:14 +0000
commit5e755e9d6d9d5ab1268dc7c2d18a08b543d988c9 (patch)
tree4804097355c20190e0913bd1059eebfcc9b2ead3 /src/bytes
parent0dac1e2e8743476d266a00a81f8bd64400bd8065 (diff)
downloadgo-5e755e9d6d9d5ab1268dc7c2d18a08b543d988c9.tar.gz
go-5e755e9d6d9d5ab1268dc7c2d18a08b543d988c9.zip
bytes: add example for Buffer.Len
Change-Id: Ide50aba940727a7b32cd33dea5315050f1a34717 Reviewed-on: https://go-review.googlesource.com/132237 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'src/bytes')
-rw-r--r--src/bytes/example_test.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/bytes/example_test.go b/src/bytes/example_test.go
index 5b7a46058f..4d5cdfa280 100644
--- a/src/bytes/example_test.go
+++ b/src/bytes/example_test.go
@@ -39,6 +39,14 @@ func ExampleBuffer_Grow() {
// Output: "64 bytes or fewer"
}
+func ExampleBuffer_Len() {
+ var b bytes.Buffer
+ b.Grow(64)
+ b.Write([]byte("abcde"))
+ fmt.Printf("%d", b.Len())
+ // Output: 5
+}
+
func ExampleCompare() {
// Interpret Compare's result by comparing it to zero.
var a, b []byte