1
0
mirror of https://github.com/golang/go synced 2024-09-25 07:20:12 -06:00
Commit Graph

9 Commits

Author SHA1 Message Date
Darren Grant
f947c4dcfe builtin: spec correction for panic()
Upon unrecovered panic and program termination, process exit code is hard-coded
to 2, not set to the parameter passed to panic().

Change-Id: If64b75493227b4fd69c0bbb529f84e6df2d1b93f
Reviewed-on: https://go-review.googlesource.com/c/go/+/167709
Reviewed-by: Robert Griesemer <gri@golang.org>
2019-04-05 00:52:55 +00:00
Daniel Martí
1a24bf10bc 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>
2019-03-13 20:57:32 +00:00
Rob Pike
37db664c6c builtin: document when len and cap are constant
The rules are subtle, but under some circumstances the result
can be constant. Mention this and refer to the appropriate
section of the specification.

Fixes #27588.

Change-Id: I4beaad036db87501378fb2ef48d216742d096933
Reviewed-on: https://go-review.googlesource.com/135519
Reviewed-by: Robert Griesemer <gri@golang.org>
2018-09-18 21:52:11 +00:00
Ian Lance Taylor
ce68e1b81c builtin: improve docs for make slice
Fixes #22764

Change-Id: I339d3bbb08983e0d69d69a1d00c4d15d0661762a
Reviewed-on: https://go-review.googlesource.com/78335
Reviewed-by: Rob Pike <r@golang.org>
2017-11-18 01:48:52 +00:00
Brad Fitzpatrick
703a9baf5c builtin: use type aliases for rune and byte
As motivated by https://golang.org/design/18130-type-alias which says:

https://github.com/golang/proposal/blob/master/design/18130-type-alias.md#relationship-to-byte-and-rune

> The language specification already defines byte as an alias for
> uint8 and similarly rune as an alias for int32, using the word alias
> as an informal term. It is a goal that the new type declaration
> semantics not introduce a different meaning for alias. That is, it
> should be possible to describe the existing meanings of byte and
> uint8 by saying that they behave as if predefined by:
>
>     type byte = uint8
>     type rune = int32

So, do that. Seems to work.

Updates #18130

Change-Id: I0740bab3f8fb23e946f3542fdbe819007a99465a
Reviewed-on: https://go-review.googlesource.com/45017
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-06-07 00:42:59 +00:00
Brad Fitzpatrick
1fcd7861e3 builtin: fix signature of the builtin function make
Fixes #20325

Change-Id: Ie363fef73d0deae40af41ee3f4403ad18546eba6
Reviewed-on: https://go-review.googlesource.com/43460
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2017-05-13 16:16:48 +00:00
Ian Lance Taylor
ca993d6797 builtin: clarify that make(map[K]V, n) allocates space for n elements
Change-Id: Id6265b6093edaa4be2c59e4799351082f7228b5d
Reviewed-on: https://go-review.googlesource.com/28815
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
2016-09-10 12:57:37 +00:00
Brad Fitzpatrick
d0ed87d15c builtin: remove errant space in hyphenated adjective phrase
Change-Id: I67947e0e3189093e830120941ee49f9f32086f0e
Reviewed-on: https://go-review.googlesource.com/11615
Reviewed-by: Rob Pike <r@golang.org>
2015-06-28 21:41:38 +00:00
Russ Cox
c007ce824d build: move package sources from src/pkg to src
Preparation was in CL 134570043.
This CL contains only the effect of 'hg mv src/pkg/* src'.
For more about the move, see golang.org/s/go14nopkg.
2014-09-08 00:08:51 -04:00