aboutsummaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2026-03-27debug/buildinfo: remove macho/elf DataStart fallback codeMichael Matloob
The go version code can't read pre-1.13 go versions, but in 1.13 we always write the go version info to the .go.buildinfo section. Remove the fallback code because it won't be used. See https://github.com/rsc/goversion/blob/v1.2.0/version/read.go for the original rsc.io/goversion code that could read pre-1.13 data and CL 173343 for the code added to go1.13 which would look for a writable section rather than a read only section as rsc.io/goversion did. Fixes #73060 Change-Id: I5d593d5724323351aef3ff04e04f7df96a6a6964 Reviewed-on: https://go-review.googlesource.com/c/go/+/756421 Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Michael Matloob <matloob@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-03-27database/sql: don't try to synctest.Wait in benchmarksDamien Neil
Benchmarks shouldn't use synctest. Avoid a synctest.Wait in database shutdown when in benchmarks. Fixes #78373 Change-Id: I14755f8eefb3ab5c69cc660b1e884bbf6a6a6964 Reviewed-on: https://go-review.googlesource.com/c/go/+/760400 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>
2026-03-27cmd/fix: change -diff to exit 1 if diffs existyongqijia
Currently "go fix -diff" and "go vet -fix -diff" always exit with status 0 even when they print diffs, which is inconsistent with "gofmt -d" (#46289) and "go mod tidy -diff" (#27005) that exit non-zero when diffs are present. The root cause is that the default VetHandleStdout (copyToStdout) simply copies the tool stdout through without checking whether any content was produced. This change installs a new copyAndDetectDiff handler in -diff mode that copies the tool stdout through and calls base.SetExitStatus(1) when content is present, matching the pattern used by "go mod tidy -diff". Fixes #77583 Change-Id: I588fbaae8b3690da2f821240baa4a3b14b78f280 Reviewed-on: https://go-review.googlesource.com/c/go/+/749700 Reviewed-by: Michael Matloob <matloob@golang.org> Reviewed-by: Michael Matloob <matloob@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2026-03-27cmd/go: add example support to go doc outputNick White
The go doc command now includes a -ex flag to list executable examples. It will also print the code and expected output of an example when passed its name. Fixes #26715 Change-Id: I34b09403cc3cb45655939bd4fe27accec0e141f5 Reviewed-on: https://go-review.googlesource.com/c/go/+/445116 Reviewed-by: Rob Pike <r@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Matloob <matloob@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Michael Matloob <matloob@google.com>
2026-03-27all: remove openbsd/mips64 portTobias Klauser
The openbsd/mips64 port is dead, remove the remaining code specific to that port and clean up build tags. Fixes #61546 Change-Id: I0328b7b76ce1ddacd3a526b3f4ae29eaa1254c3f Reviewed-on: https://go-review.googlesource.com/c/go/+/746480 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com> Reviewed-by: Joel Sing <joel@sing.id.au> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Carlos Amedee <carlos@golang.org>
2026-03-27cmd/compile/internal/ssa: prove support induction variable pairYoulin Feng
We have two induction variables i and j in the following loop: for i, j := 0, len(s)-1; i < j; i, j = i+1, j-1 { // loop body } This CL enables the prove pass to handle cases where one if block uses two induction variables. Updates #45078 Change-Id: I8b8dc8b7b2d160a796dab1d1e29a00ef4e8e8157 Reviewed-on: https://go-review.googlesource.com/c/go/+/757700 Auto-Submit: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Keith Randall <khr@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-03-27cmd/compile: use prove to remove no-op OrsJorropo
This is hit 3 times (unique by LOC) when building the std. Change-Id: Ic1fc7b60a129e73470d9bc4f603f4be12d154b0f Reviewed-on: https://go-review.googlesource.com/c/go/+/750342 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Jorropo <jorropo.pgm@gmail.com> Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2026-03-27cmd/compile: remove 68857 And flowLimit workaround in proveJorropo
Change-Id: Id8baeb89e6e11a01d53cd63c665f0b2966f50392 Reviewed-on: https://go-review.googlesource.com/c/go/+/750341 Reviewed-by: Mark Freeman <markfreeman@google.com> Auto-Submit: Jorropo <jorropo.pgm@gmail.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Keith Randall <khr@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-03-27cmd/compile: use prove to remove no-op AndsJorropo
This is hit 308 times (unique by LOC) when building the std. There are many hits in defer generated code. My original intent was to optimize cryptographic code that uses And to implement modulus by a power of two but the number is always smaller than the modulus, it also works there but there (unsurprisingly) far fewer hits. Change-Id: Ia7a9a57099b98de966673c6e8231ef09f7c80964 Reviewed-on: https://go-review.googlesource.com/c/go/+/750200 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@google.com> Auto-Submit: Jorropo <jorropo.pgm@gmail.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-03-26cmd/link: group gcmask symbols, move them to noptrbssIan Lance Taylor
Also take them out of the symbol table. A new symbol runtime.gcmask.* marks where they start in BSS, and can be used to find them if anybody cares. Also stop checking for gcprog symbols that we no longer define. Change-Id: I4060d8e9350c20568f020172caacd0439337cd2d Reviewed-on: https://go-review.googlesource.com/c/go/+/729880 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> 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>
2026-03-26cmd/internal/obj/riscv: add assembly support of Zbc extensionXueqi Luo
The Zbc extension adds carry-less multiplication instructions for polynomial arithmetic over GF(2), which is used in cryptographic algorithms and error-correcting codes. The instructions included are: clmul, clmulh, and clmulr. Change-Id: I77a40add1a795c7b90b478dc65835c689e82167a GitHub-Last-Rev: 53790f0aafa46af2ed24183f58292df7f9fb224a GitHub-Pull-Request: golang/go#76301 Reviewed-on: https://go-review.googlesource.com/c/go/+/720520 Reviewed-by: Carlos Amedee <carlos@golang.org> Reviewed-by: Joel Sing <joel@sing.id.au> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-03-26reflect, runtime: replace reflect.typelinks to return types, not offsetsIan Lance Taylor
Change reflect to call a new function to get the compiled type descriptors, returning the type pointers directly rather than the type offsets. We have to keep the existing reflect.typelinks for third party packages that break the rules and call it directly using linkname. Change-Id: I476efb6bd7836a7a5f396c97bbe4b2c1a2428990 Reviewed-on: https://go-review.googlesource.com/c/go/+/729502 Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Antonio Camacho <antoniocho444@gmail.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Ian Lance Taylor <iant@golang.org> Reviewed-by: Keith Randall <khr@google.com>
2026-03-26cmd/compile/internal/noder: set hasShape for shaped functionsMark Freeman
A signature with a shape will be overwritten using shapeSig, but it arguably still has a shape because it's using a shaped dictionary. This mimics the approach for ObjType. Change-Id: I4646cd73129606772a9218662de76a37217366b4 Reviewed-on: https://go-review.googlesource.com/c/go/+/759721 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Robert Griesemer <gri@google.com>
2026-03-26cmd/compile/internal/noder: shapeSig must return shaped signaturesMark Freeman
Suppose a signature f[P any]() shaped to f[go.shape.int](). This function does not flag f[go.shape.int]() as having a shape because it does not mention a shaped type in its parameter or return fields. This doesn't seem right. Change-Id: I87c4e3b259328b7d27ff0a98d65ed400b4895a69 Reviewed-on: https://go-review.googlesource.com/c/go/+/759660 Auto-Submit: Mark Freeman <markfreeman@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Robert Griesemer <gri@google.com>
2026-03-26slog: use time.Time.AppendFormat to write valuePatricio Whittingslow
Avoid allocating a string by using the append method on time.Time. Change-Id: Ia0a9913680e20e28e9074660fe77cdbde21940a2 GitHub-Last-Rev: 0d55e5990d860673d3818ee21cdb731e5dcce058 GitHub-Pull-Request: golang/go#77852 Reviewed-on: https://go-review.googlesource.com/c/go/+/749960 Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com> Reviewed-by: Jonathan Amsterdam <jba@google.com> Auto-Submit: Jonathan Amsterdam <jba@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-03-26syscall: remove openbsd/mips64 specific conditionalsJoel Sing
The openbsd/mips64 port is dead - remove the syscall related code that was specific to this port, since it was not converted to libc-based system calls. Merge syscall_openbsd_libc.go into syscall_openbsd.go now that there is no need to keep them separate. Updates #61546 Change-Id: Id2642fcc0f4e1a5eb252961642a690b406fe574d Reviewed-on: https://go-review.googlesource.com/c/go/+/698557 Reviewed-by: Julian Zhu <jz531210@gmail.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Sean Liao <sean@liao.dev> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Carlos Amedee <carlos@golang.org> Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2026-03-26cmd/go: default to Go 1.20 GODEBUGs in GOPATH modeMichael Matloob
We used MainModules.GoVersion to get the Go version to use for godebugs in GOPATH mode. That returned Go 1.16 which is the default version for modules to use when they don't have a go directive, but is modules specific and doesn't make sense for GOPATH mode. Set the version to 1.20. For #73973 Change-Id: Iaa5bb77498d5860f2372ffda8a6b88a26a6a6964 Reviewed-on: https://go-review.googlesource.com/c/go/+/759240 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: t hepudds <thepudds1460@gmail.com> Reviewed-by: Michael Matloob <matloob@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Auto-Submit: Michael Matloob <matloob@golang.org>
2026-03-26runtime: truncate trace strings before inserting into trace mapTobias Grieger
traceStringTable.put inserted the full user-supplied string into the trace map, then only truncated it to MaxEventTrailerDataSize (1024 bytes) when writing to the trace buffer. If the string exceeded the traceRegionAlloc block size (~64KB), this caused a fatal "traceRegion: alloc too large" crash. Move the truncation to the top of put, before the map insertion, so that the map key, map entry, and written output are all consistent and bounded. The existing truncation in writeString is retained: the emit method also calls writeString without going through the map, so writeString still needs its own guard. TestStartRegionLongString reproduces the crash before the fix. Observed in production at CockroachDB: Stopper.RunTask passes singleflight keys (up to ~450KB) as trace region names via trace.StartRegion. See: https://github.com/cockroachdb/cockroach/pull/166669 for context on the trigger. Change-Id: I95d0b2f0bd2e806840b83a0b675ce6d2f0e2c2c5 GitHub-Last-Rev: 3c53061685d5237f9f2fc4522fce6d774776fede GitHub-Pull-Request: golang/go#78348 Reviewed-on: https://go-review.googlesource.com/c/go/+/759140 Auto-Submit: Michael Knyszek <mknyszek@google.com> Reviewed-by: Michael Knyszek <mknyszek@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-03-26cmd/compile: on ARM64 merge SRA into TBZ & TBNZJorropo
Change-Id: I9596dbca8991c93c7543d10dc1b155056dfa7db3 Reviewed-on: https://go-review.googlesource.com/c/go/+/759500 Reviewed-by: Keith Randall <khr@golang.org> Auto-Submit: Jorropo <jorropo.pgm@gmail.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Keith Randall <khr@google.com>
2026-03-26internal/trace: preallocate pcs array to correct sizeFlorian Lehner
Avoid additional allocations by requesting the correct size of the array. Change-Id: Ib1bcabdfc978c4dabf139c37e45d436182dec2d2 Reviewed-on: https://go-review.googlesource.com/c/go/+/757800 Auto-Submit: 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 Knyszek <mknyszek@google.com>
2026-03-26cmd/compile: on ARM64 merge ROR into TBZ & TBNZJorropo
Change-Id: Ib37b35dfff6236c59c0242c3b7d979c95aefbb8b Reviewed-on: https://go-review.googlesource.com/c/go/+/750321 Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Mark Freeman <markfreeman@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Jorropo <jorropo.pgm@gmail.com>
2026-03-26cmd/compile: on ARM64 merge shifts into TBZ & TBNZJorropo
Change-Id: I4dff3ba1462848f408257cbadedf202e62d1ea69 Reviewed-on: https://go-review.googlesource.com/c/go/+/750320 Reviewed-by: Keith Randall <khr@google.com> Auto-Submit: Jorropo <jorropo.pgm@gmail.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Keith Randall <khr@golang.org>
2026-03-26runtime, cmd/link: remove itablinksIan Lance Taylor
Instead of keeping a separate list of pointers to itabs, just walk through the itabs themselves. For #6853 Change-Id: If030bd64fbd01d73b0bf8495f6c9826ed2e61568 Reviewed-on: https://go-review.googlesource.com/c/go/+/729201 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Ian Lance Taylor <iant@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
2026-03-26cmd/compile: skip incomplete types in needWrapperCuong Manh Le
A recursive pointer type *T may still be a TFORW when the compiler determines if method wrappers are needed. This leads to an incorrect decision and triggers an internal compiler error. Fix this by skipping incomplete types during the method wrapper generation check. Fixes #78295 Change-Id: I4005e525e9b076c6656aed5419283c0418edcac6 Reviewed-on: https://go-review.googlesource.com/c/go/+/758922 Reviewed-by: Jakub Ciolek <jakub@ciolek.dev> Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com> Reviewed-by: Keith Randall <khr@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2026-03-26cmd/compile: do not invert loops that would overflow or underflowJorropo
On the final iteration we need space below start (which becomes end) such that i-step does not overflow or underflow. In other words the code used to assume that the last time the loop header execute `start < i - step` (or `<=`, `>` `>=` based on the loop) is always false. And it seems correct since by definition the only way for it to be the last's loop header execution is when the condition becomes false. However here is an example with uint (even tho the code doesn't already support them) to make things simpler: start = 1 i = 2 step = 100 We do 2 - 100 which should give us 1 < -98 == false breaking the loop; Instead we get 18446744073709551518 which gives 1 < 18446744073709551518 == true which keeps the loop going. This patch fixes this issue by ensuring that in the last execution of a loop header the induction variable does not underflow or overflow. Fixes #78303 Change-Id: I64e8e8592b023d79fdbc7f1598d584726ed601f5 Reviewed-on: https://go-review.googlesource.com/c/go/+/758801 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@google.com> Auto-Submit: Jorropo <jorropo.pgm@gmail.com> Reviewed-by: Jakub Ciolek <jakub@ciolek.dev> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-03-26encoding/{base32,base64}: speed up EncodeJulien Cretel
This CL clarifies (*Encoding).Encode and speeds it up by reducing the number of bounds checks in its loop. Here are some benchmark results (no change to allocations): goos: darwin goarch: arm64 pkg: encoding/base32 cpu: Apple M4 │ old │ new │ │ sec/op │ sec/op vs base │ EncodeToString-10 7.310µ ± 0% 5.308µ ± 0% -27.39% (n=180) Encode-10 5.651µ ± 0% 3.603µ ± 0% -36.25% (n=180) geomean 6.427µ 4.373µ -31.96% │ old │ new │ │ B/s │ B/s vs base │ EncodeToString-10 1.044Gi ± 0% 1.437Gi ± 0% +37.71% (p=0.000 n=180) Encode-10 1.350Gi ± 0% 2.118Gi ± 0% +56.88% (p=0.000 n=180) geomean 1.187Gi 1.745Gi +46.98% pkg: encoding/base64 │ old │ new │ │ sec/op │ sec/op vs base │ EncodeToString-10 7.058µ ± 0% 6.034µ ± 0% -14.51% (n=180) │ old │ new │ │ B/s │ B/s vs base │ EncodeToString-10 1.081Gi ± 0% 1.264Gi ± 0% +16.97% (p=0.000 n=180) Updates #20206 Change-Id: I7d46891ddb4371df004bfd612a8efc6638715b94 GitHub-Last-Rev: 1caac3d65532fefacbbed57f11a4a49273f173e2 GitHub-Pull-Request: golang/go#78344 Reviewed-on: https://go-review.googlesource.com/c/go/+/759100 Reviewed-by: Keith Randall <khr@golang.org> Auto-Submit: Keith Randall <khr@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Keith Randall <khr@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-03-26cmd/compile: fix missing walk for OAS2RECV nodeCuong Manh Le
When channel receive operator is used in the context that requires conversion to destination type, there's an implicit conversion operator inserted by typecheck. This typecheck-ed node is un-walked, then passing to the backend as-is, causing the ICE. Fixes #78313 Change-Id: Ibbc70cbd2d8069cc7cf81934406aa68c4da2686a Reviewed-on: https://go-review.googlesource.com/c/go/+/758660 Reviewed-by: Keith Randall <khr@google.com> Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Jakub Ciolek <jakub@ciolek.dev> Reviewed-by: Keith Randall <khr@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-03-26runtime: std FDs are always opened, not only when AT_SECURE is setMateusz Poliwczak
Updates #60641 Change-Id: I0340a561690a2b45e27a82dc15479b846a6a6964 Reviewed-on: https://go-review.googlesource.com/c/go/+/754400 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> Auto-Submit: Keith Randall <khr@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2026-03-25cmd/link: fix host object's .pdata entries orderqmuntal
Host objects are expected to have their .pdata entries in the correct order, but the Go internal linker might reorder some of the functions associated with the .pdata entries. This causes the .pdata section in the final binary to have entries in the wrong order, and therefore issues with unwinding on Windows. The fix is to treat the .pdata entries of host objects as individual symbols that will be retained only if the function they are associated with is retained. Also, those entries will be sorted together with the .pdata entries emitted by the Go compiler, ensuring the correct order in the final binary. Fixes #65116 Change-Id: I421471b2aef519b0c20707a40c4b7957db5d2ed5 Reviewed-on: https://go-review.googlesource.com/c/go/+/754080 Reviewed-by: Alex Brainman <alex.brainman@gmail.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2026-03-25cmd/dist: try to use jj commit info for devel versionmatloob
Fixes #78369 Change-Id: Icb8bb9822eac78934efc313f50221de56a6a6964 Reviewed-on: https://go-review.googlesource.com/c/go/+/759320 Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Auto-Submit: Michael Matloob <matloob@google.com> 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>
2026-03-25database/sql: use synctest in testsDamien Neil
Replace various polling loops waiting for conditions to occur with synctest-based synchronization. Replace fake time with synctest's bubbled time. Reduces time for "go test database/sql -count=10" from ~12s to ~0.5s on my M4 machine. Change-Id: I7ea8d740d443e27c50df4d2f22aec6136a6a6964 Reviewed-on: https://go-review.googlesource.com/c/go/+/758065 Reviewed-by: Jonathan Amsterdam <jba@google.com> Auto-Submit: Damien Neil <dneil@google.com> Reviewed-by: Neal Patel <nealpatel@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-03-25database/sql: avoid deadlock from reentrant RLockDamien Neil
RWMutex.RLock blocks until any pending Lock operations are satisfied. This prohibits recursive read-locking. Replace various RWMutexes used to synchronize between reads and closes with a variant where the reader side takes priority. Reads can starve out Close, but will not deadlock. Fixes #78304 Change-Id: Id36529bf86bed5dbf22f2af94283aeac6a6a6964 Reviewed-on: https://go-review.googlesource.com/c/go/+/758064 Auto-Submit: Damien Neil <dneil@google.com> Reviewed-by: Neal Patel <nealpatel@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-03-25cmd/compile: preserve variadic signature on range-over-funcCuong Manh Le
When rewriting range-over-func loops, copy the variadic bit from the original function type into the synthesized body closure's type info. This keeps the generated closure signature aligned with the source function and avoids losing variadic-ness during rewrite. Fixes #78314 Change-Id: I4b5f4628e8c8c14d4ff89dd6b996837264c5cb61 Reviewed-on: https://go-review.googlesource.com/c/go/+/758041 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Jakub Ciolek <jakub@ciolek.dev> Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com> Reviewed-by: David Chase <drchase@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2026-03-25crypto/x509: fix signature checking limitRoland Shoemaker
We added the "is this cert already in the chain" check (alreadyInChain) to considerCandidates before the signature limit. considerCandidates bails out when we exceed the signature check, but buildChains keeps calling considerCandidates until it exhausts all potential parents. In the case where a large number of certificates look to have signed each other (e.g. all have subject==issuerSubject and the same key), alreadyInChain is not particularly cheap, meaning even though we hit our "this is too much work" limit, we still do a lot of work. Move alreadyInChain after the signature limit, and also return a sentinel error, and check it in buildChains so we can break out of the loop early if we aren't actually going to do any more work. Thanks to Jakub Ciolek for reporting this issue. Fixes #78282 Fixes CVE-2026-32280 Change-Id: Ie6f05c6ba3b0a40c21f64f7c4f846e74fae3b10e Reviewed-on: https://go-review.googlesource.com/c/go/+/758320 Reviewed-by: Damien Neil <dneil@google.com> Reviewed-by: Neal Patel <nealpatel@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Jakub Ciolek <jakub@ciolek.dev>
2026-03-25crypto/x509: hoist policy pruning out of loopRoland Shoemaker
We only need to do this once, not once per mapping. Thanks to Jakub Ciolek for reporting this issue. Fixes #78281 Fixes CVE-2026-32281 Change-Id: Ic26f5f14d2a5e42ca8c24b8ae47bc3c5cc601863 Reviewed-on: https://go-review.googlesource.com/c/go/+/758061 Reviewed-by: Damien Neil <dneil@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Neal Patel <nealpatel@google.com> Reviewed-by: Jakub Ciolek <jakub@ciolek.dev>
2026-03-25runtime: use uname version check for 64-bit time on 32-bit arch codepathsBrad Fitzpatrick
The previous fallback-on-ENOSYS logic causes issues on forks of Linux. Android: #77621 (CL 750040 added a workaround with a TODO, this fixes that TODO) Causes the OS to terminate the program when running on Android versions <=10 since the seccomp jail does not know about the 64-bit time syscall and is configured to terminate the program on any unknown syscall. Synology's Linux: #77930 On old versions of Synology's Linux they added custom vendor syscalls without adding a gap in the syscall numbers, that means when we call the newer Linux syscall which was added later, Synology's Linux interprets it as a completely different vendor syscall. Originally by Jorropo in CL 751340. Fixes #77930 Co-authored-by: Jorropo <jorropo.pgm@gmail.com> Change-Id: I90e15495d9249fd7f6e112f9e3ae8ad1322f56e0 Reviewed-on: https://go-review.googlesource.com/c/go/+/758902 Reviewed-by: Damien Neil <dneil@google.com> Reviewed-by: Michael Pratt <mpratt@google.com> Reviewed-by: Jorropo <jorropo.pgm@gmail.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-03-25cmd/link: don't run TestExtLinkCmdlineDeterminism in parallel with other testsCherry Mui
Based on the investigation of #78180, it appears that for different runs the go command picks up different object from the build cache for the runtime/cgo package. One possible situation could be that as the test runs in parallel with other tests, some other test builds runtime/cgo at same time, and somehow that build is not deterministic, causes different objects of runtime/cgo being written to the build cache. Let's see if running the test not in parallel helps. The test process may still run in parallel with other processes, which could also build runtime/cgo and interfere, so this may be just best effort. If the build of runtime/cgo is deterministic, this shouldn't be necessary. For #78180. Change-Id: If078f141febd33f063fe2d564c4150223a9784ef Reviewed-on: https://go-review.googlesource.com/c/go/+/759122 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Pratt <mpratt@google.com>
2026-03-25net/url: escape // at start of Path when OmitHost setDamien Neil
When a URL has OmitHost set and a Path starting with //, escape the first / in the path to avoid emitting a URL with the host set from the Path. For example for u := url.URL{Scheme: "file", OmitHost: true, Path: "//host/path"} u.String is now "file:%2F/host/path", not "file://host/path". Fixes #78328 Change-Id: I017af26724cc55f8b7e6f7c969f1495b6a6a6964 Reviewed-on: https://go-review.googlesource.com/c/go/+/758881 Auto-Submit: Damien Neil <dneil@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Alan Donovan <adonovan@google.com>
2026-03-25cmd/go: add information about GODEBUGs to go help gopathMichael Matloob
And make it clear that standard library tests won't run properly with GO111MODULE=off. Fixes #73973 Fixes #69202 Change-Id: I8c71c739e1da80fbf2e13f84ecaf9c346a6a6964 Reviewed-on: https://go-review.googlesource.com/c/go/+/758720 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Michael Matloob <matloob@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Michael Matloob <matloob@google.com>
2026-03-25cmd/dist: add GO_TEST_ASMFLAGS to set -asmflags during dist testDmitri Shuralyov
If we run into a need for finer control over when -asmflags gets set, there can be an asmflags field added to goTest, analogously to the existing gcflags and ldflags fields. Start with a minimal change for what is currently needed, since not adding something we ourselves don't use makes it easier to avoid inadvertently ending up maintaining it because we can't be sure whether someone else started to depend on it. For #77427. Change-Id: I5e80874861cadf95fe770af6712b2c3f172c990a Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-spectre Reviewed-on: https://go-review.googlesource.com/c/go/+/758740 Reviewed-by: Michael Pratt <mpratt@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
2026-03-25debug/elf: handle program header count overflowIan Lance Taylor
ELF files only have a 16-bit count for program headers. To handle the very rare case of larger files, a large program header count is stored as 0xffff and the first section header info field holds the actual count. Fixes #78217 Change-Id: I35c7e15025a9677473cb43d09a41f17f75443731 Reviewed-on: https://go-review.googlesource.com/c/go/+/758040 Reviewed-by: David Chase <drchase@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Ian Lance Taylor <iant@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2026-03-25cmd/compile: ppc64 fold (x+x)<<c into x<<(c+1)Jayanth Krishnamurthy jayanth.krishnamurthy@ibm.com
On ppc64/ppc64le, rewrite (x + x) << c to x << (c+1) for constant shifts. This removes an ADD, shortens the dependency chain, and reduces code size. Add rules for both 64-bit (SLDconst) and 32-bit (SLWconst), and extend test/codegen/shift.go with ppc64x checks to assert a single SLD/SLW and forbid ADD. Aligns ppc64 with other architectures that already assert similar codegen in shift.go. Change-Id: Ie564afbb029a5bd48887b82b0c455ca1dddd5508 Cq-Include-Trybots: luci.golang.try:gotip-linux-ppc64_power10,gotip-linux-ppc64_power8,gotip-linux-ppc64le_power8,gotip-linux-ppc64le_power9,gotip-linux-ppc64le_power10 Reviewed-on: https://go-review.googlesource.com/c/go/+/712000 Reviewed-by: Archana Ravindar <aravinda@redhat.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Carlos Amedee <carlos@golang.org>
2026-03-24go/build: remove non-existent internal/itoaDamien Neil
This package appears to have been superseded by internal/strconv, and no longer exists. Change-Id: I1364aa446ece2fca7b4445fc644506136a6a6964 Reviewed-on: https://go-review.googlesource.com/c/go/+/758920 Auto-Submit: Damien Neil <dneil@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Alan Donovan <adonovan@google.com>
2026-03-24cmd/link: print more information in TestExtLinkCmdlineDeterminismCherry Mui
Print more information in TestExtLinkCmdlineDeterminism to debug test failure. For #78180 Change-Id: I7e95eceb957805588c5dbb272370476d2378ea7e Reviewed-on: https://go-review.googlesource.com/c/go/+/758823 Reviewed-by: Michael Pratt <mpratt@google.com> Auto-Submit: Cherry Mui <cherryyz@google.com> TryBot-Bypass: Cherry Mui <cherryyz@google.com>
2026-03-24net/url: permit colons in the host subcomponent of non-http/https URLsDamien Neil
Too many systems seem to rely on net/url accepting invalid URLs with colons in the host subcomponent. Rather than adding exceptions for each (PostgreSQL, MongoDB, Redis, etc.), limit the strict validation to http/https only. For #78077 Change-Id: I1bff324395cce6d7abf816cc875c79676a6a6964 Reviewed-on: https://go-review.googlesource.com/c/go/+/758900 Reviewed-by: Roland Shoemaker <roland@golang.org> Auto-Submit: Damien Neil <dneil@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-03-24cmd/go/testdata/vcstest: explicitly set invalid-version's branch to mainmatloob
Fixes #78323 Change-Id: Id527f3a162969309b7103e5f0e0cc6496a6a6964 Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest-git2.24.0 Reviewed-on: https://go-review.googlesource.com/c/go/+/758820 Reviewed-by: Michael Matloob <matloob@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Michael Matloob <matloob@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2026-03-24net/url: reattach package doc commentDamien Neil
Fixes #78326 Change-Id: I70a411c33820f6498bec5f4e4a4ec7666a6a6964 Reviewed-on: https://go-review.googlesource.com/c/go/+/758880 Auto-Submit: Nicholas Husin <nsh@golang.org> Reviewed-by: Nicholas Husin <husin@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Nicholas Husin <nsh@golang.org>
2026-03-24runtime: zero-extend Windows error code in syscall_syscallnChristian Hoeppner
asmstdcall now returns the 32-bit Windows error code in the return register. cgocall captures this as a signed int32. On 64-bit systems, casting this directly to uintptr results in sign extension for error codes with the high bit set (e.g., 0x80092004 becomes 0xffffffff80092004), breaking equality checks against zero-extended constants. This CL ensures the error code is zero-extended by casting to uint32 before converting to uintptr. Fixes #78324 Change-Id: Ia75fe32965ccc7fb836f7caff8bbb8575af11e2e Reviewed-on: https://go-review.googlesource.com/c/go/+/758800 Reviewed-by: Cherry Mui <cherryyz@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Carlos Amedee <carlos@golang.org>
2026-03-24cmd/compile: handle string literals in FIPS mode consistentlyCherry Mui
There are different code paths for compiling a composite literal, e.g. small vs. large, fully static vs. partially static. Following CL 755600, we need to apply the condition for string literals in FIPS mode consistently in all places. Enhance the test to check that not only does the code compile, the same code inside and outside of FIPS mode produce the same result. If the condition is not consistent in the compiler, it may compile the code, but not all the fields are actually assigned. Fixes #78173. Change-Id: Icaf673bd4798d4312d86c39b147d7fd33b9dae2c Reviewed-on: https://go-review.googlesource.com/c/go/+/756260 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: David Chase <drchase@google.com>
2026-03-24internal/abi, cmd/link: centralize type descriptor size calculationJake Bailey
The linker hardcoded the calculation for some types, which caused me some annoyance in CL 711560 because I didn't know it needed to be updated (and it took me a long time to find the hardcoded value). Move this calculation over to the abi package, similar to other funcs. Then update rttype.Init to also check that the function works, like again like other funcs in this package. This actually caught a latent bug; decodetypeMethods was incorrectly calculating the size for the Interface case! Change-Id: Iaa66055061b68ec93c9912ae6aa6e605260f52a8 Reviewed-on: https://go-review.googlesource.com/c/go/+/749961 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: David Chase <drchase@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com>