aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2025-06-16cmd/dist: always include variant in package namesMichael Anthony Knyszek
Our attempt to evenly distribute tests across shards struggles a bit because certain long-running targets are very difficult to distinguish in ResultDB, namely racebench and the test directory tests. These are the only tests where the JSON output from dist omits the variant from the package, making it impossible to distinguish them in the test result data. My current suspicion is that this is preventing the load balancing from being effective for the race builders in particular, though I worry the longtest builders have a similar situation with the test directory tests. For #65814. Change-Id: I5804c2af092ff9aa4a3f0f6897b4a57c4628f837 Reviewed-on: https://go-review.googlesource.com/c/go/+/681955 Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> TryBot-Bypass: Michael Knyszek <mknyszek@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2025-06-16internal/reflectlite: fix comment about meaning of flag fieldKeith Randall
Copied current (presumably correct) comment text from reflect package. Change-Id: I19582b3675fbcb96a925002498d24ad2b7bc6178 Reviewed-on: https://go-review.googlesource.com/c/go/+/681935 Reviewed-by: Keith Randall <khr@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: David Chase <drchase@google.com>
2025-06-16runtime: don't let readTrace spin on trace.shutdownMichael Anthony Knyszek
Issue #74045 describes a scenario in which gopark is inlined into readTrace, such that there are no preemption points. This is only a problem because readTrace spins if trace.shutdown is set, through traceReaderAvailable. However, trace.shutdown is almost certainly overkill for traceReaderAvailable. The first condition, checking whether the reader gen and the flushed gen match, should be sufficient to ensure the reader wakes up and finishes flushing all buffers. The first condition is also safe because it guarantees progress. In the case of shutdown, all the trace work that will be flushed has been flushed, and so the trace reader will exit into a regular goroutine context when it's finished. If not shutting down, then the trace reader will release doneSema, increase readerGen, and then the gopark unlockf will let it block until new work actually comes in. Fixes #74045. Change-Id: Id9b15c277cb731618488771bd484577341b68675 Reviewed-on: https://go-review.googlesource.com/c/go/+/680738 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Nick Ripley <nick.ripley@datadoghq.com> Reviewed-by: Michael Pratt <mpratt@google.com> Auto-Submit: Michael Knyszek <mknyszek@google.com>
2025-06-16internal/trace: make Value follow reflect conventionsMichael Anthony Knyszek
A previous change renamed Value.Uint64 to Value.ToUint64 to accomodate string values. The method for a string value is then Value.ToString, while the method for a debug string (for example, for fmt) is just called String, as per fmt.Stringer. This change follows a request from Dominik Honnef, maintainer of gotraceui, to make Value follow the conventions of the reflect package. The Value type there has a method String which fulfills both purposes: getting the string for a String Value, and as fmt.Stringer. It's not exactly pretty, but it does make sense to just stick to convention. Change-Id: I55b364be88088d2121527bffc833ef03dbdb9764 Reviewed-on: https://go-review.googlesource.com/c/go/+/680978 Reviewed-by: Florian Lehner <lehner.florian86@gmail.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Carlos Amedee <carlos@golang.org>
2025-06-13runtime: comment that some linknames are used by runtime/traceCherry Mui
Change-Id: I118d1ee09dfd6fd0075f9e5eeeb54441328bff4d Reviewed-on: https://go-review.googlesource.com/c/go/+/681495 Reviewed-by: Michael Knyszek <mknyszek@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Carlos Amedee <carlos@golang.org>
2025-06-13runtime: remove unused unique.runtime_blockUntilEmptyFinalizerQueueCherry Mui
It was added in CL 650256, and then the use in the unique package was removed in CL 650697. Change-Id: Id95f5dff7e11a2dc3eb544fda2586a305d3d91ab Reviewed-on: https://go-review.googlesource.com/c/go/+/681476 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Knyszek <mknyszek@google.com>
2025-06-13cmd/link: block new standard library linknamesCherry Mui
In Go 1.25 we added a number of new linknames for standard library internal uses. Add them to the linker's blocklist to keep them internal. Change-Id: I5b6051a669b7ff132a1d2c05deefbbf74701c5d5 Reviewed-on: https://go-review.googlesource.com/c/go/+/681475 Reviewed-by: Michael Knyszek <mknyszek@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-06-12all: replace a few user-visible mentions of golang.org and godoc.orgAlberto Donizetti
This change replaces a few user-visible mentions of golang.org and godoc.org with go.dev and pkg.go.dev, respectively. Non-user-visible mentions (e.g. in test scripts) were left untouched. Change-Id: I5d828edcd618b6c55243d0dfcadc6fa1ce9422ce Reviewed-on: https://go-review.googlesource.com/c/go/+/681255 Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2025-06-12internal/trace: end test programs with SIGQUITMichael Anthony Knyszek
This change switches from using testenv.Command to testenv.CommandContext which is a little bit friendlier. It also switches away from using 'go run' to 'go build' and running the resulting binary explicitly. This helps eliminate any questions about signal handling and propagation. For #72740. Change-Id: Ife8010da89a7bc439e061fe0c9c6b1f5620d90f1 Reviewed-on: https://go-review.googlesource.com/c/go/+/680977 Reviewed-by: Carlos Amedee <carlos@golang.org> TryBot-Bypass: Michael Knyszek <mknyszek@google.com>
2025-06-12net: remove some BUG entriesCherry Mui
A few methods that were not implemented on Windows are implemented in CL 668195. Change-Id: I35423792a5af00f29fcd24e56a6dfcf013669371 Reviewed-on: https://go-review.googlesource.com/c/go/+/680180 Reviewed-by: Quim Muntal <quimmuntal@gmail.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Carlos Amedee <carlos@golang.org>
2025-06-11encoding/json/jsontext, encoding/json/v2: document experimental natureDamien Neil
Change-Id: I7b2c391749e0113e006f37b2ac1ebfe3ee0a4e0e Reviewed-on: https://go-review.googlesource.com/c/go/+/680715 TryBot-Bypass: Damien Neil <dneil@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Joseph Tsai <joetsai@digital-static.net> Auto-Submit: Damien Neil <dneil@google.com>
2025-06-11cmd/compile: add up-to-date test for generated filesDavid Chase
This runs the ssa/_gen generator writing files into a temporary directory, and then checks that there are no differences with what is currently in the ssa directory, and also checks that any file with the "generated from _gen/..." header was actually generated, and checks that the headers on the generated file match the expected header prefix. Change-Id: Ic8eeb0b06cf6f2e576a013e865b331a12d3a77aa Reviewed-on: https://go-review.googlesource.com/c/go/+/680615 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@google.com>
2025-06-10os: disallow Root.Remove(".") on Plan 9, js, and WindowsDamien Neil
Windows already forbids this, since removing the root causes a sharing violation (can't delete the directory while the os.Root has a handle open to it), but add a more explicit check for attempts to delete "." and return EINVAL. Note that this change to Windows doesn't affect operations like Root.Remove("dir/."), since the path is cleaned into just "dir" before attempting the deletion. Fixes #73863 Change-Id: I0f45ccb6c9f171d3a52831632c134150388d77b6 Reviewed-on: https://go-review.googlesource.com/c/go/+/679377 Auto-Submit: Damien Neil <dneil@google.com> Reviewed-by: Alan Donovan <adonovan@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-06-10runtime: handle system goroutines later in goroutine profilingMichael Anthony Knyszek
Before CL 650697, there was only one system goroutine that could dynamically change between being a user goroutine and a system goroutine, and that was the finalizer/cleanup goroutine. In goroutine profiles, it was handled explicitly. It's status would be checked during the first STW, and its stack would be recorded. This let the goroutine profiler completely ignore system goroutines once the world was started again. CL 650697 added dedicated cleanup goroutines (there may be more than one), and with this, the logic for finalizer goroutines no longer scaled. In that CL, I let the isSystemGoroutine check be dynamic and dropped the special case, but this was based on incorrect assumptions. Namely, it's possible for the scheduler to observe, for example, the finalizer goroutine as a system goroutine and ignore it, but then later the goroutine profiler itself sees it as a user goroutine. At that point it's too late and already running. This violates the invariant of the goroutine profile that all goroutines are handled by the profiler before they start executing. In practice, the result is that the goroutine profiler can crash when it checks this invariant (not checking the invariant means racily reading goroutine stack memory). The root cause of the problem is that these system goroutines do not participate in the goroutine profiler's state machine. Normally, when profiling, goroutines transition from 'absent' to 'in-progress' to 'satisfied'. However with system goroutines, the state machine is ignored entirely. They always stay in the 'absent' state. This means that if a goroutine transitions from system to user, it is eligible for a profile record when it shouldn't be. That transition shouldn't be allowed to occur with respect to the goroutine profiler, because the goroutine profiler is trying to snapshot the state of every goroutine. The fix to this problem is simple: don't ignore system goroutines. Let them participate in the goroutine profile state machine. Instead, decide whether or not to record the stack after the goroutine has been acquired for goroutine profiling. This means if the scheduler observes the finalizer goroutine as a system goroutine, it will get promoted in the goroutine profiler's state machine, and no other part of the goroutine profiler will observe the goroutine again. Simultaneously, the stack record for the goroutine will be correctly skipped. Fixes #74090. Change-Id: Icb9a164a033be22aaa942d19e828e895f700ca74 Reviewed-on: https://go-review.googlesource.com/c/go/+/680477 Reviewed-by: Carlos Amedee <carlos@golang.org> Auto-Submit: Michael Knyszek <mknyszek@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-06-10testing/synctest, runtime: avoid panic when using linker-alloc WG from bubbleDamien Neil
We associate WaitGroups with synctest bubbles by attaching a special to the WaitGroup. It is not possible to attach a special to a linker-allocated value, such as: var wg sync.WaitGroup Avoid panicking when accessing a linker-allocated WaitGroup from a bubble. We have no way to associate these WaitGroups with a bubble, so just treat them as always unbubbled. This is probably fine, since the WaitGroup was always created outside the bubble in this case. Fixes #74005 Change-Id: Ic71514b0b8d0cecd62e45cc929ffcbeb16f54a55 Reviewed-on: https://go-review.googlesource.com/c/go/+/679695 Reviewed-by: Michael Knyszek <mknyszek@google.com> Auto-Submit: Damien Neil <dneil@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-06-10internal/trace: pass GOTRACEBACK=crash to testprogsMichael Anthony Knyszek
The failures in #70310 are hard to decipher. The cases where the lock is being held either don't really make sense (the STW failures) or the goroutine that fails is 'running on another thread' and we don't get a stack trace. In fact, such a goroutine exists even in the STW cases. Since reproducing this is going to be hard (very few failures over a 2 year span) let's set GOTRACEBACK=crash for these testprogs so next time it happens we can see why. For #70310. Change-Id: I81a780aa82b173d42973f06911cb243f33352be1 Reviewed-on: https://go-review.googlesource.com/c/go/+/680476 Reviewed-by: Michael Pratt <mpratt@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Carlos Amedee <carlos@golang.org>
2025-06-10os: do not follow dangling symlinks in Root when O_CREATE|O_EXCL on AIXDamien Neil
OpenFile with O_CREATE|O_EXCL should not follow dangling symlinks. On AIX it does, because AIX's openat(2) apparently returns ELOOP in this case. Most Unices return EEXIST. Ensure that we never follow symlinks in the final component of the path when opening a file with O_CREATE|O_EXCL. Fixes #73924 Change-Id: I869afb7faefccb0bb29d155553a7d7e5be80467d Reviewed-on: https://go-review.googlesource.com/c/go/+/677735 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Damien Neil <dneil@google.com> Reviewed-by: Alan Donovan <adonovan@google.com>
2025-06-10net/http: make the zero value of CrossOriginProtection workAustin Clements
Currently, CrossOriginProtection must be constructed by NewCrossOriginProtection. If you try to use the zero value, most methods will panic with a nil dereference. This CL makes CrossOriginProtection use on-demand initialization instead, so the zero value has the same semantics as the value currently returned by NewCrossOriginProtection. Now, NewCrossOriginProtection just constructs the zero value. We keep NewCrossOriginProtection by analogy to NewServeMux. Updates #73626 Fixes #74089. Change-Id: Ia80183eb6bfdafb0e002271c0b25c2d6230a159a Reviewed-on: https://go-review.googlesource.com/c/go/+/680396 Auto-Submit: Austin Clements <austin@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Damien Neil <dneil@google.com>
2025-06-10cmd/dist: only install necessary tools when doing local testMichael Matloob
Instead of installing all of cmd, install only the tools that cmd/dist would normally install. Also, remove the addition of the buildid tool to the list of commands in the toolchain in debug mode. The uses of buildid were removed in CL 451360. For #71867 Change-Id: I062909d23c18294aa23ea43b9f7eeb69bfa80c8c Reviewed-on: https://go-review.googlesource.com/c/go/+/680475 Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Michael Matloob <matloob@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Michael Matloob <matloob@google.com>
2025-06-10runtime: don't do a direct G handoff in semrelease on systemstackMichael Anthony Knyszek
semrelease is safe to call on the system stack (since it just readies goroutines) except for the fact that it might perform a direct G handoff and call into the scheduler. If handoff is set to false this is exceptionally rare, but could happen, and has happened for the trace reader goroutine which releases a trace.doneSema. Fixes #73469. Change-Id: I37ece678bc4721bbb6e5879d74daac762b7d742a Reviewed-on: https://go-review.googlesource.com/c/go/+/680315 Auto-Submit: Michael Knyszek <mknyszek@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Carlos Amedee <carlos@golang.org>
2025-06-10all.{bash,rc}: use "../bin/go tool dist" instead of "%GOTOOLDIR%/dist" print ↵Guoqi Chen
build info After CL 677558, when running all.bash, the binaries of commands such as dist, nm, and pprof are no longer built by default, so when running all.bash, "./all.bash: line 13: /home/golang/pkg/tool/linux_amd64/dist: No such file or directory" will be printed, and the return result of the all.bash script is non-zero. Although the "dist" command won't be installed in $GOTOOLDIR anymore, but it will be built and cached, and ../bin/go tool dist will reuse the cached binary. For #71867 Change-Id: I802eeafdb866e7d80c42da3e0955bb32def7b037 Reviewed-on: https://go-review.googlesource.com/c/go/+/680135 Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Matloob <matloob@golang.org>
2025-06-09cmd/compile/internal/ssa: fix PPC64 merging of (AND (S[RL]Dconst ...)Paul Murphy
CL 622236 forgot to check the mask was also a 32 bit rotate mask. Add a modified version of isPPC64WordRotateMask which valids the mask is contiguous and fits inside a uint32. I don't this is possible when merging SRDconst, the first check should always reject such combines. But, be extra careful and do it there too. Fixes #73153 Change-Id: Ie95f74ec5e7d89dc761511126db814f886a7a435 Reviewed-on: https://go-review.googlesource.com/c/go/+/679775 Auto-Submit: Keith Randall <khr@golang.org> Reviewed-by: Jayanth Krishnamurthy <jayanth.krishnamurthy@ibm.com> Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Keith Randall <khr@golang.org>
2025-06-09runtime: use small struct TestSynctest to ensure cleanups runDamien Neil
Finalizers and cleanup funcs weren't running on the windows-arm64 builder. Put finalizers/cleanups on a small struct containing a pointer rather than an *int, which fixes the problem. Also uncomment a synctest.Wait that was accidentally commented out. Fixes #73977 Change-Id: Ia6f18d74d6fccf2c5a9222317977c7458d67f158 Reviewed-on: https://go-review.googlesource.com/c/go/+/679696 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Knyszek <mknyszek@google.com>
2025-06-09runtime: clarify stack traces for bubbled goroutinesDamien Neil
Use the synctest bubble ID to identify bubbles in traces, rather than the goroutine ID of the bubble's root goroutine. Some waitReasons include a "(synctest)" suffix to distinguish a durably blocking state from a non-durable one. For example, "chan send" vs. "chan send (synctest)". Change this suffix to "(durable)". Always print a "(durable)" sufix for the state of durably blocked bubbled goroutines. For example, print "sleep (durable)". Drop the "[not] durably blocked" text from goroutine states, since this is now entirely redundant with the waitReason. Old: goroutine 8 [chan receive (synctest), synctest bubble 7, durably blocked]: goroutine 9 [select (no cases), synctest bubble 7, durably blocked]: New: goroutine 8 [chan receive (durable), synctest bubble 1]: goroutine 9 [select (no cases) (durable), synctest bubble 1]: Change-Id: I89112efb25150a98a2954f54d1910ccec52a5824 Reviewed-on: https://go-review.googlesource.com/c/go/+/679376 Auto-Submit: Damien Neil <dneil@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Pratt <mpratt@google.com>
2025-06-09runtime: return a different bubble deadlock error when main goroutine is doneDamien Neil
The synctest.Test function waits for all goroutines in a bubble to exit before returning. If there is ever a point when all goroutines in a bubble are durably blocked, it panics and reports a deadlock. Panic with a different message depending on whether the bubble's main goroutine has returned or not. The main goroutine returning stops the bubble clock, so knowing whether it is running or not is useful debugging information. The new panic messages are: deadlock: all goroutines in bubble are blocked deadlock: main bubble goroutine has exited but blocked goroutines remain Change-Id: I94a69e79121c272d9c86f412c1c9c7de57ef27ef Reviewed-on: https://go-review.googlesource.com/c/go/+/679375 Auto-Submit: Damien Neil <dneil@google.com> Reviewed-by: Michael Pratt <mpratt@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-06-09cmd/internal/doc: increase version of pkgsite doc command that's runMichael Matloob
This will incorporate the changes in CL 675957, CL 677596, and CL 675958. For #73848 Change-Id: Ie3d313e055a36b5b7aafec4a7462a1ced8a9f923 Reviewed-on: https://go-review.googlesource.com/c/go/+/680176 Reviewed-by: Michael Matloob <matloob@google.com> Reviewed-by: Jonathan Amsterdam <jba@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-06-09cmd/compile: relax reshaping conditionCuong Manh Le
CL 641955 changes the Unified IR reader to not doing shapify when reading reshaping expression. However, this condition only matters with pointer type shaping, which will lose the original type, causes the reshaping ends up with a completely different type. This CL relaxes the condition, always allow non-pointer types shaping. Updates #71184 Fixes #73947 Change-Id: Ib0bafd8932c52d99266f311b6cbfc75c00383f9b Reviewed-on: https://go-review.googlesource.com/c/go/+/678335 Reviewed-by: Keith Randall <khr@golang.org> Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com> Reviewed-by: Keith Randall <khr@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Carlos Amedee <carlos@golang.org>
2025-06-09log/slog: fix level doc on handlersJonathan Amsterdam
Fixed doc on {JSON,Text}Handler.Handle: the level is never omitted. Fixes #73943. Change-Id: Ia470cbe5d713ab18dd80eeea1c0ab8f5e6d30f3f Reviewed-on: https://go-review.googlesource.com/c/go/+/680055 Auto-Submit: Jonathan Amsterdam <jba@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Jonathan Amsterdam <jba@google.com> Reviewed-by: Sean Liao <sean@liao.dev>
2025-06-07runtime: check for gsignal in racecall on loong64Guoqi Chen
This issue has been fixed for amd64, arm64 and other platforms in CL 643875, but it was missed when the race support was submitted for loong64. Fixes #71395. Change-Id: I678f381e868214f1b3399be43187db49e1660933 Reviewed-on: https://go-review.googlesource.com/c/go/+/679055 Reviewed-by: Meidan Li <limeidan@loongson.cn> Reviewed-by: Michael Knyszek <mknyszek@google.com> Reviewed-by: sophie zhao <zhaoxiaolin@loongson.cn> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Carlos Amedee <carlos@golang.org>
2025-06-06os/signal: doc link to syscall.EPIPEOlivier Mengué
Add godoc link for EPIPE error. Change-Id: I5df35f700684510328f92bb5d4946c5123ba5f2c Reviewed-on: https://go-review.googlesource.com/c/go/+/667757 Auto-Submit: Michael Knyszek <mknyszek@google.com> Reviewed-by: Michael Pratt <mpratt@google.com> Reviewed-by: Michael Knyszek <mknyszek@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-06-06all: update vendored dependencies [generated]Carlos Amedee
The Go 1.25 RC is due soon. This is the time to once again update all golang.org/x/... module versions that contribute packages to the std and cmd modules in the standard library to latest master versions. For #36905. [git-generate] go install golang.org/x/build/cmd/updatestd@latest go install golang.org/x/tools/cmd/bundle@latest updatestd -goroot=$(pwd) -branch=master cat << EOF | patch diff --git a/src/cmd/go/testdata/script/test_json_build.txt b/src/cmd/go/testdata/script/test_json_build.txt index df8863ae03..2a572ace72 100644 --- a/src/cmd/go/testdata/script/test_json_build.txt +++ b/src/cmd/go/testdata/script/test_json_build.txt @@ -56,7 +56,7 @@ stdout '"Action":"fail","Package":"m/cycle/p","Elapsed":.*,"FailedBuild":"m/cycl ! go test -json -o=$devnull ./veterror stdout '"ImportPath":"m/veterror \[m/veterror.test\]","Action":"build-output","Output":"# m/veterror\\n"' stdout '"ImportPath":"m/veterror \[m/veterror.test\]","Action":"build-output","Output":"# \[m/veterror\]\\n"' -stdout '"ImportPath":"m/veterror \[m/veterror.test\]","Action":"build-output","Output":"veterror(/|\\\\)main_test.go:9:9: fmt.Printf format %s reads arg #1, but call has 0 args\\n"' +stdout '"ImportPath":"m/veterror \[m/veterror.test\]","Action":"build-output","Output":"veterror(/|\\\\)main_test.go:9:21: fmt.Printf format %s reads arg #1, but call has 0 args\\n"' stdout '"ImportPath":"m/veterror \[m/veterror.test\]","Action":"build-fail"' stdout '"Action":"start","Package":"m/veterror"' stdout '"Action":"output","Package":"m/veterror","Output":"FAIL\\tm/veterror \[build failed\]\\n"' EOF Change-Id: I6a8d35acdeab90c3bbd6395b8b1abb021673b5cb Reviewed-on: https://go-review.googlesource.com/c/go/+/678556 Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Knyszek <mknyszek@google.com>
2025-06-05net/http: strip sensitive proxy headers from redirect requestsNeal Patel
Similarly to Authentication entries, Proxy-Authentication entries should be stripped to ensure sensitive information is not leaked on redirects outside of the original domain. https://fetch.spec.whatwg.org/#authentication-entries Thanks to Takeshi Kaneko (GMO Cybersecurity by Ierae, Inc.) for reporting this issue. For #73816 Fixes CVE-2025-4673 Change-Id: Ied7b641f6531f1d340ccba3c636d3c30dd5547d9 Reviewed-on: https://go-review.googlesource.com/c/go/+/679257 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Knyszek <mknyszek@google.com>
2025-06-04runtime: make bubbled timers more consistent with unbubbledDamien Neil
This CL makes two changes to reduce the predictability with which bubbled timers fire. When asynctimerchan=0 (the default), regular timers with an associated channel are only added to a timer heap when some channel operation is blocked on that channel. This allows us to garbage collect unreferenced, unstopped timers. Timers in a synctest bubble, in contrast, are always added to the bubble's timer heap. This CL changes bubbled timers with a channel to be handled the same as unbubbled ones, adding them to the bubble's timer heap only when some channel operation is blocked on the timer's channel. This permits unstopped bubbled timers to be garbage collected, but more importantly it makes all timers past their deadline behave identically, regardless of whether they are in a bubble. This CL also changes timer scheduling to execute bubbled timers immediately when possible rather than adding them to a heap. Timers in a bubble's heap are executed when the bubble is idle. Executing timers immediately avoids creating a predictable order of execution. For #73850 Fixes #73934 Change-Id: If82e441546408f780f6af6fb7f6e416d3160295d Reviewed-on: https://go-review.googlesource.com/c/go/+/678075 Auto-Submit: Damien Neil <dneil@google.com> Reviewed-by: Michael Pratt <mpratt@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-06-04Revert "cmd/compile: Enable inlining of tail calls"Cherry Mui
This reverts CL 650455 and CL 655816. Reason for revert: it causes #73747. Properly fixing it gets into trickiness with defer/recover, wrapper, and inlining. We're late in the Go 1.25 release cycle. Fixes #73747. Change-Id: Ifb343d522b18fec3fec73a7c886678032ac8e4df Reviewed-on: https://go-review.googlesource.com/c/go/+/678575 Reviewed-by: Carlos Amedee <carlos@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
2025-06-04cmd/trace: handle Sync event at the beginning of the traceMichael Anthony Knyszek
Currently the code assumes that there's no Sync event at the start of the trace, but this hasn't been correct for some time. Count Syncs and look for at least one instead of looking for zero. Fixes #73962. Change-Id: I2b4199a21c699c5b50b3d5add37dc46a515108c6 Reviewed-on: https://go-review.googlesource.com/c/go/+/678555 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Carlos Amedee <carlos@golang.org> Auto-Submit: Michael Knyszek <mknyszek@google.com> Reviewed-by: Michael Pratt <mpratt@google.com>
2025-06-04runtime: reduce per-P memory footprint when greenteagc is disabledMichael Anthony Knyszek
There are two additional sources of memory overhead per P that come from greenteagc. One is for ptrBuf, but on platforms other than Windows it doesn't actually cost anything due to demand-paging (Windows also demand-pages, but the memory is 'committed' so it still counts against OS RSS metrics). The other is for per-sizeclass scan stats. However when greenteagc is disabled, most of these scan stats are completely unused. The worst-case memory overhead from these two sources is relatively small (about 10 KiB per P), but for programs with a small memory footprint running on a machine with a lot of cores, this can be significant (single-digit percent). This change does two things. First, it puts ptrBuf initialization behind the greenteagc experiment, so now that memory is never allocated by default. Second, it abstracts the implementation details of scan stat collection and emission, such that we can have two different implementations depending on the build tag. This lets us remove all the unused stats when the greenteagc experiment is disabled, reducing the memory overhead of the stats from ~2.6 KiB per P to 536 bytes per P. This is enough to make the difference no longer noticable in our benchmark suite. Fixes #73931. Change-Id: I4351f1cbb3f6743d8f5922d757d73442c6d6ad3f Reviewed-on: https://go-review.googlesource.com/c/go/+/678535 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Pratt <mpratt@google.com>
2025-06-04test: add another regression test for issue 73309Cuong Manh Le
Fixed #73309 Change-Id: Id715b9c71c95c92143a7fdb5a66b24305346dd3b Reviewed-on: https://go-review.googlesource.com/c/go/+/678415 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Carlos Amedee <carlos@golang.org> Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
2025-06-04cmd/compile: better error message when import embed packageqiulaidongfeng
Fixes #73955 Change-Id: I7cf3ab4c70dc2e2765b54b88ae8cfc77a3073344 Reviewed-on: https://go-review.googlesource.com/c/go/+/678355 Auto-Submit: Robert Griesemer <gri@google.com> Reviewed-by: Carlos Amedee <carlos@golang.org> Reviewed-by: Robert Griesemer <gri@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-06-03cmd/dist: don't install tools that won't be shipped in distributionMichael Matloob
We shouldn't be installing these tools because we will remove them in distpack. Installing the tools will also prevent us from testing what happens when the tools are missing. The changes below this on the stack, CL 677775 (cmd/doc: build cmd/doc directly into the go command) and CL 677636 (cmd/go/internal/cfg: fix GOROOT setting when forcing host config) are needed for this change to pass tests. The doc change is being done so we preserve the properties in the tests that doc can be invoked without doing a build. It's not strictly necessary (we could just remove the tests) but it's nice to have. The GOROOT setting is a significant bug in switching the configuration to host mode: the value of GOROOT wasn't being reset, which caused issues for go commands built with trimpath, because runtime.GOROOT wouldn't have the correct goroot value. For #71867 Change-Id: I4181711ba117066b7d62d7d013ad4b186871cfb7 Reviewed-on: https://go-review.googlesource.com/c/go/+/677558 Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Michael Matloob <matloob@google.com>
2025-06-03cmd/doc: build cmd/doc directly into the go commandMichael Matloob
There are a couple of places where our tests expect that 'go doc' doesn't need to do a build. Invoke the cmd/doc code directly by the go command instead of starting the doc tool in a separate process so we can preserve that property. This change moves most of the doc code into the package cmd/internal/doc, and exposes a Main function from that function that's called both by the cmd/doc package, and by go doc. This change makes couple of additional changes to intergrate doc into the go command: The counter.Open call and the increment of invocations counter are only needed by cmd/doc. The go command will open the counters file and increment a counter for the doc subcommand. We add a cmd_go_bootstrap tagged variant of the file that defines go doc so that we don't end up linking net into the bootstrap version of the go command. We don't need doc in that version of the command. We create a new flagSet rather than using flag.CommandLine because when running as part of the go command, the flags to "go doc" won't be the top level flags. We change TestGoListTest in go_test.go to use gofmt instead of doc as an example of a main package in cmd with an in-package test. For #71867 Change-Id: I3e3df83e5fa266559606fdc086b461165e09f037 Reviewed-on: https://go-review.googlesource.com/c/go/+/677775 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Pratt <mpratt@google.com> Reviewed-by: Michael Matloob <matloob@google.com>
2025-06-03go/token: remove unreachable codeMichael Pratt
Reported by go vet. Change-Id: I6a6a636c79923fafd8c649c583383cdf455c6ce2 Reviewed-on: https://go-review.googlesource.com/c/go/+/678317 Reviewed-by: Robert Findley <rfindley@google.com> Reviewed-by: Alan Donovan <adonovan@google.com> Auto-Submit: Michael Pratt <mpratt@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-06-03go/token: tweak commentAlan Donovan
(accidentally omitted from CL 675736) Change-Id: I05ed8fcb7bb4109862a47701c427d8efc17b9f31 Reviewed-on: https://go-review.googlesource.com/c/go/+/678315 TryBot-Bypass: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Robert Findley <rfindley@google.com> Auto-Submit: Alan Donovan <adonovan@google.com>
2025-06-03cmd/go/internal/cfg: fix GOROOT setting when forcing host configMichael Matloob
We manage the state using a bunch of global config, so we need to make sure we're doing things in the right order. In this case, the SetGOROOT function was being called in init, setting the GOROOT on the global Context, but when we reset the context in ForceHost we lost the goroot configuration. We need to call SetGOROOT in ForceHost to re-set the GOROOT on the new context. This was uncovered by CL 677558 because a go command that was built with trimpath would try to use its runtime.GOROOT(), which wouldn't be valid in trimpath mode. Setting GOROOT properly with SetGOROOT will use the value from findGOROOT, assuming GOROOT isn't set in the environment, and findGOROOT will try to determine GOROOT using the path of the go command executable. For #71867 Change-Id: I731b6c5d859b4504fc128b29ab904e3a2886ff3c Reviewed-on: https://go-review.googlesource.com/c/go/+/677636 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Matloob <matloob@google.com> Reviewed-by: Michael Pratt <mpratt@google.com>
2025-06-02runtime: additional memmove benchmarksKeith Randall
For testing out duffcopy changes. Change-Id: I93b4a52d75418a6e31aae5ad99f95d1870812b69 Reviewed-on: https://go-review.googlesource.com/c/go/+/678215 Reviewed-by: David Chase <drchase@google.com> Auto-Submit: Keith Randall <khr@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Keith Randall <khr@google.com>
2025-06-02go/token: FileSet: hold Files in a balanced treeAlan Donovan
This CL changes the representation of FileSet from a slice to a tree, specifically an AVL tree keyed by the File's base-end range. This makes a sequence of insertions using AddExistingFiles much more efficient: creating a FileSet of size n by a sequence of calls costs O(n log n), whereas before it was O(n^2 log n) because of the repeated sorting. The AVL tree is based on Russ' github.com/rsc/omap, simplified for clarity and to reduce unnecessary dynamism. We use an AVL tree as it is more strongly balanced than an RB tree, optimising lookups at the expense of insertions. The CL includes a basic unit test of the tree using operations on pseudorandom values. Benchmarks of Position lookups actually improve because the tree avoids BinarySearchFunc's dynamic dispatch to cmp, and the benchmark of AddExistingFiles is about 1000x (!) faster: goos: darwin goarch: arm64 pkg: go/token cpu: Apple M1 Pro │ old.txt │ new.txt │ │ sec/op │ sec/op vs base │ FileSet_Position/random-8 51.60n ± 1% 39.99n ± 1% -22.50% (p=0.000 n=9) FileSet_Position/file-8 27.10n ± 3% 26.64n ± 1% ~ (p=0.168 n=9) FileSet_Position/manyfiles-8 209.9n ± 17% 154.1n ± 9% -26.58% (p=0.000 n=9) FileSet_AddExistingFiles/sequence-8 395930.3µ ± 4% 280.8µ ± 10% -99.93% (p=0.000 n=9) Updates #73205 Change-Id: Iea59c624a6cedadc2673987a5eb0ebece67af9e9 Reviewed-on: https://go-review.googlesource.com/c/go/+/675736 Reviewed-by: Robert Findley <rfindley@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-06-02runtime: randomize order of timers at the same instant in bubblesDamien Neil
In synctest bubbles, fire timers scheduled for the same instant in a randomized order. Pending timers are added to a heap ordered by the timer's wakeup time. Add a per-timer random value, set when the timer is added to a heap, to break ties between timers scheduled for the same instant. Only inject this randomness in synctest bubbles. We could do so for all timers at the cost of one cheaprand call per timer, but given that it's effectively impossible to create two timers scheduled for the same instant outside of a fake-time environment, don't bother. Fixes #73876 For #73850 Change-Id: Ie96c86a816f548d4c31e4e014bf9293639155bd4 Reviewed-on: https://go-review.googlesource.com/c/go/+/677276 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Damien Neil <dneil@google.com> Reviewed-by: Michael Pratt <mpratt@google.com>
2025-06-02go/{ast,parser,types}: add signpost to golang.org/x/tools/go/packagesAlan Donovan
Change-Id: I5d5036e7b41df67d0c1ab42163fdceed8f9c42a3 Reviewed-on: https://go-review.googlesource.com/c/go/+/677137 Reviewed-by: Matt Proud <mtp@google.com> Reviewed-by: Robert Griesemer <gri@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-06-02cmd/compile/internal/noder: document quirk of string elementsMark Freeman
Change-Id: Ifc3bf896aaaf7c6ce06a01e3dd43780d203638cf Reviewed-on: https://go-review.googlesource.com/c/go/+/677755 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Mark Freeman <mark@golang.org> Reviewed-by: Robert Griesemer <gri@google.com>
2025-06-02cmd/compile/internal/noder: stub type section and adjust othersMark Freeman
The type definition and object definition sections have nearly the same structure - help illustrate that through consistent naming. Change-Id: Ibed374fca4883a293a7fc16b36034e1acb38362a Reviewed-on: https://go-review.googlesource.com/c/go/+/677378 Auto-Submit: Mark Freeman <mark@golang.org> Reviewed-by: Robert Griesemer <gri@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-06-02cmd/compile/internal/noder: begin filling in SectionObjMark Freeman
SectionObj has to encode the definition information for each object type, so it will be a bit long. Change-Id: I9b9514d58a284a4e64020f99fd1b2a92f7752338 Reviewed-on: https://go-review.googlesource.com/c/go/+/677377 Reviewed-by: Robert Griesemer <gri@google.com> Auto-Submit: Mark Freeman <mark@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>