aboutsummaryrefslogtreecommitdiff
path: root/src/go
AgeCommit message (Collapse)Author
6 daysall: make function comments match function namescuishuang
Change-Id: Ideb9ef00e7bc660b005fc080973fd9f3d36c5a1f Reviewed-on: https://go-review.googlesource.com/c/go/+/589536 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Michael Knyszek <mknyszek@google.com> Run-TryBot: shuang cui <imcusg@gmail.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com>
10 dayscmd/compile: remove quoting in favor of clearer prose in error messagesRobert Griesemer
In an attempt to address issue #65790 (confusing error messages), quoting of names was introduced for some (but not all) names used in error messages. That CL solved the issue at hand at the cost of extra punctuation (the quotes) plus some inconsistency (not all names were quoted). This CL removes the quoting again in favor or adding a qualifying noun (such as "name", "label", "package", "built-in" etc.) before a user- specified name where needed. For instance, instead of invalid argument to `max' we now say invalid argument to built-in max There's still a chance for confusion. For instance, before an error might have been `sadly' not exported by package X and now it would be name sadly not exported by package X but adverbs (such as "sadly") seem unlikely names in programs. This change touches a lot of files but only affects error messages. Fixes #67685. Change-Id: I95435b388f92cade316e2844d59ecf6953b178bc Reviewed-on: https://go-review.googlesource.com/c/go/+/589118 Auto-Submit: Robert Griesemer <gri@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Robert Findley <rfindley@google.com> Reviewed-by: Robert Griesemer <gri@google.com>
11 daysall: document legacy //go:linkname for final round of modulesRuss Cox
Add linknames for most modules with ≥50 dependents. Add linknames for a few other modules that we know are important but are below 50. Remove linknames from badlinkname.go that do not merit inclusion (very small number of dependents). We can add them back later if the need arises. Fixes #67401. (For now.) Change-Id: I1e49fec0292265256044d64b1841d366c4106002 Reviewed-on: https://go-review.googlesource.com/c/go/+/587756 Auto-Submit: Russ Cox <rsc@golang.org> TryBot-Bypass: Russ Cox <rsc@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com>
11 daysall: document legacy //go:linkname for modules with ≥100 dependentsRuss Cox
For #67401. Change-Id: I015408a3f437c1733d97160ef2fb5da6d4efcc5c Reviewed-on: https://go-review.googlesource.com/c/go/+/587598 Reviewed-by: Cherry Mui <cherryyz@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Russ Cox <rsc@golang.org>
12 daysgo/types, types2: report error when using uninstantiated signature aliasRobert Griesemer
For #67547. Fixes #67683. Change-Id: I9487820ab4e2bd257d253a7016df45729b29f836 Reviewed-on: https://go-review.googlesource.com/c/go/+/588855 Auto-Submit: Robert Griesemer <gri@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Robert Findley <rfindley@google.com> Reviewed-by: Robert Griesemer <gri@google.com>
12 daysgo/types, types2: don't lose alias information during unificationRobert Griesemer
While at it, rename asTypeParam to asBoundTypeParam for clarity. For #67547. Fixes #67628. Change-Id: I2f447c4cd4d72f5315fe9323d82fcb9bf33657c6 Reviewed-on: https://go-review.googlesource.com/c/go/+/588797 Reviewed-by: Robert Griesemer <gri@google.com> Auto-Submit: Robert Griesemer <gri@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Commit-Queue: Robert Griesemer <gri@google.com> Reviewed-by: Robert Findley <rfindley@google.com>
2024-05-24internal/runtime/exithook: make safe for concurrent os.ExitRuss Cox
Real programs can call os.Exit concurrently from multiple goroutines. Make internal/runtime/exithook not crash in that case. The throw on panic also now runs in the deferred context, so that we will see the full stack trace that led to the panic. That should give us more visibility into the flaky failures on bugs #55167 and #56197 as well. Fixes #67631. Change-Id: Iefdf71b3a3b52a793ca88d89a9c270eb50ece094 Reviewed-on: https://go-review.googlesource.com/c/go/+/588235 Reviewed-by: Than McIntosh <thanm@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Russ Cox <rsc@golang.org>
2024-05-24go/types, types2: pull up Unalias call to cover all of cycleFinder.typRobert Griesemer
Without a test because it's unclear the situation can actually occur, but the code is correct because it now mimics the behavior without explicit Alias nodes. For #67547. Change-Id: I21a31af28880ca6d599fe465563d9574c26ed1f1 Reviewed-on: https://go-review.googlesource.com/c/go/+/588117 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>
2024-05-23go/types, types2: document why Unalias is not needed in some placesRobert Griesemer
Documentation change only. For #67547. Change-Id: I0da480299c33239bcd1e059f8b9c6d48d8f26609 Reviewed-on: https://go-review.googlesource.com/c/go/+/587820 TryBot-Bypass: Robert Griesemer <gri@google.com> Reviewed-by: Robert Griesemer <gri@google.com> Reviewed-by: Robert Findley <rfindley@google.com> Auto-Submit: Robert Griesemer <gri@google.com>
2024-05-23go/types, types2: add missing Unalias call to type string functionalityRobert Griesemer
For #67547. Change-Id: I999cd31f9a01f91e7984b4e7012c81e8bd9c6b06 Reviewed-on: https://go-review.googlesource.com/c/go/+/587940 Reviewed-by: Robert Griesemer <gri@google.com> Auto-Submit: Robert Griesemer <gri@google.com> Reviewed-by: Robert Findley <rfindley@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-05-23std: fix calls to Printf(s) with non-constant sAlan Donovan
In all cases the intent was not to interpret s as a format string. In one case (go/types), this was a latent bug in production. (These were uncovered by a new check in vet's printf analyzer.) Updates #60529 Change-Id: I3e17af7e589be9aec1580783a1b1011c52ec494b Reviewed-on: https://go-review.googlesource.com/c/go/+/587855 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Russ Cox <rsc@golang.org>
2024-05-23go/types, types2: factor out check for updated type arguments (cleanup)Robert Griesemer
Change-Id: I3e2668e4a24c145f121199a5f7f4278ff5d5f1da Reviewed-on: https://go-review.googlesource.com/c/go/+/587676 Reviewed-by: Robert Griesemer <gri@google.com> Reviewed-by: Robert Findley <rfindley@google.com> Auto-Submit: Robert Griesemer <gri@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-05-23go/types, types2: instantiate generic alias typesRobert Griesemer
For #46477. Change-Id: Ifa47d3ff87f67c60fa25654e54194ca8b31ea5a2 Reviewed-on: https://go-review.googlesource.com/c/go/+/567617 Auto-Submit: Robert Griesemer <gri@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Robert Findley <rfindley@google.com> Reviewed-by: Robert Griesemer <gri@google.com>
2024-05-23runtime: move exit hooks into internal/runtime/exithookRuss Cox
This removes a //go:linkname usage in the coverage implementation. For #67401. Change-Id: I0602172c7e372a84465160dbf46d9fa371582fff Reviewed-on: https://go-review.googlesource.com/c/go/+/586259 Auto-Submit: Russ Cox <rsc@golang.org> Reviewed-by: Than McIntosh <thanm@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
2024-05-23all: change from sort functions to slices functions where feasibleIan Lance Taylor
Doing this because the slices functions are slightly faster and slightly easier to use. It also removes one dependency layer. This CL does not change packages that are used during bootstrap, as the bootstrap compiler does not have the required slices functions. It does not change the go/scanner package because the ErrorList Len, Swap, and Less methods are part of the Go 1 API. Change-Id: If52899be791c829198e11d2408727720b91ebe8a Reviewed-on: https://go-review.googlesource.com/c/go/+/587655 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com> Commit-Queue: Ian Lance Taylor <iant@google.com> Reviewed-by: Damien Neil <dneil@google.com>
2024-05-23all: document legacy //go:linkname for modules with ≥10,000 dependentsRuss Cox
For #67401. Change-Id: I9216f01ac4dc9d239f3f20a633fd0d5072cf0a0f Reviewed-on: https://go-review.googlesource.com/c/go/+/587219 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Russ Cox <rsc@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com>
2024-05-22crypto/internal/hpke: add basic implementationRoland Shoemaker
Only implements the sender role, since that's all we need for client-side ECH for now. Change-Id: Ia7cba1bc3bad8e8dc801d98d5ea859738b1f2790 Reviewed-on: https://go-review.googlesource.com/c/go/+/585436 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Roland Shoemaker <roland@golang.org> Reviewed-by: Damien Neil <dneil@google.com> Reviewed-by: Filippo Valsorda <filippo@golang.org>
2024-05-22go/types, types2: better error message for invalid ERROR pattern in testsRobert Griesemer
When unquoting of an ERROR or ERRORx pattern fails, say so instead of simply printing "syntax error". Change-Id: I586dffa86ca80f5b40a5cbe16a7005cc1f7862f8 Reviewed-on: https://go-review.googlesource.com/c/go/+/586958 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>
2024-05-22go/types, types2: operand.AssignableTo must consider Alias typesRobert Griesemer
Fixes regression from Go 1.22. For #67547. Change-Id: Id0d07d6b24e1eab6ed1c7476d9d9b82d28aee80a Reviewed-on: https://go-review.googlesource.com/c/go/+/587161 Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com> Reviewed-by: Robert Findley <rfindley@google.com> Reviewed-by: Robert Griesemer <gri@google.com> Auto-Submit: Robert Griesemer <gri@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-05-22go/types, types2: operand.convertibleTo must consider Alias typesRobert Griesemer
Fixes regression from Go 1.22. Fixes #67540. For #67547. Change-Id: I61f642970c6a9bd8567654bb5ecf645ae77b3bcc Reviewed-on: https://go-review.googlesource.com/c/go/+/587159 Reviewed-by: Robert Griesemer <gri@google.com> Reviewed-by: Robert Findley <rfindley@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com> Auto-Submit: Robert Griesemer <gri@google.com>
2024-05-22internal/coverage/cfile: remove more //go:linkname usageRuss Cox
Move code so that basic imports work instead of //go:linkname for metadata lists. For #67401. Change-Id: Id02075570befc45a9426559aad2137ab540928b2 Reviewed-on: https://go-review.googlesource.com/c/go/+/585915 Reviewed-by: Than McIntosh <thanm@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
2024-05-21go/types, types2: underIs must consider Alias typesRobert Griesemer
Fixes regression from Go 1.22. For #67547. Change-Id: I012681c7b8b01b02018b313dd3804690bc7aeed1 Reviewed-on: https://go-review.googlesource.com/c/go/+/587158 Reviewed-by: Robert Griesemer <gri@google.com> Auto-Submit: Robert Griesemer <gri@google.com> Reviewed-by: Robert Findley <rfindley@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-05-21go/types, types2: coreType/String must consider Alias typesRobert Griesemer
Fixes regression from Go 1.22. For #67547. Change-Id: Idd319b9d2a73c824caa2c821df0e2fcd4f58cb08 Reviewed-on: https://go-review.googlesource.com/c/go/+/587176 Reviewed-by: Robert Findley <rfindley@google.com> Auto-Submit: Robert Griesemer <gri@google.com> Reviewed-by: Robert Griesemer <gri@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-05-21go/types, types2: don't panic converting a constant to aliased type parameterRobert Griesemer
For #67547. Change-Id: I1b2118a311dce906327ae6e29e582da539c60b2b Reviewed-on: https://go-review.googlesource.com/c/go/+/587157 Auto-Submit: Robert Griesemer <gri@google.com> Reviewed-by: Robert Griesemer <gri@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Robert Findley <rfindley@google.com>
2024-05-21go/types, types2: add missing Unalias calls (clarification)Robert Griesemer
This change adds an Unalias call in applyTypeFunc and arrayPtrDeref. At the moment this doesn't change anything or fix any bugs because of the way these two functions are invoked, but that could change in the future. Also, manually reviewed all type assertions to Type types. Excluding assertions to type parameters, no obvious issues were found except for #67540 for which a separate fix is pending. There are potential issues with assertions type parameters which will be addressed in a follow-up CL. For #67547. Change-Id: I312268dc5e104f95b68f115f00aec3ec4c82e41f Reviewed-on: https://go-review.googlesource.com/c/go/+/587156 Reviewed-by: Robert Findley <rfindley@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>
2024-05-21runtime/coverage: remove uses of //go:linknameRuss Cox
Move code to internal/coverage/cfile, making it possible to access directly from testing/internal/testdeps, so that we can avoid needing //go:linkname hacks. For #67401. Change-Id: I10b23a9970164afd2165e718ef3b2d9e86783883 Reviewed-on: https://go-review.googlesource.com/c/go/+/585820 Auto-Submit: Russ Cox <rsc@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Than McIntosh <thanm@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
2024-05-21go/types, types2: use GOEXPERIMENT to enable alias type parametersRobert Griesemer
For #46477. Change-Id: Ia3558f9d2bf43fdd9e3618bd9f800d268e13b367 Reviewed-on: https://go-review.googlesource.com/c/go/+/586956 Reviewed-by: Carlos Amedee <carlos@golang.org> Reviewed-by: Robert Findley <rfindley@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>
2024-05-21runtime: increase profiling stack depth to 128Felix Geisendörfer
The current stack depth limit for alloc, mutex, block, threadcreate and goroutine profiles of 32 frequently leads to truncated stack traces in production applications. Increase the limit to 128 which is the same size used by the execution tracer. Create internal/profilerecord to define variants of the runtime's StackRecord, MemProfileRecord and BlockProfileRecord types that can hold arbitrarily big stack traces. Implement internal profiling APIs based on these new types and use them for creating protobuf profiles and to act as shims for the public profiling APIs using the old types. This will lead to an increase in memory usage for applications that use the impacted profile types and have stack traces exceeding the current limit of 32. Those applications will also experience a slight increase in CPU usage, but this will hopefully soon be mitigated via CL 540476 and 533258 which introduce frame pointer unwinding for the relevant profile types. For #43669. Change-Id: Ie53762e65d0f6295f5d4c7d3c87172d5a052164e Reviewed-on: https://go-review.googlesource.com/c/go/+/572396 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Austin Clements <austin@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
2024-05-20cmd/compile: add structs.HostLayoutDavid Chase
This is for the proposal, plus a few bug fixes that would/will be necessary when this is put into actual use. Fixes #66408. Updates #63131. Change-Id: I3a66e09d707dd579c59f155e7f53367f41214c30 Reviewed-on: https://go-review.googlesource.com/c/go/+/578355 Reviewed-by: Austin Clements <austin@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: David Chase <drchase@google.com>
2024-05-20maps: add All, Keys, Values, Insert, Collectaimuz
Fixed #61900. Change-Id: Ic5962dc92b3102e7448635bef541414a2eaf415e GitHub-Last-Rev: 3c6f74d6173c519ce090e22e724da04efff79022 GitHub-Pull-Request: golang/go#67521 Reviewed-on: https://go-review.googlesource.com/c/go/+/586716 Auto-Submit: Ian Lance Taylor <iant@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Commit-Queue: Ian Lance Taylor <iant@google.com> Reviewed-by: Russ Cox <rsc@golang.org> Auto-Submit: Russ Cox <rsc@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com>
2024-05-17internal/trace: move v2 tracer into trace directoryCarlos Amedee
This change moves the v2 tracer into the trace directory. Updates #67367 Change-Id: I3657b4227002cb00fdf29c797434800ea796715e Reviewed-on: https://go-review.googlesource.com/c/go/+/584538 Reviewed-by: Michael Knyszek <mknyszek@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-05-17all: add push linknames to allow legacy pull linknamesCherry Mui
CL 585358 adds restrictions to disallow pull-only linknames (currently off by default). Currently, there are quite some pull- only linknames in user code in the wild. In order not to break those, we add push linknames to allow them to be pulled. This CL includes linknames found in a large code corpus (thanks Matthew Dempsky and Michael Pratt for the analysis!), that are not currently linknamed. Updates #67401. Change-Id: I32f5fc0c7a6abbd7a11359a025cfa2bf458fe767 Reviewed-on: https://go-review.googlesource.com/c/go/+/586137 Reviewed-by: Russ Cox <rsc@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-05-17go/types: re-enable suppressed gcimporter testsRobert Griesemer
Port CL 577616 from types2 to go/types allows us to re-enable these tests. Fixes #66859. Fixes #67436. Updates #50259. Updates #65294. Change-Id: I573e51cf16546ac1c115beac5322b51dd998c881 Reviewed-on: https://go-review.googlesource.com/c/go/+/586236 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Robert Griesemer <gri@google.com> Reviewed-by: Alan Donovan <adonovan@google.com> Reviewed-by: Robert Griesemer <gri@google.com>
2024-05-16go/types, types2: report error for floating-point iteration variableRobert Griesemer
While at it, slightly improve documentation and code. Also, add additional test cases for #66561. Updates #66561. Fixes #67027. Change-Id: I682b0e9227e065d6bbd199871c2e1ecff13edc66 Reviewed-on: https://go-review.googlesource.com/c/go/+/580937 Reviewed-by: Robert Griesemer <gri@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Robert Findley <rfindley@google.com> Auto-Submit: Robert Griesemer <gri@google.com>
2024-05-16go/ast: fix bug handling the result of yield in PreorderRob Findley
Once yield returns false, ast.Preorder must not call yield on any more nodes. Even after the function passed to ast.Inspect returns false, it may be invoked again with a non-nil node. Therefore, we must explicitly truncate the inspection. For #66339 Change-Id: I2b01e4e96a2d7aca785467c15ab59da13208c161 Reviewed-on: https://go-review.googlesource.com/c/go/+/585520 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>
2024-05-16cmd/go: add -changed to query for non-defaults in the envqiulaidongfeng
Fixes #34208 Change-Id: I8ec2d96262dcd7cbf870f6173690143c54190722 GitHub-Last-Rev: 6543df4784cff1ba5751dc9885ef502e69679118 GitHub-Pull-Request: golang/go#65655 Reviewed-on: https://go-review.googlesource.com/c/go/+/563137 Reviewed-by: Alan Donovan <adonovan@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Matloob <matloob@golang.org>
2024-05-15go/ast: add Preorder go1.23 iteratorAlan Donovan
This CL adds a new function Preorder that makes it easier to iterate over the nodes of a syntax tree. In particular, break, continue, and return retain their usual continuations. Fixes #66339 Change-Id: I438b3c23780c91ed589871ad3b8822d54e8fabc7 Reviewed-on: https://go-review.googlesource.com/c/go/+/570680 Reviewed-by: Robert Findley <rfindley@google.com> Auto-Submit: Alan Donovan <adonovan@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-05-15go/types, types2: factor out type parameter access into genericTypeRobert Griesemer
Also, remove types2.Signature.SetTypeParams as it is not used and does not exist in go/types. Change-Id: I16c3ae988988d3735907e9c6c56e8626497ea405 Reviewed-on: https://go-review.googlesource.com/c/go/+/581817 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: Robert Findley <rfindley@google.com>
2024-05-15go/types, types2: add Alias.{TypeParams, SetTypeParams, TypeArgs, Origin}Robert Griesemer
Fixes #67143. Change-Id: I8bf9c2559f95d3d6a40874454208ae074b68875c Reviewed-on: https://go-review.googlesource.com/c/go/+/583757 Reviewed-by: Alan Donovan <adonovan@google.com> Reviewed-by: Robert Findley <rfindley@google.com> Auto-Submit: Robert Griesemer <gri@google.com> Reviewed-by: Robert Griesemer <gri@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-05-15go/types, types2: add additional documentation for UnderlyingRob Findley
The concept of an underlying type has become more complicated with the addition of TypeParam and Alias types. Update the documentation to clarify that it strips off Named, TypeParam, and Alias types, and to reference the spec. Fixes #65774 Change-Id: I40a8efe15b45591b95068acbf4ef9eae17a4cef1 Reviewed-on: https://go-review.googlesource.com/c/go/+/585456 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Alan Donovan <adonovan@google.com> Reviewed-by: Robert Griesemer <gri@google.com> Auto-Submit: Robert Findley <rfindley@google.com>
2024-05-15cmd/link: disallow pull-only linknamesCherry Mui
As mentioned in CL 584598, linkname is a mechanism that, when abused, can break API integrity and even safety of Go programs. CL 584598 is a first step to restrict the use of linknames, by implementing a blocklist. This CL takes a step further, tightening up the restriction by allowing linkname references ("pull") only when the definition side explicitly opts into it, by having a linkname on the definition (possibly to itself). This way, it is at least clear on the definition side that the symbol, despite being unexported, is accessed outside of the package. Unexported symbols without linkname can now be actually private. This is similar to the symbol visibility rule used by gccgo for years (which defines unexported non-linknamed symbols as C static symbols). As there can be pull-only linknames in the wild that may be broken by this change, we currently only enforce this rule for symbols defined in the standard library. Push linknames are added in the standard library to allow things build. Linkname references to external (non-Go) symbols are still allowed, as their visibility is controlled by the C symbol visibility rules and enforced by the C (static or dynamic) linker. Assembly symbols are treated similar to linknamed symbols. This is controlled by -checklinkname linker flag, currently not enabled by default. A follow-up CL will enable it by default. Change-Id: I07344f5c7a02124dbbef0fbc8fec3b666a4b2b0e Reviewed-on: https://go-review.googlesource.com/c/go/+/585358 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Than McIntosh <thanm@google.com> Reviewed-by: Russ Cox <rsc@golang.org>
2024-05-13internal/chacha8rand: use internal/byteorderMateusz Poliwczak
Change-Id: Ia5bcaba47da949583a720ca3506d6bd9e3794824 GitHub-Last-Rev: 1ed3dad2bf43df5526572f7fdc4c3b02ab977a01 GitHub-Pull-Request: golang/go#67320 Reviewed-on: https://go-review.googlesource.com/c/go/+/584996 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-05-13math/rand/v2, math/big: use internal/byteorderMateusz Poliwczak
Change-Id: Id07f16d14133ee539bc2880b39641c42418fa6e2 GitHub-Last-Rev: 7b327d508f677f2476d24f046d25921f4599dd9a GitHub-Pull-Request: golang/go#67319 Reviewed-on: https://go-review.googlesource.com/c/go/+/585016 Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Ian Lance Taylor <iant@google.com>
2024-05-13crypto: replace encoding/binary in favour of internal/byteorderMateusz Poliwczak
Updates #54097 Change-Id: I827a5efd1736ce057b76f079466f2d9ead225898 GitHub-Last-Rev: 40af10469d85ce9f4bef4b40025589d9e44f43d6 GitHub-Pull-Request: golang/go#67321 Reviewed-on: https://go-review.googlesource.com/c/go/+/585017 Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@google.com> Auto-Submit: Keith Randall <khr@golang.org> Commit-Queue: Ian Lance Taylor <iant@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com>
2024-05-10internal/byteorder: new packageMateusz Poliwczak
Currently in a lot of packages we define functions for appending/decoding mostly BigEndian data (see internal/chacha8rand, net/netip, internal/boring/sha, hash/crc64, and probably more), because we don't want to depend on encoding/binary, because of #54097. This change introduces a new package internal/byteorder, that will allow us to remove all of the functions and replace them with internal/byteorder. Updates #54097 Change-Id: I03e5ea1eb721dd98bdabdb25786f889cc5de54c5 GitHub-Last-Rev: 3f07d3dfb453a9e679395711f9b93e25f9340a3b GitHub-Pull-Request: golang/go#67183 Reviewed-on: https://go-review.googlesource.com/c/go/+/583298 Reviewed-by: Ian Lance Taylor <iant@google.com> Auto-Submit: Ian Lance Taylor <iant@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Commit-Queue: Ian Lance Taylor <iant@golang.org>
2024-05-09slices: add iterator-related functionsIan Lance Taylor
Fixes #61899 Change-Id: Icbde1ac8293723eefc3251008ae9711e756ed1b3 Reviewed-on: https://go-review.googlesource.com/c/go/+/568477 Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Alan Donovan <adonovan@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-05-07go/types, types: represent any using AliasRob Findley
When GODEBUG=gotypesalias=1 is set, use an actual Alias type to represent any, rather than a legacy alias representation. This makes any consistent with other interface aliases, and will eventually make obsolete the various workarounds for formatting any as 'any' rather than 'interface{}'. Since any is a global in the Universe scope, we must hijack Scope.Lookup to select the correct representation. Of course, this also means that we can't support type checking concurrently while mutating gotypesalias (or, in the case of types2, Config.EnableAlias). Some care is taken to ensure that the type checker panics in the event of this type of misuse. For now, we must still support the legacy representation of any, and the existing workarounds that look for a distinguished any pointer. This is done by ensuring that both representations have the same underlying pointer, and by updating workarounds to consider Underlying. Fixes golang/go#66921 Change-Id: I81db7e8e15317b7a6ed3b406545db15a2fc42f57 Reviewed-on: https://go-review.googlesource.com/c/go/+/580355 Reviewed-by: Alan Donovan <adonovan@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-05-07go/ast: simplify walking lists with genericsDaniel Martí
Change-Id: Ib6e3fd9c5788400420555b2889e6dba0853446bc Reviewed-on: https://go-review.googlesource.com/c/go/+/582495 Reviewed-by: Robert Findley <rfindley@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
2024-05-06iter: expose fundamental types to Go 1.23Russ Cox
These were previously only available with GOEXPERIMENT=rangefunc. For #61897. Change-Id: I86aea5ae8be1f7a2975b623325811221ed40d384 Reviewed-on: https://go-review.googlesource.com/c/go/+/557836 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Alan Donovan <adonovan@google.com>
2024-04-26all: rename internal/safefilepath to internal/filepathliteDamien Neil
The safefilepath package was originally added to contain the FromFS function. We subsequently added FromFS to path/filepath as Localize. The safefilepath package now exists only to permit the os package to import Localize. Rename safefilepath to filepathlite to better indicate that it's a low-dependency version of filepath. Change-Id: I4c5f9b28e8581f841947b48c5cac9954cd0c9535 Reviewed-on: https://go-review.googlesource.com/c/go/+/581517 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Ian Lance Taylor <iant@google.com>