aboutsummaryrefslogtreecommitdiff
path: root/src/builtin
AgeCommit message (Collapse)Author
2021-12-13all: gofmt -w -r 'interface{} -> any' srcRuss Cox
And then revert the bootstrap cmd directories and certain testdata. And adjust tests as needed. Not reverting the changes in std that are bootstrapped, because some of those changes would appear in API docs, and we want to use any consistently. Instead, rewrite 'any' to 'interface{}' in cmd/dist for those directories when preparing the bootstrap copy. A few files changed as a result of running gofmt -w not because of interface{} -> any but because they hadn't been updated for the new //go:build lines. Fixes #49884. Change-Id: Ie8045cba995f65bd79c694ec77a1b3d1fe01bb09 Reviewed-on: https://go-review.googlesource.com/c/go/+/368254 Trust: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> Reviewed-by: Robert Griesemer <gri@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org>
2021-12-03builtin: document "any" and "comparable"Ian Lance Taylor
Fixes #49927 Change-Id: I8b34cf13b3bc6338309f005648ca3ee6852927f0 Reviewed-on: https://go-review.googlesource.com/c/go/+/368954 Trust: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: Robert Griesemer <gri@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org>
2019-04-05builtin: spec correction for panic()Darren Grant
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-03-13builtin: make len's godoc less ambiguousDaniel Martí
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>
2018-09-18builtin: document when len and cap are constantRob Pike
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>
2017-11-18builtin: improve docs for make sliceIan Lance Taylor
Fixes #22764 Change-Id: I339d3bbb08983e0d69d69a1d00c4d15d0661762a Reviewed-on: https://go-review.googlesource.com/78335 Reviewed-by: Rob Pike <r@golang.org>
2017-06-07builtin: use type aliases for rune and byteBrad Fitzpatrick
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-05-13builtin: fix signature of the builtin function makeBrad Fitzpatrick
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>
2016-09-10builtin: clarify that make(map[K]V, n) allocates space for n elementsIan Lance Taylor
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>
2015-06-28builtin: remove errant space in hyphenated adjective phraseBrad Fitzpatrick
Change-Id: I67947e0e3189093e830120941ee49f9f32086f0e Reviewed-on: https://go-review.googlesource.com/11615 Reviewed-by: Rob Pike <r@golang.org>
2014-09-08build: move package sources from src/pkg to srcRuss Cox
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.