aboutsummaryrefslogtreecommitdiff
path: root/doc/go_spec.html
AgeCommit message (Collapse)Author
6 daysspec: move rule for type parameters up in section of range clauseRobert Griesemer
Make the rule for range expressions of type parameter type more visible by moving it up (it was easily missed before as it was at the end of the example section). Add a corresponding example to the examples. Per suggestion from @adonovan. Change-Id: I8527e69ecc7d0110554ba00f4c30829f7d260d41 Reviewed-on: https://go-review.googlesource.com/c/go/+/764921 Auto-Submit: Robert Griesemer <gri@google.com> Reviewed-by: Robert Griesemer <gri@google.com> TryBot-Bypass: Robert Griesemer <gri@google.com> Reviewed-by: Alan Donovan <adonovan@google.com>
6 daysspec: fix prose in Instantiatons sectionRobert Griesemer
For #77273. Change-Id: Idf5b81f77115e4e30921476f7424769fdf604ef4 Reviewed-on: https://go-review.googlesource.com/c/go/+/764920 Reviewed-by: Alan Donovan <adonovan@google.com> TryBot-Bypass: Robert Griesemer <gri@google.com> Auto-Submit: Robert Griesemer <gri@google.com> Reviewed-by: Robert Griesemer <gri@google.com>
8 daysspec: add syntax and prose for generic methodsRobert Griesemer
For #77273. Change-Id: I600cfd6209cf77d07c18a94ac1126da1c0ba9fab Reviewed-on: https://go-review.googlesource.com/c/go/+/759880 Reviewed-by: Robert Griesemer <gri@google.com> Auto-Submit: Robert Griesemer <gri@google.com> TryBot-Bypass: Robert Griesemer <gri@google.com> Reviewed-by: Mark Freeman <markfreeman@google.com>
14 daysspec: in range-over-func, the yield function cannot be variadicRobert Griesemer
Be explicit about it. For #78483. For #78314. Change-Id: I9dc65d72ec7840a73c21869a8ca26dfeed17ad61 Reviewed-on: https://go-review.googlesource.com/c/go/+/761701 Reviewed-by: Jakub Ciolek <jakub@ciolek.dev> TryBot-Bypass: Robert Griesemer <gri@google.com> Auto-Submit: Robert Griesemer <gri@google.com> Reviewed-by: Robert Griesemer <gri@google.com> Reviewed-by: Alan Donovan <adonovan@google.com>
2026-03-24spec: s/defined/declared/ in a handful of places (cleanup)Robert Griesemer
Use "declared" rather than "defined" where referring to a declaration (rather than a type definition) is more appropriate. Change-Id: I691b55e05fcdce489e45286c7a88cbd992e80e57 Reviewed-on: https://go-review.googlesource.com/c/go/+/757121 Auto-Submit: Robert Griesemer <gri@google.com> Reviewed-by: Alan Donovan <adonovan@google.com> Reviewed-by: Robert Griesemer <gri@google.com> TryBot-Bypass: Robert Griesemer <gri@google.com>
2026-03-24spec: predeclared types are named, not defined typesRobert Griesemer
We want the predeclared types (excluding any) to have unique identity. Originally (Go 1.0), the only types with unique identity were named types (and they happened to have names). When we introduced alias declarations, we changed the terminology and called named types (old) defined types (new). With this change, the predeclared types became defined types. When we introduced type parameters, we re-introduced the notion of a named type as the (new-again) umbrella term for types with a unique identity. But we didn't adjust the spec for predeclared types - we kept calling them defined types. Fix this by completing the terminology transition. Also, clarify that the predeclared type `any` is not a named type. Fixes #78208. Change-Id: I13c2b8faa35e2b51958097872b1529c2aaf42c4e Reviewed-on: https://go-review.googlesource.com/c/go/+/757120 Reviewed-by: Robert Griesemer <gri@google.com> Auto-Submit: Robert Griesemer <gri@google.com> Reviewed-by: Alan Donovan <adonovan@google.com> TryBot-Bypass: Robert Griesemer <gri@google.com>
2026-03-16spec: fix prose in rule for keys of struct composite literalsRobert Griesemer
Use "promoted" rather than "embedded" because the selector provides access to a promoted field. For #9859. Change-Id: If62c5260ab7bdfef3d6ea4ff770543ad668ac9b6 Reviewed-on: https://go-review.googlesource.com/c/go/+/755782 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Robert Griesemer <gri@google.com> Auto-Submit: Robert Griesemer <gri@google.com> Reviewed-by: Alan Donovan <adonovan@google.com>
2026-03-05spec: permit keys denoting embedded fields in struct literalsRobert Griesemer
For #9859. Change-Id: I4209b41c4c09126d9ad377eea6c091c8d8a9480f Reviewed-on: https://go-review.googlesource.com/c/go/+/734321 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Robert Griesemer <gri@google.com> Auto-Submit: Robert Griesemer <gri@google.com> Reviewed-by: Alan Donovan <adonovan@google.com>
2026-03-03doc/go_spec: add max and min to forbidden expression statements listTowaiji
The expression statements section omitted max and min from the list of built-ins that are not permitted in statement context. Fixes #77896 Change-Id: I1f3d4b1d2465bde156ff751a9a7b5a212509e9a5 Reviewed-on: https://go-review.googlesource.com/c/go/+/751080 Reviewed-by: Alan Donovan <adonovan@google.com> TryBot-Bypass: Alan Donovan <adonovan@google.com> Reviewed-by: Robert Griesemer <gri@google.com> Auto-Submit: Alan Donovan <adonovan@google.com>
2026-01-12spec: slightly re-arrange composite literal section for readabilityRobert Griesemer
- introduce subtitles to make various sub-sections easier to find - split rules for struct literals into two groups (literals without and with keys) - move section on syntax ambiguity up as it pertains to the syntax introduced at the start - move prose specific to map literals into its own section No language changes. Change-Id: If8895b869138693179ca6e4d8b1c6ebdc705eccf Reviewed-on: https://go-review.googlesource.com/c/go/+/734322 Reviewed-by: Alan Donovan <adonovan@google.com> Auto-Submit: Robert Griesemer <gri@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Robert Griesemer <gri@google.com>
2025-12-02spec: remove restriction on channel element types for close built-in (bug fix)Robert Griesemer
The spec states that if the argument type for close is a type parameter, it's type set must only contain channels and they must all have the same element type. This latter requirement (all must have the same element type) was never enforced by the compiler, nor is it important for correctness or required by the implementation. This change removes this requirement also in the spec and thus documents what was always (since 1.18) the case. Fixes #74034. Change-Id: If65d50bfb581b7f37999413088d3d3b1820e054a Reviewed-on: https://go-review.googlesource.com/c/go/+/725923 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Robert Griesemer <gri@google.com> Auto-Submit: Robert Griesemer <gri@google.com> Reviewed-by: Robert Findley <rfindley@google.com>
2025-12-02spec: more precise prose for built-in function newRobert Griesemer
1) explain new(type) (simpler) before new(expr) (more complicated) 2) for new(expr), explain what happens when expr is an untyped bool 3) explain that new(nil) is not permitted 4) streamline examples slightly Fixes #76122. Change-Id: I5ddb26bd88241b4b2b9aa9b532a62f7861c2341c Reviewed-on: https://go-review.googlesource.com/c/go/+/722482 Auto-Submit: Robert Griesemer <gri@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Robert Griesemer <gri@google.com> Reviewed-by: Alan Donovan <adonovan@google.com> Commit-Queue: Robert Griesemer <gri@google.com> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2025-11-20spec: adjust rule for type parameter on RHS of alias declarationRobert Griesemer
Per discussion on issue #75885, a type parameter on the RHS of an alias declaration must not be declared in the same declaration (but it may be declared by an enclosing function). This relaxes the spec slightly and allows for (pre-existing) test cases. Add a corresponding check to the type checker (there was no check for type parameters on the RHS of alias declarations at all, before). Fixes #75884. Fixes #75885. Change-Id: I1e5675978e6423d626c068829d4bf5e90035ea82 Reviewed-on: https://go-review.googlesource.com/c/go/+/721820 Auto-Submit: Robert Griesemer <gri@google.com> Reviewed-by: Robert Griesemer <gri@google.com> Reviewed-by: Mark Freeman <markfreeman@google.com> Reviewed-by: Robert Findley <rfindley@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-11-19spec: escape double-ampersandszigo101
Change-Id: I7ce375f975a86e4c2494d2003aeb9b4a86caff3e GitHub-Last-Rev: a368bc020816cdadb06a918bd90576b490879ae8 GitHub-Pull-Request: golang/go#76299 Reviewed-on: https://go-review.googlesource.com/c/go/+/720460 Auto-Submit: Sean Liao <sean@liao.dev> Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Mark Freeman <markfreeman@google.com> Reviewed-by: Sean Liao <sean@liao.dev> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-11-13spec: remove cycle restriction for type parametersRobert Griesemer
Fixes #75883. Change-Id: I708c0594ef3182d3aca37a6358aa0a0ef89809b6 Reviewed-on: https://go-review.googlesource.com/c/go/+/711422 Reviewed-by: Robert Griesemer <gri@google.com> Reviewed-by: Alan Donovan <adonovan@google.com> Auto-Submit: Robert Griesemer <gri@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-11-10spec: more precise prose for special case of appendRobert Griesemer
As written, the special case for append may be interpreted such that any first argument that is assignable to []byte is permissible, including nil. This change makes makes it clear that a slice argument is required. Not a language change. The compiler always expected a slice argument. Fixes #76226. Change-Id: I73a1725d10096690335d6edf5793beb5de73578f Reviewed-on: https://go-review.googlesource.com/c/go/+/718880 Reviewed-by: Junyang Shao <shaojunyang@google.com> Reviewed-by: Alan Donovan <adonovan@google.com> Reviewed-by: Robert Griesemer <gri@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Robert Griesemer <gri@google.com> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2025-10-06spec: close tagOliver Eikemeier
Close an "a" tag. While we are here, fix some escapes. Change-Id: I16040eff0d4beeef6230aec8fcf4315f0efd13a4 GitHub-Last-Rev: 3ba7b9f7478f54338bd3ca7ac55cc2ad1ffcb3a4 GitHub-Pull-Request: golang/go#75760 Reviewed-on: https://go-review.googlesource.com/c/go/+/708517 Reviewed-by: Sean Liao <sean@liao.dev> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com> Reviewed-by: Robert Findley <rfindley@google.com> Auto-Submit: Sean Liao <sean@liao.dev>
2025-10-01doc/go_spec.html: update dateAlan Donovan
(addressing comment from review of CL 704737) Change-Id: I483dea046f664035e79c51729203c9a9ff0cbc59 Reviewed-on: https://go-review.googlesource.com/c/go/+/708299 Auto-Submit: Alan Donovan <adonovan@google.com> Reviewed-by: Robert Griesemer <gri@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-09-23doc/go_spec.html: document new(expr)Alan Donovan
Also, add a release note. For #45624 Change-Id: I1a0e111e00885c9640c073000afb72731d0930fc Reviewed-on: https://go-review.googlesource.com/c/go/+/704737 Auto-Submit: Alan Donovan <adonovan@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Robert Findley <rfindley@google.com>
2025-05-06spec: avoid use of "raise" in conjunction with panicsMark Freeman
For #73526 Change-Id: I06d8ae9080695745db68a51635faa0b244c1760e Reviewed-on: https://go-review.googlesource.com/c/go/+/670155 Reviewed-by: Robert Griesemer <gri@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Mark Freeman <mark@golang.org> Auto-Submit: Mark Freeman <mark@golang.org>
2025-02-25spec: remove notion of core typesRobert Griesemer
This CL removes the notion of core types from the spec. Instead of referring to core types, each section that did so before is reverted to approx. the pre-generics (1.17) prose, and additional paragraphs cover the type parameter cases as needed. The hope is that this makes it easier to read the spec. When type parameters are involved, the extra prose is local to the language feature in question and thus more readily available. When no type parameters are present, readers do not have to concern themselves with core types. In contrast to CL 621919, this change is not intended to loosen the spec in any way and therefore does not change the language (if the new prose implies otherwise, we will correct it). Except for adjustments to compiler error messages (no mention of core types anymore), no other changes to the compiler or tools are required. Future CLs may selectively relax requirements on a language construct by language construct basis; each such change can be discussed and proposed independently. For #70128. Change-Id: I6ed879a472c615d7c8dbdc7b6bd7eef3d12eff7e Reviewed-on: https://go-review.googlesource.com/c/go/+/645716 Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Rob Pike <r@golang.org> Reviewed-by: Robert Findley <rfindley@google.com> Reviewed-by: Robert Griesemer <gri@google.com> TryBot-Bypass: Robert Griesemer <gri@google.com>
2025-02-03spec: remove reference to Go 1.17 specRobert Griesemer
Also, delete go1.17_spec.html. Change-Id: I7c78029dcfbbe8dbabb4ca81052976c1c8f4ed9a Reviewed-on: https://go-review.googlesource.com/c/go/+/645717 Auto-Submit: Robert Griesemer <gri@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Robert Griesemer <gri@google.com> TryBot-Bypass: Robert Griesemer <gri@google.com>
2025-01-13spec: fix grammar issueOleksandr Redko
Change-Id: If4d3b3965762c8979d304a82493c9eb1068ee13c Reviewed-on: https://go-review.googlesource.com/c/go/+/642037 Reviewed-by: Robert Griesemer <gri@google.com> TryBot-Bypass: Robert Griesemer <gri@google.com> Reviewed-by: Michael Knyszek <mknyszek@google.com> Auto-Submit: Robert Griesemer <gri@google.com>
2025-01-03spec: fix a dead linkyaxum62
Change-Id: If99aa8073cc0e7fe36d3775c635eaaab230fcd04 GitHub-Last-Rev: 06dbd990c72ee0e9c08254addd5ce669bfbe1883 GitHub-Pull-Request: golang/go#71083 Reviewed-on: https://go-review.googlesource.com/c/go/+/638638 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Auto-Submit: Jorropo <jorropo.pgm@gmail.com> Reviewed-by: Jorropo <jorropo.pgm@gmail.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Ian Lance Taylor <iant@google.com>
2024-12-30spec: document that string conversions don't guarantee result slice capacityRobert Griesemer
Fixes #24163. Change-Id: If389c4abf3b9b6e4eba6f31c3c12779329456df6 Reviewed-on: https://go-review.googlesource.com/c/go/+/637655 Reviewed-by: Robert Griesemer <gri@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Auto-Submit: Robert Griesemer <gri@google.com> TryBot-Bypass: Robert Griesemer <gri@google.com>
2024-12-30spec: describe representation of valuesRobert Griesemer
Add a section on the representation of values: distinguish between values that are self-contained and values that contain references while avoiding the notion of "reference types" which is misleading. Also, use "predeclared identifier nil" rather than "predeclared value nil" because it is the identifier that is predeclared. Fixes #5083. Change-Id: I2235673c6404f2c055f195e879f198c7ab246d58 Reviewed-on: https://go-review.googlesource.com/c/go/+/635801 Reviewed-by: Rob Pike <r@golang.org> Reviewed-by: David Chase <drchase@google.com> Auto-Submit: Robert Griesemer <gri@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> TryBot-Bypass: Robert Griesemer <gri@google.com> Reviewed-by: Robert Griesemer <gri@google.com>
2024-12-17spec: explain function invocation and passing of parameters more preciselyRobert Griesemer
- Describe that function invocation allocates space for a functions' variables. - Explain parameter passing in terms of assignments. Change-Id: Ia693d73a570f7d1aa2ac05e6095b4e602e4e9bf2 Reviewed-on: https://go-review.googlesource.com/c/go/+/635800 Reviewed-by: Robert Griesemer <gri@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> TryBot-Bypass: Robert Griesemer <gri@google.com> Auto-Submit: Robert Griesemer <gri@google.com> Reviewed-by: Rob Pike <r@golang.org>
2024-12-12spec: align EBNF rules consistently (cosmetic change)Robert Griesemer
Change-Id: Ib1b14b8880c6de5606f7f425a5fc1c8749d8a4b7 Reviewed-on: https://go-review.googlesource.com/c/go/+/635799 TryBot-Bypass: Robert Griesemer <gri@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Robert Griesemer <gri@google.com> Auto-Submit: Robert Griesemer <gri@google.com>
2024-11-20spec: document restrictions for method receivers that are aliasesRobert Griesemer
For #70417. Change-Id: I5e6b3011f356c7ecd8f64f5dcf0a6a77dcb21bbf Reviewed-on: https://go-review.googlesource.com/c/go/+/629577 Auto-Submit: Robert Griesemer <gri@google.com> TryBot-Bypass: Robert Griesemer <gri@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Robert Griesemer <gri@google.com>
2024-10-02spec: document that alias declarations can have type parameters with 1.24Robert Griesemer
For #46477. Change-Id: Id02d8f67fe82228bab3f26b1cb4ebd6ee67c4634 Reviewed-on: https://go-review.googlesource.com/c/go/+/616816 Reviewed-by: Ian Lance Taylor <iant@google.com> Auto-Submit: Robert Griesemer <gri@google.com> Reviewed-by: Rob Pike <r@golang.org> Reviewed-by: Robert Griesemer <gri@google.com> TryBot-Bypass: Robert Griesemer <gri@google.com>
2024-10-02spec: clarify that identical structs must have identical field embeddingsRobert Griesemer
The existing prose for struct identity did only require that two structs "have the same sequence of fields, and if corresponding fields have the same names, and identical types, and identical tags" for the structs to be identical. The implementation (forever) has also required that two corresponding fields are either both embedded or not embedded. This is arguably part of a struct's structure but is not explicitly specified. This CL makes a minor change to the prose to address that. Fixes #69472. Change-Id: Ifa4ca69717986675642a09d03ce683ba8235efcb Reviewed-on: https://go-review.googlesource.com/c/go/+/616697 Reviewed-by: Rob Pike <r@golang.org> TryBot-Bypass: Robert Griesemer <gri@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Robert Griesemer <gri@google.com> Auto-Submit: Robert Griesemer <gri@google.com>
2024-08-12spec: clarify prose for embedded struct fieldsRobert Griesemer
The spec says that an embedded field must be specified as a type name (or a pointer to a type name). This is explicit in the prose and the FieldDecl syntax. However, the prose on promoted methods required a named type (originally the term used for a "defined type"). Before the introduction of alias types, type names could only refer to named/defined types, so the prose was ok. With the introduction of alias types in Go 1.9, we distinguished between defined types (i.e., types given a name through a type declaration) and type aliases (types given an alternative name), and retired the notion of a named type since any type with a name (alias type and defined type) could be considered a "named type". To make things worse, with Go 1.18 we re-introduced the notion of a named type which now includes predeclared types, defined types, type parameters (and with that type aliases denoting named types). In the process some of the wording on method promotion didn't get updated correctly. At attempt to fix this was made with CL 406054, but while that CL's description correctly explained the intent, the CL changed the prose from "defined type" to "named type" (which had the new meaning after Go 1.18), and thus did not fix the issue. This CL fixes that fix by using the term "type name". This makes the prose consistent for embedded types and in turn clarifies that methods of embedded alias types (defined or not) can be promoted, consistent with the implementation. While at it, also document that the type of an embedded field cannot be a type parameter. This restriction has been in place since the introduction of type parameters with Go 1.18 and is enforced by the compiler. Fixes #66540. For #41687. Change-Id: If9e6a03d7b84d24a3e6a5ceda1d46bda99bdf1f4 Reviewed-on: https://go-review.googlesource.com/c/go/+/603958 Reviewed-by: Ian Lance Taylor <iant@golang.org> TryBot-Bypass: Robert Griesemer <gri@google.com> Reviewed-by: Robert Griesemer <gri@google.com> Reviewed-by: Alan Donovan <adonovan@google.com> Reviewed-by: Axel Wagner <axel.wagner.hh@googlemail.com>
2024-06-13spec: adjust for-range prose to include iterator functions where missingRobert Griesemer
Also add a missing table entry to the language versions section in the appendix. Fixes #67977. Change-Id: I1f98abbbcc34a4ff31f390752635435eaf6120b8 Reviewed-on: https://go-review.googlesource.com/c/go/+/592595 TryBot-Bypass: Robert Griesemer <gri@google.com> Reviewed-by: Robert Griesemer <gri@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Auto-Submit: Robert Griesemer <gri@google.com>
2024-06-13spec: allow range-over-func to omit iteration variablesRobert Griesemer
For #65236. Change-Id: I5a11811cc52467ea4446db29c3f86b119f9b2409 Reviewed-on: https://go-review.googlesource.com/c/go/+/592295 Reviewed-by: Robert Griesemer <gri@google.com> Auto-Submit: Robert Griesemer <gri@google.com> TryBot-Bypass: Robert Griesemer <gri@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com>
2024-06-04spec: better examples for range-over-funcRobert Griesemer
For #65237. Change-Id: Id38747efebd46633f453eadaf68d818064faa778 Reviewed-on: https://go-review.googlesource.com/c/go/+/590396 Reviewed-by: Robert Griesemer <gri@google.com> TryBot-Bypass: Robert Griesemer <gri@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Auto-Submit: Robert Griesemer <gri@google.com>
2024-06-04spec: document for range loop over functionsRobert Griesemer
For #61405. Fixes #65237. Change-Id: Ia7820c0ef089c828ea7ed3d2802c5185c945290e Reviewed-on: https://go-review.googlesource.com/c/go/+/589397 TryBot-Bypass: Robert Griesemer <gri@google.com> Reviewed-by: Robert Griesemer <gri@google.com> Auto-Submit: Robert Griesemer <gri@google.com> Reviewed-by: Matthew Dempsky <mdempsky@google.com> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2024-05-02spec: clarify when range expression is evaluatedOlivier Mengué
Clarify that the range expression of a "for" loop is called *just* once to rule out that it might be re-evaluated after each iteration. Change-Id: Iedb61cd29e5238ac0168b8ac01c34d6208cc4312 Reviewed-on: https://go-review.googlesource.com/c/go/+/582775 Reviewed-by: Robert Griesemer <gri@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Ian Lance Taylor <iant@google.com>
2024-04-26spec: clarify prose for range over numeric range expressionsRobert Griesemer
Fixes #66967. Change-Id: I7b9d62dcb83bad60b2ce74e2e2bf1a36c6a8ae38 Reviewed-on: https://go-review.googlesource.com/c/go/+/581256 Reviewed-by: Robert Griesemer <gri@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> TryBot-Bypass: Robert Griesemer <gri@google.com>
2024-04-25spec: clarify when a range expression is evaluatedRobert Griesemer
If the range expression is a numeric constant, the range expression is also not evaluated. Change-Id: I97201e5c136d3d1a87ed1500b19b7199b30bc9ff Reviewed-on: https://go-review.googlesource.com/c/go/+/581298 Reviewed-by: Robert Griesemer <gri@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> TryBot-Bypass: Robert Griesemer <gri@google.com> Auto-Submit: Robert Griesemer <gri@google.com>
2024-04-11all: consistently use "IEEE 754" over "IEEE-754"Joe Tsai
There is no hyphen between the organization and the number. For example, https://standards.ieee.org/ieee/754/6210/ shows the string "IEEE 754-2019" and not "IEEE-754-2019". This assists in searching for "IEEE 754" in documentation and not missing those using "IEEE-754". Change-Id: I9a50ede807984ff1e2f17390bc1039f6a5d162e5 Reviewed-on: https://go-review.googlesource.com/c/go/+/575438 Run-TryBot: Joseph Tsai <joetsai@digital-static.net> Reviewed-by: Robert Griesemer <gri@google.com> Auto-Submit: Joseph Tsai <joetsai@digital-static.net> TryBot-Result: Gopher Robot <gobot@golang.org> TryBot-Bypass: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com>
2024-03-04doc: close HTML tagscui fliter
Add unclosed HTML tags and remove redundant </a> tags. Change-Id: I3fffbcfd640001c9cc4f6085150344daa0c4369b Reviewed-on: https://go-review.googlesource.com/c/go/+/568155 Reviewed-by: Bryan Mills <bcmills@google.com> Run-TryBot: shuang cui <imcusg@gmail.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-02-07spec: fix typo in year (it's 2024 now)Robert Griesemer
While at it, set the date to the Go 1.22 release date. Change-Id: I03872626e500433eb63786d24c67810c8c6289f4 Reviewed-on: https://go-review.googlesource.com/c/go/+/562337 Auto-Submit: Robert Griesemer <gri@google.com> Reviewed-by: Robert Griesemer <gri@google.com> Reviewed-by: Robert Findley <rfindley@google.com> Reviewed-by: Carlos Amedee <carlos@golang.org> Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com> TryBot-Bypass: Robert Griesemer <gri@google.com>
2024-01-30spec: clarify iteration variable type for range over integerRobert Griesemer
Also: report language version (plus date) in spec header. Fixes #65137. Change-Id: I4f1d220d5922c40a36264df2d0a7bb7cd0756bac Reviewed-on: https://go-review.googlesource.com/c/go/+/557596 TryBot-Bypass: Robert Griesemer <gri@google.com> Reviewed-by: Matthew Dempsky <mdempsky@google.com> Reviewed-by: Robert Griesemer <gri@google.com>
2024-01-05doc: s/adjustements/adjustmentsJes Cok
Change-Id: I904b1adee13c63bc7d47d4325b794c1a650eb18d GitHub-Last-Rev: 8eced8db566c4dea433260f87456902542095970 GitHub-Pull-Request: golang/go#64969 Reviewed-on: https://go-review.googlesource.com/c/go/+/554255 Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Bryan Mills <bcmills@google.com> Run-TryBot: Jes Cok <xigua67damn@gmail.com>
2023-12-27doc: fix typo in example in specRobert Griesemer
Follow-up on CL 551095. For #56010. Change-Id: I8913d6ca96c419c81683e88c6286b05ae1323416 Reviewed-on: https://go-review.googlesource.com/c/go/+/552915 TryBot-Bypass: Robert Griesemer <gri@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Robert Griesemer <gri@google.com> Auto-Submit: Robert Griesemer <gri@google.com>
2023-12-27doc: document new iteration variable semantics in specRobert Griesemer
For #56010. Change-Id: Icca987a03d80587dd0e901f596ff7788584893ed Reviewed-on: https://go-review.googlesource.com/c/go/+/551095 Reviewed-by: Matthew Dempsky <mdempsky@google.com> TryBot-Bypass: Robert Griesemer <gri@google.com> Reviewed-by: Rob Pike <r@golang.org> Reviewed-by: Robert Griesemer <gri@google.com> Auto-Submit: Robert Griesemer <gri@google.com>
2023-12-27doc: document version at which new language features were introduced in specRobert Griesemer
Add a new section to the Appendix describing what features were changed or added in which language version. Add short links with references to the required language version where relevant. Fixes #63857. Change-Id: I5250f856d8688a71602076fcc662aa678d96a5d2 Reviewed-on: https://go-review.googlesource.com/c/go/+/549518 Reviewed-by: Robert Griesemer <gri@google.com> Reviewed-by: Rob Pike <r@golang.org> Auto-Submit: Robert Griesemer <gri@google.com> Reviewed-by: Russ Cox <rsc@golang.org> TryBot-Bypass: Robert Griesemer <gri@google.com> Reviewed-by: Alan Donovan <adonovan@google.com>
2023-12-20doc: update unsafe.Pointer rule in specRobert Griesemer
The valid conversions consider the core types of operands, not just their underlying type. This also explains the valid arguments for unsafe.Slice which are explained in terms of unsafe.Pointer conversions. unsafe.SliceData simply refers to "slice argument" and we use similar terminology elsewhere in the spec to denote values that have a core type of slice (or any other type for that matter). Leaving alone for now. Fixes #64452. Change-Id: I0eed3abbc0606f22358835e5d434f026fe0909c8 Reviewed-on: https://go-review.googlesource.com/c/go/+/551379 Auto-Submit: Robert Griesemer <gri@google.com> Reviewed-by: Robert Griesemer <gri@google.com> Reviewed-by: Matthew Dempsky <mdempsky@google.com> TryBot-Bypass: Robert Griesemer <gri@google.com>
2023-12-05doc/go_spec.html: rename golang.org to go.devAlan Donovan
Fixes #64513 Change-Id: I45d6a4ba2170308260f3b8f7965affc9948f3fcf Reviewed-on: https://go-review.googlesource.com/c/go/+/547476 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Alan Donovan <adonovan@google.com>
2023-11-02spec: document range over integer expressionRobert Griesemer
This CL is partly based on CL 510535. For #61405. Change-Id: Ic94f6726f9eb34313f11bec7b651921d7e5c18d4 Reviewed-on: https://go-review.googlesource.com/c/go/+/538859 Reviewed-by: Cherry Mui <cherryyz@google.com> TryBot-Bypass: Robert Griesemer <gri@google.com> Auto-Submit: Robert Griesemer <gri@google.com> Reviewed-by: Robert Griesemer <gri@google.com>