Commit graph

60336 commits

Author SHA1 Message Date
Clide Stefani d67839f58a crypto/tls: add support for -expect-version to bogo_shim_test
The existing implementation of bogo_shim_test does not support tests
that use the expect-version flag.
This change adds support for this flag.

Updates #51434.

Change-Id: Ie23fdb06d15ec0593ca58f28144e83f93ef7f200
Reviewed-on: https://go-review.googlesource.com/c/go/+/592635
Auto-Submit: Roland Shoemaker <roland@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Reviewed-by: David Chase <drchase@google.com>
2024-06-21 18:11:08 +00:00
Austin Clements 201129414f sync/atomic: correct result names for Or methods
A few of the new Or methods of the atomic types use "new" as the name
for the result value, but it actually returns the old value. Fix this
by renaming the result values to "old".

Updates #61395.

Change-Id: Ib08db9964f5dfe91929f216d50ff0c9cc891ee49
Reviewed-on: https://go-review.googlesource.com/c/go/+/593855
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Austin Clements <austin@google.com>
Reviewed-by: Mauri de Souza Meneguzzo <mauri870@gmail.com>
2024-06-21 15:46:03 +00:00
Russ Cox 20b79fd577 time: provide non-default metric for asynctimerchan
The original implementation could not support a non-default metric,
but now that it is set during package time, we can. Do that.


Change-Id: If7929b0afa5b0142d299718d9bd811c5a8d1cf93
Reviewed-on: https://go-review.googlesource.com/c/go/+/589058
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-06-21 12:36:22 +00:00
Damien Neil 9d33956503 internal/godebugs: fix old value for httpservecontentkeepheaders
The pre-Go 1.23 behavior is httpservecontentkeepheaders=1.

For #66343

Change-Id: If6f92853b38522f19a8908ff11ac49b12f3dc3e0
Reviewed-on: https://go-review.googlesource.com/c/go/+/593775
Reviewed-by: David Chase <drchase@google.com>
Auto-Submit: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-06-20 17:46:05 +00:00
Cuong Manh Le 477ad7dd51 cmd/compile: support generic alias type
Type parameters on aliases are now allowed after #46477 accepted.

Updates #46477
Fixes #68054

Change-Id: Ic2e3b6f960a898163f47666e3a6bfe43b8cc22e2
Reviewed-on: https://go-review.googlesource.com/c/go/+/593715
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Robert Griesemer <gri@google.com>
2024-06-20 16:46:54 +00:00
Kir Kolyshkin 4f77a83589 internal/syscall/unix: fix UTIME_OMIT for dragonfly
CL 219638 added UTIME_OMIT values for various systems. The value for
DragonFly BSD appears to be incorrect.

The correct value is -2 (see references below), while -1 is used for
UTIME_NOW. As a result, timestamp is changed to the current time instead
of not touching. This should have been caught by the accompanying test
case, TestChtimesWithZeroTimes, but its failures are essentially skipped
on dragonfly (this is being fixed separately in a followup CL 591535).

Improve formatting while at it.

References:
 - https://github.com/DragonFlyBSD/DragonFlyBSD/blob/965b380e9609/sys/sys/stat.h#L284
 - https://go.googlesource.com/sys/+/refs/tags/v0.20.0/unix/zerrors_dragonfly_amd64.go#1421

Change-Id: I432360ca982c84b7cd70d0cf01d860af9ff985fa
Reviewed-on: https://go-review.googlesource.com/c/go/+/589496
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Commit-Queue: Ian Lance Taylor <iant@golang.org>
2024-06-18 22:25:08 +00:00
Damien Neil 879ace1434 net/http: keep Content-Encoding in Error, add GODEBUG for ServeContent
This reverts the changes to Error from CL 571995, and adds a
GODEBUG controlling the changes to ServeContent/ServeFile/ServeFS.

The change to remove the Content-Encoding header when serving an error
breaks middleware which sets Content-Encoding: gzip and wraps a
ResponseWriter in one which compresses the response body.

This middleware already breaks when ServeContent handles a Range request.
Correct uses of ServeContent which serve pre-compressed content with
a Content-Encoding: gzip header break if we don't remove that header
when serving errors. Therefore, we keep the change to ServeContent/
ServeFile/ServeFS, but we add the ability to disable the new behavior
by setting GODEBUG=httpservecontentkeepheaders=1.

We revert the change to Error, because users who don't want to include
a Content-Encoding header in errors can simply remove the header
themselves, or not add it in the first place.

Fixes #66343

Change-Id: Ic19a24b73624a5ac1a258ed7a8fe7d9bf86c6a38
Reviewed-on: https://go-review.googlesource.com/c/go/+/593157
Reviewed-by: Russ Cox <rsc@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-06-18 19:33:10 +00:00
Sam Thanawalla 2b12bbcb45 doc/next: update release notes for go list -m -json
For #65614

Change-Id: I49921aefb79efbc012e745cc2abd9ff36c0a9149
Reviewed-on: https://go-review.googlesource.com/c/go/+/593495
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Sam Thanawalla <samthanawalla@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2024-06-18 19:07:25 +00:00
Dmitri Shuralyov cef0a2ecfb all: update vendored golang.org/x/tools
Pull in CL 593297:

	f2d2ebe4 go/analysis/passes/buildtag: retire Go 1.15 support

Along with other changes that have landed into x/tools.
This fixes a vet failure reported on longtest builders.

For #66092.

Change-Id: I549cc3f8e2c2033fe961bf014ff8cc1998021538
Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest
Reviewed-on: https://go-review.googlesource.com/c/go/+/593376
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
TryBot-Bypass: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
2024-06-18 18:48:10 +00:00
Michael Matloob 2ade9856f1 doc/next: add release notes for telemetry and the godebug directive
For #65614

Change-Id: I6274bdaba970cfb085af500fdaf8ed078202bfdc
Reviewed-on: https://go-review.googlesource.com/c/go/+/591380
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-06-18 17:57:51 +00:00
Roland Shoemaker 4cf2b02548 misc/ios: rework exec wrapper to only support simulator
This updates the tools used to execute Go binaries on the Apple iOS
Simulator to (a) work with newer arm64 macOS, (b) remove support
for running binaries on physical devices, and (c) remove the reliance on
LLDB and third-party Python packages. This makes the wrapper somewhat
simpler, and easier to understand and maintain. Additionally
clangwrap.sh is updated to reflect dropping support for targeting
physical devices.

This smoothes out the path for #66360.

Change-Id: I769127e65f5e8c6c727841168890fd8557fb0e1d
Reviewed-on: https://go-review.googlesource.com/c/go/+/573175
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2024-06-18 16:32:49 +00:00
Sam Thanawalla e44fa1c1a9 cmd/go: fix go list -u -m all with too new retractions dependency
Previously, go would not report retractions of dependencies that have a
newer version of Go. With this change, we will still display retractions despite a version difference when go list -u -m is used.

Fixes: #66403

Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest,gotip-windows-amd64-longtest
Change-Id: I6406680235e294269836ae4cbe3d5680ca10eea0
Reviewed-on: https://go-review.googlesource.com/c/go/+/588775
Auto-Submit: Sam Thanawalla <samthanawalla@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-06-18 15:33:06 +00:00
Roland Shoemaker b691da9f78 Revert "crypto/x509: reject serial numbers longer than 20 octets"
This reverts commit 8524931a2c.

Reason for revert: It turns out, basically no one in private PKIs can
get this right. It causes way too much breakage, and every other impl
also ignores it, so we'll continue to be in good company.

Change-Id: I2da808b411ec12f72112c49079faf9f68ae465c9
Reviewed-on: https://go-review.googlesource.com/c/go/+/589615
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
2024-06-18 15:27:01 +00:00
Roland Shoemaker 45446c867a doc: add note about x509sha1 removal in 1.24
Updates #62048

Change-Id: I17f462841a80db2216806147f0a0548f95c5e21a
Reviewed-on: https://go-review.googlesource.com/c/go/+/586718
Auto-Submit: Roland Shoemaker <roland@golang.org>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2024-06-18 01:40:18 +00:00
Dmitri Shuralyov 3e10c1ff81 doc/next: improve wording for proposal 67061
For #67061.
For #65614.

Change-Id: I0e324b02537e0d40c2092139d31941a1a85a0e69
Reviewed-on: https://go-review.googlesource.com/c/go/+/592196
Reviewed-by: Roland Shoemaker <roland@golang.org>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
TryBot-Bypass: Dmitri Shuralyov <dmitshur@golang.org>
2024-06-18 01:14:50 +00:00
thepudds 77cc7fbc84 doc/next: add motivation and details links for range-over-func iterators
The "Changes to the language" section at the top of the release notes
will likely ultimately include more explanation about iterators, or at
least, the Go project will likely publish additional introductory
material on iterators on the blog and so on.

As a perhaps temporary step given current interest, this CL updates the
release notes with two additional links for details and motivation.

The new package documentation for the iter package is up-to-date,
precise, and also more accessible than the language spec, while the 2022
pre-proposal GitHub discussion starts with perhaps the most compelling
motivation writeup so far. (We purposefully include "2022" in the text
to help illustrate this was not the result of an overly hasty process).

We also update the target of the existing language spec reference to be
closer to the new material.

For #61405.

Change-Id: I4bc0f99c40f31edfc5c0e635dca5f844b26b6eeb
Reviewed-on: https://go-review.googlesource.com/c/go/+/592935
Reviewed-by: Mauri de Souza Meneguzzo <mauri870@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-06-17 22:41:42 +00:00
Sam Thanawalla 144c96fac3 cmd/go: set GoVersion for files on the command line with vet
For: #65612
Fixes: #66092

For now, we will align the behavior such that vet and the compiler agree
that gover.Local() will be used for command-line-files.

We expect to change this to set the goversion as the containing module's go
version.

Change-Id: If7f2ea3a82e8e876716f18dacc021026de175a93
Reviewed-on: https://go-review.googlesource.com/c/go/+/593156
Reviewed-by: Michael Matloob <matloob@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Sam Thanawalla <samthanawalla@google.com>
2024-06-17 21:04:41 +00:00
Briheet Singh Yadav 22cf1e7f7e go/doc: added the predeclared identifiers clear, min, max
Fixes: #68028

Change-Id: Ib341b9f57b001cccc5dc9e822b7feaabcdb77e63
GitHub-Last-Rev: 8dd3467016
GitHub-Pull-Request: golang/go#68029
Reviewed-on: https://go-review.googlesource.com/c/go/+/593015
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Mauri de Souza Meneguzzo <mauri870@gmail.com>
Reviewed-by: Robert Griesemer <gri@google.com>
2024-06-17 17:35:24 +00:00
Joel Sing 8f5c6904b6 syscall: selectively update zerrors_* on openbsd/386, openbsd/arm and openbsd/amd64
The EBADMSG, ENOTRECOVERABLE, EOWNERDEAD and EPROTO Errno are missing
on openbsd/386, openbsd/arm and openbsd/amd64. These are the earliest
OpenBSD ports and they did not exist in the system headers when the
relevant zerror_* file was generated.

These exist for all other ports, hence it makes sense to add them
for consistency. Update error and signal strings so that they are
also consistent across OpenBSD ports.

Fixes #67998

Change-Id: I948857ef5bddcfbcdfb102c95e571d9cee009e77
Reviewed-on: https://go-review.googlesource.com/c/go/+/592795
Reviewed-by: Mauri de Souza Meneguzzo <mauri870@gmail.com>
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: Ian Lance Taylor <iant@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2024-06-16 23:08:08 +00:00
Russ Cox fe36ce669c iter: add doc comment from proposal
Add the doc comment from the proposal, lightly edited.
The edits are to drop mention of value-error Seq2 usage
and to adjust for the bool result changes.

Fixes #61897.

Change-Id: Iaffbaa301064b2f8739956d602ca5fa23c89a269
Reviewed-on: https://go-review.googlesource.com/c/go/+/591096
Auto-Submit: Russ Cox <rsc@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-06-14 22:40:29 +00:00
David Chase f27a40ce5f cmd/compile: give the closure generated for rangefunc bodies a name.
The generated name has the form "#yield%d" for %d = 1, 2, 3, ...
This may help the debugger connect execution within a rangefunc
loop's body to the frame containing the rest of the source code.
(It may not actually be necessary; we need to confirm with Alessandro
Aarzilli or someone else on the Delve team.)

Change-Id: Iabbb2ea5604a4bc1558c160819ac80197e1f2242
Reviewed-on: https://go-review.googlesource.com/c/go/+/592175
Reviewed-by: Than McIntosh <thanm@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Alessandro Arzilli <alessandro.arzilli@gmail.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2024-06-14 17:20:58 +00:00
Than McIntosh a85b8810c4 cmd/go: fix problems with coverage percentage reporting w/ -coverpkg
This patch resolves a set of problems with "percent covered" metrics
reported when the "-coverpkg" is in effect; these bugs were introduced
in Go 1.22 with the rollout of CL 495452 and related changes.
Specifically, for runs with multiple packages selected but without
-coverpkg, "percent covered" metrics were generated for package P not
based just on P's statements but on the entire corpus of statements.

Fixes #65570.

Change-Id: I38d61886cb46ebd38d8c4313c326d671197c3568
Reviewed-on: https://go-review.googlesource.com/c/go/+/592205
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
2024-06-14 11:46:05 +00:00
Than McIntosh 7196db9e66 internal/coverage: refactor EmitPercent in preparation for bugfix
Refactor cformat.EmitPercent to accept a package filter (list of
packages to report). This is a no-op in terms of exposed coverage
functionality, but we will need this feature in a subsequent patch.

Updates #65570.

Change-Id: I04ddc624a634837ea31c12ec395aa1295a0ea1f1
Reviewed-on: https://go-review.googlesource.com/c/go/+/592204
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
2024-06-14 11:45:22 +00:00
Than McIntosh 1683628d29 cmd/go: fix handling of builtin packages in WriteCoverMetaFilesFile
In certain unusual situations we can wind up with a build action for a
dummy (built-in) package as a dependency for the writeCoverMeta
pseudo-action generated when -coverpkg is in effect; this was causing
a panic in WriteCoverMetaFilesFile when it discovered a predecessor
whose Mode field was not "build". Update the code that constructs deps
for writeCoverMeta action to skip dummy builds.

Fixes #67953.

Change-Id: If747aeb9bae061c84290d1e10f6ea7abb0828aca
Reviewed-on: https://go-review.googlesource.com/c/go/+/592202
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
2024-06-14 11:44:29 +00:00
Benson Margulies 6d93de2c11 slices: add documentation on incomparable items in SortFunc
Change-Id: Ib289008c0e9b5e83c37c9b6b316f3f5de8ac339a
Reviewed-on: https://go-review.googlesource.com/c/go/+/592617
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>
2024-06-13 23:38:42 +00:00
Than McIntosh d06c9b4ea1 cmd/go: fix "go test -n -cover" glitch with no-test packages
Invoking "go test -n -cover ./..." on a collection of packages that
includes at least one package with code but no tests can result in
spurious error of the form

  my/package: open $WORK/b112/covmeta.b07a5f2dff1231cae3a6bdd70c8cc7c19da16abf8ac59747d8e9859c03594d37: no such file or directory

This patch fixes this issue by ensuring that we stub out some of the
meta-data file handling for no-test packages if "-n" is in effect.

Fixes #67952.

Change-Id: Ic6160c275abdec5e5b8beecc6a59accb2b8cfe7d
Reviewed-on: https://go-review.googlesource.com/c/go/+/592201
Reviewed-by: Michael Matloob <matloob@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-06-13 20:51:32 +00:00
Robert Griesemer adc5b559db spec: adjust for-range prose to include iterator functions where missing
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-13 20:48:21 +00:00
Robert Griesemer 69e7b2bcd6 go/types, types2: typecheck cases even if switch expression is invalid
Rather than returning right away when the switch expression is invalid,
continue type checking the type switch case.

The code was already written to be able to deal with an invalid switch
expression but it returned early nevertheless. Remove the early return
and rewrite the switch expression test slightly to better control the
scope of the x operand, leading to cleaner code.

In the process replace a tricky use of the x operand with a use of the
sx operand (plus guard, since sx may be nil if invalid).

Fixes #67962.

Change-Id: I1dc08d10078753c68449637622beb4018ed23803
Reviewed-on: https://go-review.googlesource.com/c/go/+/592555
Reviewed-by: Robert Findley <rfindley@google.com>
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>
2024-06-13 20:48:17 +00:00
Michael Matloob dbe03e4831 cmd/go: call telemetry.MaybeChild at start of go command
Call the new telemetry.MaybeChild function at the start of the go
command so that the child process logic can be run immediately without
running toolchain selection if this is the child process.

The Start function in the telemetry shim package has been renamed to
OpenCounters to make it clear that that's its only function.

The StartWithUpload function in the telemetry shim package has been
renamed to MaybeParent because that's its actual effective behavior in
cmd/go, the only place it's called: it won't run as the child because
MaybeChild has already been called and would have run as the child if
the program was the telemetry child, and it won't open counters because
telemetry.Start has been called. Checks are added that those functions
are always called before so that the function name and comment are
accurate.

It might make sense to add a true telemetry.MaybeParent function that
doesn't try to start the child or open counters to make things a little
simpler.

Change-Id: Ie81e2418af85cef18ec41f75db66365f6597b8b1
Reviewed-on: https://go-review.googlesource.com/c/go/+/592535
Reviewed-by: Robert Findley <rfindley@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-06-13 19:19:47 +00:00
Than McIntosh 956f8a67dd internal/coverage/cfile: harden the coverage snapshot test
The existing testpoint TestCoverageSnapshot will fail if we happen to
be selecting a set of packages for inclusion in the profile that don't
include internal/coverage/cfile. Example:

 $ cd `go env GOROOT`
 $ cd src/internal/coverage
 $ go test -coverpkg=internal/coverage/decodecounter ./...
 ...
  --- FAIL: TestCoverageSnapshot (0.00s)
      ts_test.go:102: 0.276074 0.276074
      ts_test.go:104: erroneous snapshots, C1 >= C2 = true C1=0.276074 C2=0.276074

To ensure that this doesn't happen, extract the test in question out
into a separate file with a special build tag, and then have the
original testpoint do a "go test -cover -tags ... " run to make sure
that for that specific test run the cfile package is instrumented.

Fixes #67951.

Change-Id: I8ac6e07e1a6d93275b8c6acabfce85e04c70a102
Reviewed-on: https://go-review.googlesource.com/c/go/+/592200
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
2024-06-13 16:44:49 +00:00
Than McIntosh 7bfc82429c cmd/link: use path from "cc --print-prog-name ar" for c-archive buildmode
[This is a roll-forward of CL 479775, which had to be rolled back due
to bad interactions with the wrappers used by the ios-arm64-corellium
builder. ios-arm64-corellium is no longer being maintained AFAICT,
meaning that it should be ok to move ahead with this patch again].

When external linking with -buildmode=c-archive, the Go linker
eventually invokes the "ar" tool to create the final archive library.
Prior to this patch, if the '-extar' flag was not in use, we would
just run "ar". This works well in most cases but breaks down if we're
doing cross-compilation targeting Windows (macos system "ar"
apparently doesn't create the windows symdef section correctly). To
fix the problem, capture the output of "cc --print-prog-name ar" and
invoke "ar" using the path returned by that command.

Fixes #59221.

Change-Id: Ie367541b23641266a6f48ac68adf971501bff9fb
Reviewed-on: https://go-review.googlesource.com/c/go/+/592375
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2024-06-13 16:35:16 +00:00
Michael Matloob a2026cf0d9 cmd: vendor golang.org/x/telemetry@8cad58b
Commands run:
	go get golang.org/x/telemetry@8cad58b
	go mod tidy
	go mod vendor

Change-Id: I81d37835c6828a8a6a40f21e4e39a0e282aca927
Reviewed-on: https://go-review.googlesource.com/c/go/+/592255
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-06-13 16:11:04 +00:00
Robert Griesemer 8219848c94 spec: allow range-over-func to omit iteration variables
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-13 15:47:54 +00:00
Robert Griesemer e15cc7ab82 go/types, types2: allow range-over-func to omit iteration variables
For #65236.

Change-Id: I63e57c1d8e9765979e9e58b45948008964b32384
Reviewed-on: https://go-review.googlesource.com/c/go/+/592176
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>
Auto-Submit: Robert Griesemer <gri@google.com>
2024-06-13 15:47:50 +00:00
Than McIntosh ca5ba146da cmd/compile/internal: add a PGO devirt post-lookup cleanup hook
The PGO-based devirtualization helper pgoir.addIndirectEdges makes a
series of calls into the unified IR reader to import functions that
would not normally be imported but may be the target of a hot indirect
call from the current package. This importing primarily targets at
non-generic functions and methods, but as part of the process we can
encounter types that have methods (including generic methods) whose
bodies need to be read in. When the reader encounters an inlinable
func of this sort, it may (depending on the context) decide not to
read the body right away, but instead adds the func to a list
("todoBodies") to be read in later on in a more convenient context.

In the bug in question, a hot method lookup takes place in
pgoir.addIndirectEdges, and as part of the import process we wind up
with a type T with method M that is in this partially created state,
and in addition T gets added to the unified IR's list of types that
may need method wrappers. During wrapper generation we create a new
wrapper "(*T).M" whose body has a call to "T.M", then farther on down
the pike during escape analysis we try to analyze the two functions;
this causes a crash due to "T.M" being in partially constructed state.

As a fix, add a new "PostLookupCleanup" hook (in the unified IR
reader) that pgoir.addIndirectEdges can invoke that takes care of
reading in the bodies of any functions that have been added to the
"todoBodies" list.

[Note: creating a test case for this problem is proving to be very
tricky; a new test will be added in a subsequent patch].

Fixes #67746.

Change-Id: Ibc47ee79e08a55421728d35341df80a865231cff
Reviewed-on: https://go-review.googlesource.com/c/go/+/591075
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-06-12 20:40:04 +00:00
Dmitri Shuralyov 97bc577812 doc/next: improve description of proposal 61308
For #61308.
For #65614.

Change-Id: I36b4f2392075d5a3fb9f53a28bd19b997e7be363
Reviewed-on: https://go-review.googlesource.com/c/go/+/592197
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
TryBot-Bypass: Dmitri Shuralyov <dmitshur@golang.org>
2024-06-12 18:56:34 +00:00
Cherry Mui 3622ad9705 doc/next: reword map iterator function notes
The notes don't define identifiers m and seq. Describe in words
instead.

While here, rename 3-structs.md to 4-structs.md.

For #65614.

Change-Id: I6690f552903d1870c70e28673c87ac84b7c5c041
Reviewed-on: https://go-review.googlesource.com/c/go/+/592195
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-06-12 18:30:46 +00:00
Ian Lance Taylor ee4a42bd58 net: add GODEBUG=netedns0=0 to disable sending EDNS0 header
It reportedly breaks the DNS server on some modems.

For #6464
For #21160
For #44135
For #51127
For #51153
Fixes #67925

Change-Id: I54a11906159f00246d08a54cc8be7327e9ebfd2c
Reviewed-on: https://go-review.googlesource.com/c/go/+/591995
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2024-06-12 17:31:13 +00:00
Cherry Mui b589478af7 cmd/link: put runtime.end in the last section of data segment
Currently the runtime.end symbol is put into the noptrbss section,
which is usually the last section, except that when fuzzing is
enabled, the last section is actually .go.fuzzcntrs. The
runtime.end symbol has the value pointing to the end of the data
segment, so if it is not in the last section, the value will not
actually be in the range of the section. This causes an assertion
failure in the new Apple linker. This CL fixes this by putting it
in the last section.

Fixes #65169.

Change-Id: I5c991c46a0483a96e5f6e0255a3b444953676026
Reviewed-on: https://go-review.googlesource.com/c/go/+/592095
Reviewed-by: Than McIntosh <thanm@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-06-12 15:10:50 +00:00
Michael Pratt b788e91bad os: always return syscall.ECHILD from Wait for done process
For processes that don't exist at lookup time, CL 570036 and CL 588675
make Wait return unconditionally return ErrProcessDone when using pidfd,
rather than attempting to make a wait system call.

This is consistent with Signal/Kill, but inconsistent with the previous
behavior of Wait, which would pass through the kernel error,
syscall.ECHILD.

Switch the ErrProcessDone case to return syscall.ECHILD instead for
consistency with previous behavior.

That said, I do think a future release should consider changing ECHILD
to ErrProcessDone in all cases (including when making an actual wait
system call) for better consistency with Signal/Kill/FindProcess.

Fixes #67926.

Cq-Include-Trybots: luci.golang.try:gotip-darwin-amd64_14,gotip-solaris-amd64,gotip-openbsd-amd64
Change-Id: I1f688a5751d0f3aecea99c3a5b35c7894cfc2beb
Reviewed-on: https://go-review.googlesource.com/c/go/+/591816
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Kirill Kolyshkin <kolyshkin@gmail.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2024-06-11 18:08:44 +00:00
Clide Stefani 4b8f80707f crypto/tls: improve error log produced during TestBogoSuite
The existing implementation logs some errors to the results file created in TestBogoSuite.
This change would additionally log json errors to the results file.

Change-Id: Ib1a6f612ed83f6c5046531ee259c4e85dd71402a
Reviewed-on: https://go-review.googlesource.com/c/go/+/591379
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-06-11 17:25:39 +00:00
Cherry Mui 04b5d13256 doc/next: document GORISCV64 environment variable
For #65614.
Updates #61476.

Change-Id: Id677aa6d2a59366ab75a26f08a383d2d253f270e
Reviewed-on: https://go-review.googlesource.com/c/go/+/591895
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Joel Sing <joel@sing.id.au>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2024-06-11 17:18:52 +00:00
Cherry Mui 1554e87c19 doc/next: document GOARM64 environment variable
For #65614.
Updates #60905.

Change-Id: I2dd9df3c7066357cf06268d918bad3c255b38aed
Reviewed-on: https://go-review.googlesource.com/c/go/+/591875
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Joel Sing <joel@sing.id.au>
2024-06-11 17:18:41 +00:00
Cherry Mui 816538d517 doc/next: document locking down linkname usages
For #65614.
Updates #67401.

Change-Id: Ib38c134ea7ffc69434c79600ba75185e02809d0f
Reviewed-on: https://go-review.googlesource.com/c/go/+/591898
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Than McIntosh <thanm@google.com>
2024-06-11 17:18:10 +00:00
Jes Cok 35d721b0cb time: correct spelling, queing -> queuing
Change-Id: I418953a766db22b134a9569161f06cf8682c1eef
Reviewed-on: https://go-review.googlesource.com/c/go/+/591336
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2024-06-11 17:10:37 +00:00
Dana Burkart b3a57e43c7 time: add to format documentation about dangers of using RFC1123{,Z} for parsing
When using time.RFC1123Z to parse the date header value out of an email,
an error is returned for dates that occur in the first 9 days of a
month. This is because the format strings for RFC 1123 defined in the
time package indicate that the day should be prefixed with a leading 0.

Reading the spec, the line that talks about it seems to indicate that
days can be either 1 or 2 digits:

  `date = 1*2DIGIT month 2*4DIGIT`

So a date header with a day like `7` with no leading zero should be
accepted.

Fixes #67887

Change-Id: Ie7ee40d94da2c8c0417957e8b89f9987314949c8
GitHub-Last-Rev: 22a5a52fcb
GitHub-Pull-Request: golang/go#67888
Reviewed-on: https://go-review.googlesource.com/c/go/+/591335
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2024-06-11 17:09:28 +00:00
Kir Kolyshkin 3b6aa03c12 os: RemoveAll: fix error returned
When unlink fails, it is not yet known if the argument is a directory or not.
Since CL 588495, we figure out if it's a directory when trying to open
it (and, for a directory, return the original unlink error).

The (very minor) issue is, in case of a symlink, a different error is
returned -- usually it's ELOOP, but some systems use other values. Let's
account for that error code, too.

This is a followup to CL 588495.

Change-Id: I4ee10fe9b57f045fbca02f13e5c9ea16972803bc
Reviewed-on: https://go-review.googlesource.com/c/go/+/589376
Reviewed-by: Michael Pratt <mpratt@google.com>
Run-TryBot: Kirill Kolyshkin <kolyshkin@gmail.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2024-06-11 17:09:26 +00:00
Ben Hoyt aed1f925f2 os/user: make Lookup* functions properly handle ENOENT
The libc docs say that these functions can return ENOENT, and
per issue #67912, this does happen in practice sometimes. Handle
both the ENOENT and !found cases the same way, for Lookup,
LookupId, LookupGroup, LookupGroupId.

Fixes #67912

Change-Id: I993935af44c83ad785b6cd735fc313a3647daa19
Reviewed-on: https://go-review.googlesource.com/c/go/+/591555
Reviewed-by: 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: Michael Pratt <mpratt@google.com>
2024-06-11 17:08:14 +00:00
Cherry Mui 5d85004622 cmd/go: update link to RISC-V profile doc
The URL has changed.

Change-Id: I295020c59aaf64a89c4307fca527163095148a67
Reviewed-on: https://go-review.googlesource.com/c/go/+/591897
Reviewed-by: Joel Sing <joel@sing.id.au>
Reviewed-by: M Zhuo <mengzhuo1203@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Mark Ryan <markdryan@rivosinc.com>
2024-06-11 16:54:28 +00:00
Cherry Mui 6165bb11d7 doc/next: resolve a TODO for openbsd/riscv64 port
I think we want to keep the "experimental" as we did before. Also
added "64-bit" to be more specific.

For #65614.

Change-Id: I928d0ba6f1b53efa1f882f81f68bfb2446c7ab42
Reviewed-on: https://go-review.googlesource.com/c/go/+/591896
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Joel Sing <joel@sing.id.au>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-06-11 16:54:08 +00:00