Commit Graph

65226 Commits

Author SHA1 Message Date
goto1134
b291c3c35c cmd/compile: fix typos in types2 api_test.go
Change-Id: Ifee1b0f590ebb6671efd61a289c8884a225f5d6b
GitHub-Last-Rev: 175ae95847
GitHub-Pull-Request: golang/go#76782
Reviewed-on: https://go-review.googlesource.com/c/go/+/728980
Reviewed-by: Jorropo <jorropo.pgm@gmail.com>
Auto-Submit: Jorropo <jorropo.pgm@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
2026-01-23 09:46:43 -08:00
Josh Bleecher Snyder
d774ced6a9 cmd/go/internal/vcs: support git worktrees
Fixes golang/go#58218

Change-Id: Ia155b26514557cf822caf37e727e5a410b0a36a6
Reviewed-on: https://go-review.googlesource.com/c/go/+/736260
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2026-01-23 09:38:00 -08:00
Robert Griesemer
6d89ab44cc go/types, types: flip field/method selection logic inside out (cleanup)
By selecting on *Var/*Func first, the field/method selection logic
becomes a bit cleaner, clearer, and a little bit simpler.

No functional changes.

Change-Id: I9860f98d52779b0f7ce4484ea77e74a3667d9e6b
Reviewed-on: https://go-review.googlesource.com/c/go/+/738080
Reviewed-by: Alan Donovan <adonovan@google.com>
Commit-Queue: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Robert Griesemer <gri@google.com>
2026-01-23 09:18:50 -08:00
Xiaolin Zhao
021d5ca042 cmd/compile: avoid extending when already sufficiently shifted on loong64
This reduces 744 instructions from the go toolchain binary on loong64.

	file         before      after      Δ       %
	asm          599282      599222   -60    -0.0100%
	cgo          513606      513534   -72    -0.0140%
	compile      2939250     2939146  -104   -0.0035%
	cover        564136      564056   -80    -0.0142%
	fix          895622      895546   -76    -0.0085%
	link         759460      759376   -84    -0.0111%
	preprofile   264960      264916   -44    -0.0166%
	vet          869964      869888   -76    -0.0087%
	go           1712990     1712890  -100   -0.0058%
	gofmt        346416      346368   -48    -0.0139%
	total        9465686     9464942  -744   -0.0079%

Change-Id: I32dfa7506d0458ca0b6de83b030c330cd2b82176
Reviewed-on: https://go-review.googlesource.com/c/go/+/725720
Auto-Submit: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
2026-01-23 08:38:00 -08:00
mohanson
c04335e33a math/pow10: remove overlapping boundary (n=0)
Both the first and second conditions include n=0, creating an
implicit logic that relies on order of evaluation.

Change-Id: Iefbc25a676242fabf272203a3e845363585bff56
Reviewed-on: https://go-review.googlesource.com/c/go/+/730060
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Robert Griesemer <gri@google.com>
2026-01-23 08:26:22 -08:00
Ryan Diep
a1150b5017 cmd/compile/internal/pgo: error parsing profile (for pgo) after scaling
If a valid profile is scaled such that the samples/counts become 0,
an empty graph in which the compiler complain that we never saw a start line
since the graph has no nodes which is a misleading error message.

src/cmd/internal/pgo/pprof.go was modified to check if the graph is empty
return an empty profile.

GitHub-Pull-Request: golang/go#73640
Change-Id: If3f7ab8af6fcf77b2e29ae1df154f87bee377ab0
Reviewed-on: https://go-review.googlesource.com/c/go/+/725120
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>
Auto-Submit: Michael Pratt <mpratt@google.com>
2026-01-23 08:26:16 -08:00
Nick Ripley
6b7206feb2 runtime: remove logical stack sentinel for runtime lock stacks
When CL 533258 added frame pointer support for the block and mutex
profiles, it deferred skipping/inline expansion, similar to the
execution tracer. The first frame indicated whether this expansion was
needed by holding either the number of frames to skip (implying inline
expansion) or the logicalStackSentinel placeholder to indicate that no
extra handling is needed. However, CL 598515 switched to doing the
skipping/inline expansion at sample time. After this, the sentinel value
is unused. This CL removes the sentinel from runtime lock profiling,
correcting an oversight from that CL. This didn't cause any problems
since post-processing would just ignore the bogus sentinel value; this
is just a cleanup.

Change-Id: Idbec11f57ac7a57426cd8a064782c4fe6a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/726040
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
2026-01-23 08:26:04 -08:00
mohanson
23f7ba554d math: use shared signMask constant
In abs.go and copysign.go, magic numbers and local constants are
used for the sign bit mask (1 << 63), even though a shared constant
signMask already exists in bits.go.

Change-Id: Ic3aeb9b52674538443cbe074acfeb373a3c74a8e
Reviewed-on: https://go-review.googlesource.com/c/go/+/732060
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Robert Griesemer <gri@google.com>
2026-01-23 08:23:44 -08:00
Nick Ripley
84c8483e02 runtime: remove unused mutexevent linkname
CL 29650 added a sync.event linkname for mutexevent, but that does not
appear to have ever been used. This linkname isn't in the "hall of
shame", so we can just remove it.

Change-Id: I778b53ca089b5afda6c6074be9e43e3a6a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/736220
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
2026-01-23 05:36:57 -08:00
Ian Lance Taylor
13096a62e6 cmd/link: put type descriptors in .go.type section
This change rewrites and simplifies the relro handling.
We eliminate the separate relro SymKind values and the complex
shifting of symbol kinds. Instead, we put the possible relro data
into their own sections, and make those sections relro when appropriate.

We put type descriptors and their associated data into a
new .go.type section. As part of this we change the runtime.etypes
symbol to be the end of the new section, rather than the end of
rodata as it was before.

We put function descriptors into a new .go.func section.

Ordinary rodata relro stays in the .data.rel.ro section.

We stop making the typelink section relro, as it only contains
offsets and never has dynamic relocations.

We drop the typerel:* and go:funcdescrel symbols.

For #76038

Change-Id: I7aab7cfad3f2623ff06c09a70b756fe1e43f4169
Reviewed-on: https://go-review.googlesource.com/c/go/+/723580
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
2026-01-22 22:14:33 -08:00
Robert Griesemer
6edb9f9c51 go/types, types2: remove support for gotypesalias GODEBUG flag
For #76472.

Change-Id: Ia51b41639637b1de916625e73c26f625382be305
Reviewed-on: https://go-review.googlesource.com/c/go/+/736441
Reviewed-by: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Commit-Queue: Robert Griesemer <gri@google.com>
2026-01-22 21:37:55 -08:00
Keith Randall
819c53c25f cmd/compile: ensure ops have the expected argument widths
The generic SSA representation uses explicit extension and
truncation operations to change widths of values. The map
intrinsics were playing somewhat fast and loose with this
requirement. Fix that, and add a check to make sure we
don't regress.

I don't think there is a triggerable bug here, but I ran into
this with some prove pass modifications, where
cmd/compile/internal/ssa/prove.go:isCleanExt (and/or its uses)
is actually wrong when this invariant is not maintained.

Change-Id: Idb7be6e691e2dbf6d7af6584641c3227c5c64bf5
Reviewed-on: https://go-review.googlesource.com/c/go/+/731300
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
2026-01-22 14:36:07 -08:00
Alexander Musman
c7258178cd cmd/compile: optimize small constant-sized MemEq
Add optimization patterns for MemEq with small constant sizes
(3-32 bytes). These patterns help to avoid runtime calls for
small sizes.

For sizes 3-16, combine two chunks loading and comparison.
For sizes 17-32, combine a 16-byte comparison with the remaining bytes.
This change may increase binary size slightly due to inline expansion,
but improves performance for code with many small memequals,
e.g. DecodehealingTracker benchmark on arm64:

shortname: minio
pkg: github.com/minio/minio/cmd
                               │  Orig.res   │              Uexp.res              │
                               │   sec/op    │   sec/op     vs base               │
DecodehealingTracker-4           842.5n ± 1%   794.0n ± 3%  -5.75% (p=0.000 n=10)
AppendMsgResyncTargetsInfo-4     8.472n ± 0%   8.472n ± 0%       ~ (p=0.582 n=10)
DataUpdateTracker-4              2.856µ ± 2%   2.804µ ± 3%       ~ (p=0.210 n=10)
MarshalMsgdataUsageCacheInfo-4   131.2n ± 1%   131.6n ± 2%       ~ (p=0.494 n=10)
geomean                          227.4n        223.2n       -1.86%

                             │   Orig.res   │              Uexp.res               │
                             │     B/s      │     B/s       vs base               │
DecodehealingTracker-4         352.0Mi ± 1%   373.5Mi ± 3%  +6.10% (p=0.000 n=10)
AppendMsgResyncTargetsInfo-4   1.099Gi ± 0%   1.099Gi ± 0%       ~ (p=0.183 n=10)
DataUpdateTracker-4            341.8Ki ± 3%   351.6Ki ± 3%       ~ (p=0.286 n=10)
geomean                        50.95Mi        52.46Mi       +2.96%

Change-Id: If3d7e7395656d5f36e3ab303a71044293d17bc3e
Reviewed-on: https://go-review.googlesource.com/c/go/+/688195
Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
2026-01-22 14:34:09 -08:00
khr@golang.org
26ffe78b8c encoding/json: remove unneeded unsafe import
Followon for CL 721160.

Change-Id: I9c22c5e99c9084e24047c77d20717c5b46165cde
Reviewed-on: https://go-review.googlesource.com/c/go/+/732220
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Sean Liao <sean@liao.dev>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-01-22 14:29:44 -08:00
Nicholas S. Husin
e0c4ad77cf net/http: Add Server.DisableClientPriority field
The DisableClientPriority field is currently still a no-op, and will
only take effect once golang.org/x/net is bundled up into h2_bundle.go
again.

For #75500

Change-Id: I9e2135bed50b7f201aea93467e3f5f5f6c81cb1c
Reviewed-on: https://go-review.googlesource.com/c/go/+/738620
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Nicholas Husin <husin@google.com>
2026-01-22 14:02:25 -08:00
Russ Cox
dd39dfb534 all: update to Unicode 17
Process:
- Disable unicode TestProperties.
- Run UNICODE_VERSION=17.0.0 go -C ../src/golang.org/x/text generate
- Run go generate strconv
- Update unicode TestProperties by hand to add missing test cases.

This will break x/text using the main repo until the corresponding
x/text CL is submitted. It should not break anything else.

For #77266.

Change-Id: Ia3ffb5a81e212b991714eef70eebfca98a0c8aab
Reviewed-on: https://go-review.googlesource.com/c/go/+/737420
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Roland Shoemaker <roland@golang.org>
TryBot-Bypass: Russ Cox <rsc@golang.org>
2026-01-22 13:16:03 -08:00
Bill Morgan
a006e17162 syscall: document Sendfile semantics
syscall.Sendfile behavior differs significantly between operating
systems.

Document the platform-specific behavior for the offset argument and
partial write reporting on Linux versus BSD-derived systems.

Fixes #64044

Change-Id: I93f740c3e2df911a10bf0884ffab218d4bb4e5fc
GitHub-Last-Rev: a11b898bb9
GitHub-Pull-Request: golang/go#77224
Reviewed-on: https://go-review.googlesource.com/c/go/+/737122
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2026-01-22 13:07:52 -08:00
Mark F
858d4bf851 debug/elf: return FormatError when reading short files
NewFile returns the raw error from ReadAt when failing to read the
ELF identifier, typically io.EOF for empty or short files. This breaks
the API contract that all parsing failures should return *FormatError.

Wrap the error in FormatError for consistency with other error paths.

Fixes #76338

Change-Id: Ic4ed77316fcc459ce8cbe9e9506d7cf8e9286623
Reviewed-on: https://go-review.googlesource.com/c/go/+/736600
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
2026-01-22 13:04:53 -08:00
jjpinto
8e3104dc26 simd/archsimd/_gen/simdgen: fix typos in error messages
simdgen: fix typos in error messages

Change-Id: I921eea63c4847b2af43a1d5a1ea075e86f58aa77
GitHub-Last-Rev: 8c9dae51fd
GitHub-Pull-Request: golang/go#77012
Reviewed-on: https://go-review.googlesource.com/c/go/+/732880
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
2026-01-22 12:57:43 -08:00
jjpinto
eaf6650c2b test: use lower-case error message in heapsampling.go
According to Go style guidelines, error strings should not be capitalized.

Change-Id: Iacfb3f5192b7be40da99b6b7e4801f1ae1169efc
GitHub-Last-Rev: 440396e094
GitHub-Pull-Request: golang/go#76999
Reviewed-on: https://go-review.googlesource.com/c/go/+/732760
Auto-Submit: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
2026-01-22 12:57:37 -08:00
Cuong Manh Le
1b7e5836ad cmd/compile: speedup large init function compile time
Fixes #77153

Change-Id: Ia3906e4d686281be78b65daf7a7a4fd1b2b2483d
Reviewed-on: https://go-review.googlesource.com/c/go/+/737880
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>
Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
2026-01-22 12:55:00 -08:00
Gavin Lam
e9e05687de internal/runtime: remove math.Mul64
internal/runtime/math.Mul64 is a copy of math/bits.Mul64 and redundant.

Change-Id: I4dd2ab531a32da97839c6b45cf90df6430811967
GitHub-Last-Rev: 1a73e16049
GitHub-Pull-Request: golang/go#77187
Reviewed-on: https://go-review.googlesource.com/c/go/+/736500
Auto-Submit: Keith Randall <khr@google.com>
Reviewed-by: Jorropo <jorropo.pgm@gmail.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-01-22 12:48:33 -08:00
Tobias Klauser
1996c22f0a syscall: return early on error in Recvmsg
Currently, Recvmsg may access the rsa buffer even if the underlying syscall
returns an error.

Following the same change done for x/sys/unix.Recvmsg in CL 734740.

For golang/go#76848

Change-Id: I2a145d822442a2033a76f4717317a39010b17bd5
Reviewed-on: https://go-review.googlesource.com/c/go/+/735121
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@golang.org>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Florian Lehner <lehner.florian86@gmail.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
2026-01-22 12:40:23 -08:00
Guoqi Chen
c61a48619f cmd/compile: allow Bswap{64,32,16} on loong64
On Loong64, Bswap{64,32,16} has been implemented with REVB{2H, 2W,V} instruction

Change-Id: Ia7f40ef3b1a85bfb0b20563098cb792b00cec498
Reviewed-on: https://go-review.googlesource.com/c/go/+/737841
Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
2026-01-22 12:34:32 -08:00
Josh Bleecher Snyder
6ba3494e16 cmd/go/internal/vcs: use 0o for octal
Change-Id: I011cd7e1c2c614e2c5c4a0fadf062ac9be2266aa
Reviewed-on: https://go-review.googlesource.com/c/go/+/736440
Reviewed-by: Florian Lehner <lehner.florian86@gmail.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2026-01-22 12:12:45 -08:00
Neal Patel
dcb42485ac cmd/cgo: add test for sanitizing smuggled doc comment code
Updates #76697

Change-Id: If24eec2bc2f8bfd903a4cc8f5499e77ea2f255c8
Reviewed-on: https://go-review.googlesource.com/c/go/+/736780
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-01-22 10:13:51 -08:00
jiahua wang
fde15bbfc1 strings: use bytealg.LastIndexRabinKarp on strings.LastIndex
Change-Id: I7eae15bf0b4d556763e1754e17031c880035d69c
Reviewed-on: https://go-review.googlesource.com/c/go/+/538737
Auto-Submit: Sean Liao <sean@liao.dev>
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>
Reviewed-by: Sean Liao <sean@liao.dev>
2026-01-22 07:37:08 -08:00
1911860538
0f9cdc2fbc net/http: use math/rand/v2 instead of math/rand
math/rand/v2 provides a more modern, performant, and secure random number API.

Change-Id: Ic0c30ae40623508e3ed65c435be3c208704b5655
GitHub-Last-Rev: a8fa520b39
GitHub-Pull-Request: golang/go#76433
Reviewed-on: https://go-review.googlesource.com/c/go/+/723680
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
2026-01-22 07:35:48 -08:00
Michael Pratt
d2aad0df60 runtime: guard unexpected return pc gp.m dereference
If stack scanning reaches here while scanning a waiting goroutine, gp.m
will be nil. We are going to crash anyway because the stack is corrupt,
but we still want to reach the print below for context rather than dying
with a SIGSEGV here.

For #64030.

Change-Id: I6a6a636c378669dc45972e1eb8e06401a0fed223
Reviewed-on: https://go-review.googlesource.com/c/go/+/726522
Auto-Submit: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2026-01-22 07:33:17 -08:00
Keith Randall
bfb851c31e cmd/compile: reserve less memory for bitvectors
We only need 4 per block, not 7. That's almost 50% savings.

Update #77170

Change-Id: I6229a1137e7a03769e30bd4081078817de9a4f84
Reviewed-on: https://go-review.googlesource.com/c/go/+/736340
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
2026-01-22 07:31:38 -08:00
Joe Tsai
0152075d5a encoding/json/v2: remove issue reference in Duration formatting error
The json/v2 working group decided to commit to no default representation
for time.Duration for the foreseeable future.
Thus, we can remove the issue reference in the error message.

If JavaScript (TC39) formally adopts the Temporal.Duration type,
which uses ISO 8601 as the JSON representation for a duration,
we may consider changing the default.

Switching from no default to some default in the future
is generally a compatible change.

Updates #71631

Change-Id: I6f71a0fa97dcefba56aab0c0ddf445d9d38f6e58
Reviewed-on: https://go-review.googlesource.com/c/go/+/735080
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
Auto-Submit: Joseph Tsai <joetsai@digital-static.net>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-01-22 07:31:33 -08:00
Cuong Manh Le
a535896627 cmd/compile: remove unnecessary code in keepAliveAt
TypeWord and SrcRType are only needed for interface expression
conversion. Since CL 725180, the kept alive nodes are passed directly to
runtime.KeepAlive, so there's no interface conversion anymore.

Change-Id: I37ad8016bf76a1bf8ba36efea043fc71341b33c7
Reviewed-on: https://go-review.googlesource.com/c/go/+/737840
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
2026-01-22 07:30:22 -08:00
Cuong Manh Le
dae71067ce cmd/compile: fix mis-compilation for static array initialization
The bug was first introduced when the compiler is still written in C,
with CL 2254041. The static array was laid out with the wrong context,
causing a stack pointer will be stored in global object.

Fixes #61730
Fixes #77193

Change-Id: I22c8393314d251beb53db537043a63714c84f36a
Reviewed-on: https://go-review.googlesource.com/c/go/+/737821
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Keith Randall <khr@golang.org>
2026-01-22 07:30:19 -08:00
Cuong Manh Le
adb64adfd7 cmd/compile: refactor preserveStmt
By breaking it into smaller functions with duplicated logic removed.

Change-Id: I710414e8d13d91c19fb4bf4da1a31b00ee88ccee
Reviewed-on: https://go-review.googlesource.com/c/go/+/728961
Reviewed-by: Junyang Shao <shaojunyang@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
2026-01-22 07:30:08 -08:00
Cuong Manh Le
540ccca0a7 cmd/compile: better name for BloopWalk
Use bloop.Walk instead of BloopWalk for better naming.

Change-Id: I60fb7abf8cdab2c7641c69d1cc06c1d6bef1600b
Reviewed-on: https://go-review.googlesource.com/c/go/+/728960
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
2026-01-22 07:30:05 -08:00
Robert Griesemer
2d37c20778 go/types, types2: better error when selecting field on type rather than value
Fixes #6814.

Change-Id: I659670998f8e89400d03d40189e8c54f7e705cdc
Reviewed-on: https://go-review.googlesource.com/c/go/+/738040
Reviewed-by: Alan Donovan <adonovan@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Griesemer <gri@google.com>
2026-01-21 16:01:08 -08:00
Carlos Amedee
455282911a doc/next: initialize
Initialize the doc/next directory for the next release by copying the
contents of doc/initial into it.

For #76474.

Change-Id: I52c826cf42aa93f1dea8bf8f7f386a77265bf31a
Reviewed-on: https://go-review.googlesource.com/c/go/+/737961
Reviewed-by: Michael Pratt <mpratt@google.com>
Auto-Submit: Carlos Amedee <carlos@golang.org>
TryBot-Bypass: Carlos Amedee <carlos@golang.org>
2026-01-21 12:27:12 -08:00
Carlos Amedee
83c44ec032 internal/goversion: update Version to 1.27
Go 1.27 is in the process of being opened for development (to be
eventually released). This change marks the very beginning of its
development cycle, updating the Version value accordingly.

For #40705.
For #76474.

Change-Id: Id64ac75e6727715c32a842501b4318281dd8998f
Reviewed-on: https://go-review.googlesource.com/c/go/+/737960
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
2026-01-21 12:25:21 -08:00
Youlin Feng
2baa1d1762 runtime: remove the unused scanIdx from mspan
After CL 700496, mspan.scanIdx is never used, this CL just remove it.

Change-Id: I41ce9902957c0cfa6fbf26b66a2a7787b179376a
Reviewed-on: https://go-review.googlesource.com/c/go/+/737220
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Auto-Submit: Carlos Amedee <carlos@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2026-01-21 07:22:46 -08:00
Alan Donovan
a8291eb614 cmd/compile/internal/staticinit: fix bug in global new(expr)
The StaticInit pass asserts that the operand of &v is a global,
but this is not so for the &autotemp desugaring of new(expr).

(The variable has by that point escaped to the heap, so
the object code calls runtime.newobject. A future optimization
would be to statically allocate the variable when it is safe
and advantageous to do so.)

Thanks to khr for suggesting the fix.

+ static test

Fixes #77237

Change-Id: I71b34a1353fe0f3e297beab9851f8f87d765d8f1
Reviewed-on: https://go-review.googlesource.com/c/go/+/737680
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-01-20 13:48:41 -08:00
Daniel Müllner
4edaaf2b52 strconv: don't call internal Atoi twice in Atoi
Change-Id: I89a41bbc83fdf473399527a933d57794ce83f68a
Reviewed-on: https://go-review.googlesource.com/c/go/+/737261
Reviewed-by: Russ Cox <rsc@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Florian Lehner <lehner.florian86@gmail.com>
2026-01-20 10:18:00 -08:00
Michael Pratt
7251c9e0f0 doc: fix urlmaxqueryparams typos
Updates #77101.

Change-Id: I6a6a636cd58e1bd01943066368cb1424db6c6a92
Reviewed-on: https://go-review.googlesource.com/c/go/+/737040
Reviewed-by: Damien Neil <dneil@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-01-16 09:40:45 -08:00
Alan Donovan
532e320349 go/types,cmd/compile/internal/types2: better diagnostic for type shadowing
This change causes the "x is not a type" diagnostic to describe
x's actual kind, helping to reveal when shadowing is at work.

(The kind description could improve other errors too.)

Fixes #76877

Change-Id: Ia3484998bb384ff570c20b6792cf8461c60aa38c
Reviewed-on: https://go-review.googlesource.com/c/go/+/731180
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Robert Griesemer <gri@google.com>
2026-01-15 15:10:27 -08:00
Damien Neil
bb7c0c717c archive/zip: reduce CPU usage in index construction
Constructing the zip index (which is done once when first opening
a file in an archive) can consume large amounts of CPU when
processing deeply-nested directory paths.

Switch to a less inefficient algorithm.

Thanks to Jakub Ciolek for reporting this issue.

	goos: darwin
	goarch: arm64
	pkg: archive/zip
	cpu: Apple M4 Pro
	                          │  /tmp/bench.0  │            /tmp/bench.1            │
	                          │     sec/op     │   sec/op     vs base               │
	ReaderOneDeepDir-14         25983.62m ± 2%   46.01m ± 2%  -99.82% (p=0.000 n=8)
	ReaderManyDeepDirs-14          16.221 ± 1%    2.763 ± 6%  -82.96% (p=0.000 n=8)
	ReaderManyShallowFiles-14      130.3m ± 1%   128.8m ± 2%   -1.20% (p=0.003 n=8)
	geomean                         3.801        253.9m       -93.32%

Fixes #77102
Fixes CVE-2025-61728

Change-Id: I2c9c864be01b2a2769eb67fbab1b250aeb8f6c42
Reviewed-on: https://go-internal-review.googlesource.com/c/go/+/3060
Reviewed-by: Nicholas Husin <husin@google.com>
Reviewed-by: Neal Patel <nealpatel@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/736713
Auto-Submit: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
2026-01-15 10:35:56 -08:00
Damien Neil
2dcaaa7512 net/url: add urlmaxqueryparams GODEBUG to limit the number of query parameters
net/url does not currently limit the number of query parameters parsed by
url.ParseQuery or URL.Query.

When parsing a application/x-www-form-urlencoded form,
net/http.Request.ParseForm will parse up to 10 MB of query parameters.
An input consisting of a large number of small, unique parameters can
cause excessive memory consumption.

We now limit the number of query parameters parsed to 10000 by default.
The limit can be adjusted by setting GODEBUG=urlmaxqueryparams=<n>.
Setting urlmaxqueryparams to 0 disables the limit.

Thanks to jub0bs for reporting this issue.

Fixes #77101
Fixes CVE-2025-61726

Change-Id: Iee3374c7ee2d8586dbf158536d3ade424203ff66
Reviewed-on: https://go-internal-review.googlesource.com/c/go/+/3020
Reviewed-by: Nicholas Husin <husin@google.com>
Reviewed-by: Neal Patel <nealpatel@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/736712
Auto-Submit: Michael Pratt <mpratt@google.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-01-15 10:35:53 -08:00
Neal Patel
5e1ad12db9 cmd/go/internal/work: sanitize flags before invoking 'pkg-config'
The addition of CgoPkgConfig allowed execution with flags not
matching the safelist. In order to prevent potential arbitrary
code execution at build time, ensure that flags are validated
prior to invoking the 'pkg-config' binary.

Thank you to RyotaK (https://ryotak.net) of GMO Flatt Security Inc.
for reporting this issue.

Fixes CVE-2025-61731
Fixes #77100

Change-Id: Ic51b41f1f7e697ab98c9c32c6fae35f217f7f364
Reviewed-on: https://go-internal-review.googlesource.com/c/go/+/3240
Reviewed-by: Nicholas Husin <husin@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/736711
Reviewed-by: Junyang Shao <shaojunyang@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-01-15 10:35:49 -08:00
Roland Shoemaker
94a1296a45 cmd/go: update VCS commands to use safer flag/argument syntax
In various situations, the toolchain invokes VCS commands. Some of these
commands take arbitrary input, either provided by users or fetched from
external sources. To prevent potential command injection vulnerabilities
or misinterpretation of arguments as flags, this change updates the VCS
commands to use various techniques to separate flags from positional
arguments, and to directly associate flags with their values.

Additionally, we update the environment variable for Mercurial to use
`HGPLAIN=+strictflags`, which is the more explicit way to disable user
configurations (intended or otherwise) that might interfere with command
execution.

We also now disallow version strings from being prefixed with '-' or
'/', as doing so opens us up to making the same mistake again in the
future. As far as we know there are currently ~0 public modules affected
by this.

While I was working on cmd/go/internal/vcs, I also noticed that a
significant portion of the commands being implemented were dead code.
In order to reduce the maintenance burden and surface area for potential
issues, I removed the dead code for unused commands.

We should probably follow up with a more structured change to make it
harder to accidentally re-introduce these issues in the future, but for
now this addresses the issue at hand.

Thanks to splitline (@splitline) from DEVCORE Research Team for
reporting this issue.

Fixes CVE-2025-68119
Fixes #77099

Change-Id: I9d9f4ee05b95be49fe14edf71a1b8e6c0784378e
Reviewed-on: https://go-internal-review.googlesource.com/c/go/+/3260
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Nicholas Husin <husin@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/736710
Auto-Submit: Michael Pratt <mpratt@google.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-01-15 10:35:46 -08:00
Roland Shoemaker
bba24719a4 crypto/tls: don't copy auto-rotated session ticket keys in Config.Clone
Once a tls.Config is used, it is not safe to mutate. We provide the
Clone method in order to allow users to copy and modify a Config that
is in use.

If Config.SessionTicketKey is not populated, and if
Config.SetSessionTicketKeys has not been called, we automatically
populate and rotate session ticket keys. Clone was previously copying
these keys into the new Config, meaning that two Configs could share
the same auto-rotated session ticket keys. This could allow sessions to
be resumed across different Configs, which may have completely different
configurations.

This change updates Clone to not copy the auto-rotated session ticket
keys.

Additionally, when resuming a session, check that not just that the leaf
certificate is unexpired, but that the entire certificate chain is still
unexpired.

Fixes #77113
Fixes CVE-2025-68121

Change-Id: I011df7329de83068d11b3f0c793763692d018a98
Reviewed-on: https://go-internal-review.googlesource.com/c/go/+/3300
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Nicholas Husin <husin@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/736709
Auto-Submit: Michael Pratt <mpratt@google.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-01-15 10:35:43 -08:00
Prateik Lohani
9ef26e96e3 sort: improve comment readability for Stable function
Change-Id: I3bc9f906f85e2b5f3d4ba6484e3c125065e36b57
GitHub-Last-Rev: 5d637c1325
GitHub-Pull-Request: golang/go#77190
Reviewed-on: https://go-review.googlesource.com/c/go/+/736501
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@golang.org>
2026-01-15 08:36:28 -08:00
Filippo Valsorda
2bc4315d92 crypto/internal/fips140test: add ML-DSA to FIPS 140-3 functional tests
Change-Id: I568d28d27d2bc55bbadcc678a2fcf9d36a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/731540
Reviewed-by: Roland Shoemaker <roland@golang.org>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-01-14 07:41:48 -08:00