From ce68e1b81c470ef29ece6a33980ab05e2b8bb30c Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Thu, 16 Nov 2017 09:35:31 -0800 Subject: [PATCH] builtin: improve docs for make slice Fixes #22764 Change-Id: I339d3bbb08983e0d69d69a1d00c4d15d0661762a Reviewed-on: https://go-review.googlesource.com/78335 Reviewed-by: Rob Pike --- src/builtin/builtin.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/builtin/builtin.go b/src/builtin/builtin.go index 1c7c041d680..4578c855a9e 100644 --- a/src/builtin/builtin.go +++ b/src/builtin/builtin.go @@ -171,8 +171,9 @@ func cap(v Type) int // Slice: The size specifies the length. The capacity of the slice is // equal to its length. A second integer argument may be provided to // specify a different capacity; it must be no smaller than the -// length, so make([]int, 0, 10) allocates a slice of length 0 and -// capacity 10. +// length. For example, make([]int, 0, 10) allocates an underlying array +// of size 10 and returns a slice of length 0 and capacity 10 that is +// backed by this underlying array. // Map: An empty map is allocated with enough space to hold the // specified number of elements. The size may be omitted, in which case // a small starting size is allocated.