From 856a7bc8e975d29b7c221264f8b0c62df2d60e42 Mon Sep 17 00:00:00 2001 From: Shulhan Date: Mon, 30 Dec 2024 17:10:57 +0700 Subject: [PATCH] builtin: use list instead of indentation for comments in cap, len, and make Using list make the document more readable in HTML and CLI. Change-Id: Ib84c84656f32806e8612b1ca13938d93f618e27f Reviewed-on: https://go-review.googlesource.com/c/go/+/639315 Reviewed-by: Dmitri Shuralyov LUCI-TryBot-Result: Go LUCI Reviewed-by: Ian Lance Taylor Auto-Submit: Ian Lance Taylor --- src/builtin/builtin.go | 48 +++++++++++++++++++++--------------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/src/builtin/builtin.go b/src/builtin/builtin.go index af01aea5dd..afa2a10f90 100644 --- a/src/builtin/builtin.go +++ b/src/builtin/builtin.go @@ -162,12 +162,12 @@ func delete(m map[Type]Type1, key Type) // The len built-in function returns the length of v, according to its type: // -// Array: the number of elements in v. -// Pointer to array: the number of elements in *v (even if v is nil). -// Slice, or map: the number of elements in v; if v is nil, len(v) is zero. -// String: the number of bytes in v. -// Channel: the number of elements queued (unread) in the channel buffer; -// if v is nil, len(v) is zero. +// - Array: the number of elements in v. +// - Pointer to array: the number of elements in *v (even if v is nil). +// - Slice, or map: the number of elements in v; if v is nil, len(v) is zero. +// - String: the number of bytes in v. +// - Channel: the number of elements queued (unread) in the channel buffer; +// if v is nil, len(v) is zero. // // For some arguments, such as a string literal or a simple array expression, the // result can be a constant. See the Go language specification's "Length and @@ -176,12 +176,12 @@ func len(v Type) int // The cap built-in function returns the capacity of v, according to its type: // -// Array: the number of elements in v (same as len(v)). -// Pointer to array: the number of elements in *v (same as len(v)). -// Slice: the maximum length the slice can reach when resliced; -// if v is nil, cap(v) is zero. -// Channel: the channel buffer capacity, in units of elements; -// if v is nil, cap(v) is zero. +// - Array: the number of elements in v (same as len(v)). +// - Pointer to array: the number of elements in *v (same as len(v)). +// - Slice: the maximum length the slice can reach when resliced; +// if v is nil, cap(v) is zero. +// - Channel: the channel buffer capacity, in units of elements; +// if v is nil, cap(v) is zero. // // For some arguments, such as a simple array expression, the result can be a // constant. See the Go language specification's "Length and capacity" section for @@ -194,18 +194,18 @@ func cap(v Type) int // argument, not a pointer to it. The specification of the result depends on // the type: // -// 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. 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. -// Channel: The channel's buffer is initialized with the specified -// buffer capacity. If zero, or the size is omitted, the channel is -// unbuffered. +// - 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. 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. +// - Channel: The channel's buffer is initialized with the specified +// buffer capacity. If zero, or the size is omitted, the channel is +// unbuffered. func make(t Type, size ...IntegerType) Type // The max built-in function returns the largest value of a fixed number of -- 2.48.1