4811 Commits

Author SHA1 Message Date
Filippo Valsorda
d2bb10c89e crypto/tls: add fips140ems GODEBUG setting to disable EMS enforcement
FIPS 140-3 mode requires EMS in TLS 1.2. Unfortunately, some deployments
don't support EMS still, and have audit exemptions for it, but not for
turning off FIPS 140-3 mode entirely.

Add a GODEBUG to disable enforcement. There is no change of default
behavior, the GODEBUG is off by default.

Fixes #80516

Change-Id: If93e2c1ea70dc5f34bcf7285549837576a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/804062
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Daniel McCarney <daniel@binaryparadox.net>
Reviewed-by: Roland Shoemaker <roland@golang.org>
2026-07-29 09:25:28 -07:00
Alan Donovan
f0dbb9bd0b cmd: update x/tools to master
go get golang.org/x/tools@master
go mod vendor
go mod tidy
go generate cmd/go/internal/test

Also, fix a handful of uses of Scanner that triggered
a diagnostic from the newly imported vet check.

+ relnotes for new vet checks

Fixes #17747

Change-Id: I06f480ce9a11b23add59f578763bcc76730d5fb1
Reviewed-on: https://go-review.googlesource.com/c/go/+/804522
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
2026-07-24 11:48:31 -07:00
Nicholas S. Husin
1c3a1bac8b net/http: prioritize lowercase proxy environment variables
This CL vendors in CL 801700, making ProxyFromEnvironment follow the
recently updated behavior of x/net/http/httpproxy.FromEnvironment.

Fixes #79656

Change-Id: Id01c8c4011eb6cc8f51a81231622b7d16a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/803022
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Nicholas Husin <husin@google.com>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-07-20 14:58:22 -07:00
Alan Donovan
7db85e388c go/parser: add func ResolveFile
This CL adds ResolveFile, which performs deprecated ast.Ident
resolution on a File syntax tree produced by the parser
in SkipObjectResolution mode.

As with all ast.Object-related declarations, it is deprecated;
it is provided to ease migration away from ast.Object.

Fixes #79802

+ test, api, relnote

Change-Id: Ia9ba7baf0e546fc8abb7410eb18027777f1c85ea
Reviewed-on: https://go-review.googlesource.com/c/go/+/794420
Reviewed-by: Damien Neil <dneil@google.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-07-20 12:51:53 -07:00
qiulaidongfeng
698882a459 testing/synctest: add Subtest
Fixes #77320

Change-Id: I1ca7480dceb0a95d223ae1618c0e9dd23abe5d49
Reviewed-on: https://go-review.googlesource.com/c/go/+/787940
Auto-Submit: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
2026-07-17 13:24:49 -07:00
Julian Soreavis
1e28d9f580 encoding/base64, encoding/base32: panic when encoded length overflows int
EncodedLen computes the encoded length with int arithmetic that can
wrap for very large n, returning a negative or wrapped value. Callers
that size an allocation from the result (EncodeToString, AppendEncode)
then panic with no indication of the cause, or allocate an undersized
buffer. CL 510635 and CL 512200 raised the overflow threshold of the
unpadded branches but did not eliminate it, and the padded branches
were unchanged: on 32-bit platforms
base64.StdEncoding.EncodedLen(1610612736) still returns -2147483648.

Make EncodedLen panic when the encoded length does not fit in an int,
document the panic, and document the largest n that is guaranteed not
to panic. DecodedLen needs no change: its result is at most n and
cannot overflow.

Fixes #20235

Change-Id: I963a55062a790017b42f49fc3a9178fc3bb024ef
GitHub-Last-Rev: 2a7abbb35f7f5e3a2b74c379c29464e01e2206f5
GitHub-Pull-Request: golang/go#80373
Reviewed-on: https://go-review.googlesource.com/c/go/+/799800
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2026-07-15 14:30:36 -07:00
Simon Law
ff884052f0 net/url: add MustParse
url.MustParse is to url.Parse as uuid.MustParse is to uuid.Parse.

This function replaces the one-liners that programmers have been
writing to initialize variables with valid URL string constants.

Fixes #79946

Change-Id: I2f94c89e10d36d83da713579ca6659b5237604ca
Reviewed-on: https://go-review.googlesource.com/c/go/+/799820
Reviewed-by: Sean Liao <sean@liao.dev>
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Damien Neil <dneil@google.com>
2026-07-15 12:15:25 -07:00
Michael Matloob
74499361ee doc: initialize next directory for Go 1.28
Following the "For the release team" steps in README:

	cd doc
	cp -R initial/ next
	$EDITOR next/1-intro.md

For #79581

Change-Id: I0e56193e2020d0d3804fde9ec6114bef6a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/800722
Reviewed-by: Michael Matloob <matloob@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-07-14 15:21:20 -07:00
Gopher Robot
7e3a04fb91 doc/next: delete
The release note fragments have been merged and added
as _content/doc/go1.27.md in x/website in CL 784681.

For #78779.

Change-Id: I2333d1a9f55158d4e16351a5c53252bf76c3288e
Reviewed-on: https://go-review.googlesource.com/c/go/+/784700
Auto-Submit: Gopher Robot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2026-05-28 21:25:15 -07:00
süleyman mercan
6421cb6565 doc: format net package release note
This PR fixes malformed standard library documentation links
in the Go 1.27 release notes for the net package.

Adheres to the release note formatting guidelines by using
[Package.Symbol] brackets for automatic linking.

Updates #78137

Change-Id: I081c3e465c184602fcf075a1cc9bb20a5244dee9
GitHub-Last-Rev: 697274ebce020d2aa11602c30f1f01f65cb1d859
GitHub-Pull-Request: golang/go#78824
Reviewed-on: https://go-review.googlesource.com/c/go/+/768180
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
2026-05-28 20:35:29 -07:00
David Chase
6449874f49 doc: inserted TODOs into 9-todo.md
Two known unnecessary/done ones have been removed, the
rest are as is.

Change-Id: I859efee292e06cd4877a814280950a47fac5bf43
Reviewed-on: https://go-review.googlesource.com/c/go/+/784480
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-05-28 17:10:42 -07:00
Michael Matloob
9e53e2e2cc doc/next: add release notes for sizespecializedmalloc
The notes are based on the notes that were written for
sizespecializedmalloc for 1.26, except that it's been updated with newer
numbers.

For #79286

Change-Id: I2d6f78d28028eca8c605aa1f84a7094c6a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/783140
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Matloob <matloob@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
2026-05-28 07:39:18 -07:00
Robert Griesemer
c74c040511 doc: document removal of asynctimerchan GODEBUG setting (update release notes)
For #76472.

Change-Id: I1f470cee6b845e4d1fe4d48fd37ac11bbea26fda
Reviewed-on: https://go-review.googlesource.com/c/go/+/783421
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2026-05-26 17:17:01 -07:00
Robert Griesemer
ec37f78ca7 doc: document removal of gotypesalias GODEBUG setting (update release notes)
For #76472.

Change-Id: I4d34fb7ebb34bf7d989e7a2c74349d1435ab5d36
Reviewed-on: https://go-review.googlesource.com/c/go/+/783420
Reviewed-by: Alan Donovan <adonovan@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
TryBot-Bypass: Dmitri Shuralyov <dmitshur@golang.org>
2026-05-26 17:16:57 -07:00
Robert Griesemer
08bd667214 doc: document new struct literal field selectors (update release notes)
For #9859.

Change-Id: Ib39e655fa603345f661e0b32bb56fd532854103c
Reviewed-on: https://go-review.googlesource.com/c/go/+/783400
Reviewed-by: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
2026-05-26 16:51:37 -07:00
Robert Griesemer
4960851b93 spec: added a few version references where they were missing
Change-Id: I30ea95f0d2c06d169ca01f5408819af2ed2a8cf3
Reviewed-on: https://go-review.googlesource.com/c/go/+/783363
Reviewed-by: Alan Donovan <adonovan@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-05-26 16:51:34 -07:00
Robert Griesemer
acd801c178 doc: document generalized function type inference (update release notes)
For #77245.

Change-Id: If36098fc36290fe2430d8ef996f35100f8113739
Reviewed-on: https://go-review.googlesource.com/c/go/+/783362
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2026-05-26 16:47:54 -07:00
Robert Griesemer
ee500cd074 doc: document generic methods (update release notes)
For #77273.

Change-Id: I0ac17d333301a69955f92ca8d5766967a038b89d
Reviewed-on: https://go-review.googlesource.com/c/go/+/783361
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Auto-Submit: Robert Griesemer <gri@google.com>
2026-05-26 16:45:14 -07:00
Robert Griesemer
ef067283ce spec: permit function type inference to satisfy assignability
Add an extra clause to the rules for assignability which permits
(possibly partially instantiated) generic functions to be assignable
to a variable of function type if the missing type parameters can
be inferred.

Update the section on type inference accordingly, as now we don't
need a special case for return statements and assignments anymore.
Instead, explain the type inference equation for the more general
function assignability case.

Added entry in the Appendix's Language versions section.

For #77245.

Change-Id: I8d42846d6e668661b211ed1fb3f27ffe9537a439
Reviewed-on: https://go-review.googlesource.com/c/go/+/768061
Reviewed-by: Mark Freeman <markfreeman@google.com>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Axel Wagner <axel.wagner.hh@googlemail.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
2026-05-26 15:46:00 -07:00
Robert Griesemer
a5bc606a68 runtime: remove asynctimerchan GODEBUG setting
For #76472.

Change-Id: Id6628c749f9794d32f86a4fca564deb0c71f4504
Reviewed-on: https://go-review.googlesource.com/c/go/+/781580
TryBot-Bypass: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
2026-05-26 10:37:37 -07:00
qiulaidongfeng
e0a8616941 math/rand/v2: add method Rand.N
Derived from CL 775100 by qiu laidongfeng <2645477756@qq.com>

Fixes #77853

Change-Id: Iefcdbd1a7dbf82e732dad9bbf94722878c82c1a6
Reviewed-on: https://go-review.googlesource.com/c/go/+/780582
Reviewed-by: qiu laidongfeng <2645477756@qq.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Austin Clements <austin@google.com>
2026-05-21 10:44:53 -07:00
Alan Donovan
91a81e5ae1 go/types,cmd/compile/internal/types2: add String methods
This change adds String methods to the types TypeList, TypeParamList
and Instance. The format is unspecified and is provided merely as
a debugging aid.

Fixes #79287

Change-Id: Ic283ea57bac6465b47b8b81b1fa4590641b639cb
Reviewed-on: https://go-review.googlesource.com/c/go/+/780581
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
2026-05-20 16:26:22 -07:00
Damien Neil
4a38094e42 database/sql: add RowsColumnScanner, expose ConvertAssign
Add a new optional interface for driver.Rows which permits
the driver to scan directly into the user-provided []any.

Export the convertAssign function, to permit drivers
to fall back to the old assignment path.

Using the prior Rows interface, a driver provides values
with a function like:

  func (rows *Rows) Next(dest []Value) error {
    dest[0] = "some value"
    return nil
  }

Using the new RowsColumnScanner interface, the
equivalent is:

  func (rows *Rows) ScanColumn(scanCtx driver.ScanContext, index int, dest any) error {
    return sql.ConvertAssign(scanCtx, dest, "some value")
  }

Fixes #67546

Change-Id: I421f5639a12c78c76d377534b5a82f846a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/777961
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-05-20 14:21:32 -07:00
Michael Podtserkovskii
a7ea4a7ecd cmd/compile/internal/syntax: resolve //line filenames relative to source directory
The behaviour of the compiler and go/scanner is unified:
Relative //line directives are now relative to the directory of
the scanned file.

Fixes #70478

Change-Id: I804edbb5f9540d386e0fb1a4e64b10b717125d1b
Reviewed-on: https://go-review.googlesource.com/c/go/+/706795
Reviewed-by: Alan Donovan <adonovan@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-05-20 11:26:29 -07:00
Paul Murphy
c07a0f09b8 doc: document new ppc64/linux features
Updates #76244

Change-Id: Id5dac150a179246d3b73dfdab6653b362cbbded9
Reviewed-on: https://go-review.googlesource.com/c/go/+/777620
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
TryBot-Bypass: Dmitri Shuralyov <dmitshur@golang.org>
Commit-Queue: Paul Murphy <paumurph@redhat.com>
Auto-Submit: Paul Murphy <paumurph@redhat.com>
2026-05-19 13:05:55 -07:00
Filippo Valsorda
7f4f2c1c7b crypto/ecdsa: check the hash length in PrivateKey.Sign
Unfortunately, SignASN1 doesn't take the hash function at all, but
PrivateKey.Sign does, so we can check the hash length there.

This is arguably a breaking change, but the previous behavior is almost
certain to be a bug.

opts was allowed to be nil, so continue to allow that.

Change-Id: I75a11ab3f9df9de4234b1fc913f26ab06a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/765641
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Reviewed-by: Mark Freeman <markfreeman@google.com>
Reviewed-by: Daniel McCarney <daniel@binaryparadox.net>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-05-19 12:00:10 -07:00
Filippo Valsorda
2f57f7626e crypto/tls: remove the x509keypairleaf GODEBUG setting
Fixes #75316

Change-Id: I241af97bf6a05e94f40a9f62393ed4fe6a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/777384
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
2026-05-19 11:56:21 -07:00
Filippo Valsorda
1634ae8c7c crypto/tls: remove the tls10server GODEBUG setting
Updates #75316

Change-Id: I43e7311777fb79b9486a05c8e8d3a42e6a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/777383
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-05-19 11:56:17 -07:00
Filippo Valsorda
0f4862de57 crypto/tls: remove tls3des GODEBUG setting
Updates #75316

Change-Id: Iedd2a6746d0ebd6a7b7147f34cb7435b6a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/777382
TryBot-Bypass: Filippo Valsorda <filippo@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
2026-05-19 11:56:13 -07:00
Filippo Valsorda
14a4bc2051 crypto/tls: remove tlsrsakex GODEBUG setting
Updates #75316

Change-Id: I6eb8482505a83b8b63edcb7d443e227a6a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/777381
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-05-19 11:56:08 -07:00
Filippo Valsorda
a7bc19bf37 crypto/tls: remove the tlsunsafeekm GODEBUG setting
Updates #75316

Change-Id: I2efa3e485653f5b403d92e5d99959e356a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/777380
Reviewed-by: Roland Shoemaker <roland@golang.org>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-05-19 11:56:02 -07:00
Filippo Valsorda
6b0243ccf6 crypto/tls: implement MLKEM1024 key exchange
Fixes #78543

Change-Id: I26a70a64665c75e5116b83f73a75093f6a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/777221
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Roland Shoemaker <roland@golang.org>
2026-05-19 11:52:51 -07:00
Filippo Valsorda
27532dc35c crypto/tls: deprecate Config.Rand
We now use SetGlobalRandom in recorded tests.

It was already partially ineffective: ML-KEM encapsulation, used as part
of X25519MLKEM768, doesn't take a source of randomness, and instead
always uses the global random source.

Fixes #79367

Change-Id: I1cc07ebec21bee32ece685efde188c0d6a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/765926
Auto-Submit: Filippo Valsorda <filippo@golang.org>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Reviewed-by: David Chase <drchase@google.com>
2026-05-19 11:49:17 -07:00
Filippo Valsorda
542d7d549f crypto/tls: let Config.CurvePreferences override GODEBUG options
tlsmlkem=0 and tlssecpmlkem=0 were never meant to forcibly disable PQ
KEMs, they were only meant to restore the Go 1.24 and Go 1.26 defaults
when Config.CurvePreferences is nil.

I noticed this while struggling to add a non-default key exchange.

While at it, make our behavior on unimplemented Config.CurvePreferences
entries more consistent by ignoring them regardless of role.

Udpates #69985
Updates #71206

Change-Id: I7d977282153b1d95fdb549efa92353e86a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/777220
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Roland Shoemaker <roland@golang.org>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
2026-05-19 11:46:14 -07:00
Filippo Valsorda
c74ba7d265 crypto/tls: add ML-DSA support
Tested against Google Chrome Canary 150.0.7834.0.

The Client-TLSv10, Client-TLSv11, and Client-TLSv12 recordings need to
change because they are configured with a version range that includes
TLS 1.3 (even if the OpenSSL server selects the lower one), so they
include ML-DSA signature algorithms in the Client Hello. The
Client-TLSv13 and Server-TLSv13-ClientAuthRequested* recordings need to
change because they now advertise ML-DSA support.

Because of #79481, we need to regenerate all recordings anyway, so defer
doing so to the next CL 779662, to avoid churning twice and bloating the
git history.

Fixes #78888

Change-Id: I14e6a89b459166155261aa8fc0edb83c6a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/776709
Reviewed-by: Roland Shoemaker <roland@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
TryBot-Bypass: Filippo Valsorda <filippo@golang.org>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
2026-05-19 11:14:16 -07:00
Filippo Valsorda
4e51025e3e crypto/x509: add ML-DSA support
Updates #78888

Change-Id: I33e2d386fa911c67f062e24f52891a3c6a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/776708
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Daniel McCarney <daniel@binaryparadox.net>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Roland Shoemaker <roland@golang.org>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2026-05-19 10:02:07 -07:00
Roland Shoemaker
4bf23b51b8 crypto/x509: honor SSL_CERT_{FILE,DIR} on windows/darwin
When these env vars are set, load roots from on-disk, and don't use the
platform verifier.

Fixes #77865

Change-Id: I3183d1636238bed924252fe1288cfa263d17f61d
Reviewed-on: https://go-review.googlesource.com/c/go/+/776940
Reviewed-by: Neal Patel <nealpatel@google.com>
Auto-Submit: Roland Shoemaker <roland@golang.org>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
2026-05-19 09:09:49 -07:00
Filippo Valsorda
caa4c72fee crypto/x509: accept non-string pkix.Name attributes
Renamed parseTime to readASN1Time to make it clear it consumes the
cryptobyte.String, like the String methods.

Fixes #75260

Change-Id: I707b70e65fb627904f997d2e7cf122f96a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/778681
Reviewed-by: Roland Shoemaker <roland@golang.org>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: David Chase <drchase@google.com>
2026-05-19 05:03:42 -07:00
Filippo Valsorda
7bc111c6eb crypto/mldsa: new package
Fixes #77626

Change-Id: I3f271f961872d9e33605ba7becba7ece6a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/776706
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Roland Shoemaker <roland@golang.org>
2026-05-19 04:26:28 -07:00
Armin Günther
8f7f951965 math/big: add Int.Divide and RoundingMode aliases
Adds method Int.Divide to compute quotient and remainder of two Ints.
Adds RoundingMode aliases Trunc, Floor, Round and Ceil.

Fixes #76821

Change-Id: I7de80d76450f851d262b43a0685a0dc2218493f6
GitHub-Last-Rev: b52200bb94fc3b4f15dbe02e8caa1b08c25d2b75
GitHub-Pull-Request: golang/go#76820
Reviewed-on: https://go-review.googlesource.com/c/go/+/729860
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
TryBot-Bypass: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Peter Weinberger <pjw@google.com>
2026-05-18 17:14:10 -07:00
Robert Griesemer
2677fe9bbe go/constant: add StringLen function
For fast computation of a string value's length w/o the need to first
"materialize" the actual string.

Use StringLen in the type checker where appropriate.

Fixes #79042.
Fixes #78346.

Change-Id: Id602b060176b771d73fc737e0a37a9707f235a02
Reviewed-on: https://go-review.googlesource.com/c/go/+/772320
Auto-Submit: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2026-05-18 17:08:06 -07:00
Damien Neil
813b317cc9 net/http/httptest: add NewTestServer with in-memory network
NewTestServer takes a *testing.T. It uses it to register a
Cleanup function to shut down the server at the end of a test,
and to fail the test when a server handler panics.

NewTestServer uses an in-memory fake network by default,
suitable for use with the testing/synctest package.
The user can choose to use the loopback network instead
by calling Start or StartTLS.

For #76608

Change-Id: Ic99e304f1a809a4727aaa9f7316f60ec6a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/769521
Reviewed-by: Nicholas Husin <husin@google.com>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Nicholas Husin <nsh@golang.org>
Auto-Submit: Damien Neil <dneil@google.com>
2026-05-18 11:15:01 -07:00
Filippo Valsorda
6997bcd820 crypto/x509: add RawSignatureAlgorithm
Fixes #76133

Change-Id: I7889aeff2ed197ee15f2ce7689b99b936a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/778660
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
2026-05-18 09:09:22 -07:00
Marten Seemann
1456da550a crypto/tls: add QUICConfig.ClientHelloInfoConn
Fixes #77363.

Change-Id: I28ec5cdd16e96bae13f495a904006845dfbf3a2e
Reviewed-on: https://go-review.googlesource.com/c/go/+/745720
Reviewed-by: Damien Neil <dneil@google.com>
Auto-Submit: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Daniel McCarney <daniel@binaryparadox.net>
2026-05-07 14:34:33 -07:00
Damien Neil
15b9fc2659 net/http: support non-tls.Conn TLS connections
Historically, x/net/http2 has supported working with user-provided
net.Conns that implement the ConnectionState method from *tls.Conn.

Howver, net/http has required that user-provided net.Conns be a
concrete *tls.Conn for it to observe the TLS state of the connection.

CL 440795 made the net/http Server set Request.TLS when the net.Conn
has a ConnectionState method, but did not affect protocol negotiation.
(So a non-*tls.Conn can never negotiate HTTP/2.)

CL 765360 made the net/http Server also able to negotiate HTTP/2
when using a non-*tls.Conn net.Conn with a ConnectionState method.
This was part of a change to support net/http/internal/http2 tests,
not an intentional change to functionality in net/http.

Finish off the job by making the net/http Transport negotiate HTTP/2
when using a non-*tls.Conn net.Conn with a ConnectionState method.

Document the new support.

Fixes #21753

Change-Id: Ia9854f90df3044fcc855fce105006a186a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/772961
Reviewed-by: Nicholas Husin <nsh@golang.org>
Reviewed-by: Nicholas Husin <husin@google.com>
Auto-Submit: Damien Neil <dneil@google.com>
Reviewed-by: 王伟强 <wwqgtxx@gmail.com>
TryBot-Bypass: Damien Neil <dneil@google.com>
2026-05-07 14:04:41 -07:00
Emmanuel T Odeke
978f00ab7f crypto/x509/pkix: render string-typed attribute values as strings
RFC 2253 §2.4 says that an AttributeValue should be rendered as a string
when its ASN.1 type has a string representation, reserving the
prefixed hex form for types that don't.

RDNSequence.String previously hex-encoded any value whose OID wasn't in
attributeTypeNames, even when the value was already a Go string. Render
string-typed values directly; the existing escape logic handles RFC 2253
special characters.

Fixes #33093

Change-Id: Idb8acd907f9dac902790c9ac7d0bc0cb36b5b918
Reviewed-on: https://go-review.googlesource.com/c/go/+/773800
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Daniel McCarney <daniel@binaryparadox.net>
Reviewed-by: Roland Shoemaker <roland@golang.org>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-05-06 07:52:57 -07:00
cuishuang
4e0783368b all: fix a lot of spelling mistakes
Change-Id: I86e48219ddfdf0d8607a69d7915443e8e21194d0
Reviewed-on: https://go-review.googlesource.com/c/go/+/768940
Auto-Submit: Sean Liao <sean@liao.dev>
Reviewed-by: Sean Liao <sean@liao.dev>
Reviewed-by: Carlos Amedee <carlos@golang.org>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2026-05-01 13:52:37 -07:00
Michael Pratt
02d136966c cmd/trace: listen on localhost when address omitted
Today `-http=:6060` listens on all addresses. Strictly speaking, that is
what `:6060` implies, but most users actually only care to access from
their own machine.

cmd/pprof listens only on localhost when given such an address.
Change cmd/trace to match this behavior since it is a safer default and
makes cmd/trace more consistent with our other tools.

Users that actually want to listen on all addresses can explicitly
include the unspecified address (e.g., `-http=0.0.0.0:6060`).

For #78921.

Change-Id: I47e1fbbdd5374abfeeec10916eb9d2136a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/770461
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
2026-04-24 12:08:18 -07:00
Damien Neil
2fb2b98da3 uuid: new package for generating and parsing UUIDs
For #62026

Change-Id: Idd186c0eb1d9e9962e1bd4c26d61ea0c57473eb8
Reviewed-on: https://go-review.googlesource.com/c/go/+/725602
Auto-Submit: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Neal Patel <nealpatel@google.com>
2026-04-21 08:37:26 -07:00
qiulaidongfeng
11b596c22d bytes,strings: add CutLast
Fixes #71151

Change-Id: I3b3d49c35b0fa2c1220d3f39bbd506cc072b52b0
Reviewed-on: https://go-review.googlesource.com/c/go/+/764601
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Sean Liao <sean@liao.dev>
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
2026-04-14 06:58:23 -07:00