aboutsummaryrefslogtreecommitdiff
path: root/src/builtin
diff options
context:
space:
mode:
authorDaniel Martí <mvdan@mvdan.cc>2019-03-13 17:57:03 +0000
committerDaniel Martí <mvdan@mvdan.cc>2019-03-13 20:57:32 +0000
commit1a24bf10bc398d94bbdbb0c77b691e5840d343df (patch)
tree0f1627410d0081bbcceac5f94562d75afb1a4645 /src/builtin
parent6aa710f7231bd02eac4389579dc11bb7d9c1bdad (diff)
downloadgo-1a24bf10bc398d94bbdbb0c77b691e5840d343df.tar.gz
go-1a24bf10bc398d94bbdbb0c77b691e5840d343df.zip
builtin: make len's godoc less ambiguous
The len godoc uses a blockquote to list the rules for its semantics. The item that describes channels is a bit long, so it's split in two lines. However, the first line ends with a semicolon, and the second line can be read as a sentence of its own, so it's easy to misinterpret that the two lines are separate. Making that easy mistake would lead to an incorrect understanding of len: if v is nil, len(v) is zero. This could lead us to think that len(nil) is valid and should return zero. When in fact, that statement only applies to nil channels. To make this less ambiguous, add a bit of indentation to the follow-up line, to align with the channel body. If lists are added to godoc in the future via #7873, perhaps this text can be simplified. Fixes #30349. Change-Id: I84226edc812d429493137bcc65c332e92d4e6c87 Reviewed-on: https://go-review.googlesource.com/c/go/+/167403 Run-TryBot: Daniel Martí <mvdan@mvdan.cc> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Bryan C. Mills <bcmills@google.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Diffstat (limited to 'src/builtin')
-rw-r--r--src/builtin/builtin.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/builtin/builtin.go b/src/builtin/builtin.go
index c78fe09ea6..61ed6100b4 100644
--- a/src/builtin/builtin.go
+++ b/src/builtin/builtin.go
@@ -151,7 +151,7 @@ func delete(m map[Type]Type1, key Type)
// 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.
+// 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
// capacity" section for details.