]> Cypherpunks.ru repositories - gostls13.git/log
gostls13.git
12 months agodoc/go1.21: fix HTML tag
Cherry Mui [Tue, 30 May 2023 18:59:55 +0000 (14:59 -0400)]
doc/go1.21: fix HTML tag

Fix a broken HTML tag.

Change-Id: I9e7c65c2cc12c7b14ca205f78b78ac1e9c92a3ad
Reviewed-on: https://go-review.googlesource.com/c/go/+/499355
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Bypass: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
12 months agocmd/go: lock in new toolchain semantics
Russ Cox [Thu, 25 May 2023 15:59:50 +0000 (11:59 -0400)]
cmd/go: lock in new toolchain semantics

The design doc says 'toolchain' lines apply even if the default
toolchain is older than the one specified in the toolchain line.
However, that leads to various confusing behavior and security issues.
Instead, treat toolchain as a min go version that only applies
in the current module (not in dependencies).

As an example of confusing behavior / security issue, if I install
Go 1.30 and then run 'go build' in a module I've checked out,
I expect to use Go 1.30 or newer, not to silently use an older toolchain
that may have security problems fixed in Go 1.30.
Making toolchain a min establishes that guarantee.

Also clean up the tests quite a bit.

Finally drop + from the acceptable version suffixes; we use + for +auto and +path.

For #57001.

Change-Id: Ia92c66be75d6d0e31cb4e2c0aa936fa4ec5c0a8c
Reviewed-on: https://go-review.googlesource.com/c/go/+/498260
Reviewed-by: Bryan Mills <bcmills@google.com>
Auto-Submit: Russ Cox <rsc@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>

12 months agocmd/go: switch to newer toolchain in go get as needed
Russ Cox [Wed, 24 May 2023 21:37:11 +0000 (17:37 -0400)]
cmd/go: switch to newer toolchain in go get as needed

If we run 'go get go@1.40' or 'go get m@v' where m has a go.mod
that says 'go 1.40', we need to write a new go.mod that says 'go 1.40'.
But we can't be sure we know how to write a Go 1.40-compatible go.mod.
Instead, download the latest point release of Go 1.40 and invoke it to
finish the get command.

For #57001.

Change-Id: I4133fc3c2ecf91226a6c09a3086275ecc517e223
Reviewed-on: https://go-review.googlesource.com/c/go/+/498118
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Russ Cox <rsc@golang.org>
Auto-Submit: Russ Cox <rsc@golang.org>

12 months agocmd/compile: remove special treatment for cover vars in initorder
Than McIntosh [Tue, 30 May 2023 14:49:11 +0000 (10:49 -0400)]
cmd/compile: remove special treatment for cover vars in initorder

This patch reverts a portion of the changes in CL 443715, specifically
the code in initorder that treats coverage counter variables as special
with respect to init order. The special casing is no longer needed
now after a change to the way coverage instrumention is done (the go and
cover cmds now make sure that coverage variables appear first in
the compilation order).

Updates #56293.

Change-Id: Idf803ff4c1a095e88d455a6adcd63991687eb288
Reviewed-on: https://go-review.googlesource.com/c/go/+/499216
Run-TryBot: Than McIntosh <thanm@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
12 months agocmd/{cover,go}: revise fix for pkg init order change with -cover
Than McIntosh [Tue, 30 May 2023 14:44:45 +0000 (10:44 -0400)]
cmd/{cover,go}: revise fix for pkg init order change with -cover

This patch contains a revised fix for issue #56293, switching to a
scheme in which coverage counter variables and meta-data variables are
written to a separate output file as opposed to being tacked onto the
end of an existing rewritten source file.

The advantage of writing counter vars to a separate file is that the
Go command can then present that file as the first source file to the
compiler when the package is built; this will ensure that counter
variable are treated as lexically "before" any other variable that
might call an instrumented function as part of its initializer.

Updates #56293.

Change-Id: Iccb8a6532b976d36ccbd5a2a339882d1f5d19477
Reviewed-on: https://go-review.googlesource.com/c/go/+/499215
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
12 months agoruntime: clarify Pinner doc
Jonathan Amsterdam [Sat, 27 May 2023 12:48:31 +0000 (08:48 -0400)]
runtime: clarify Pinner doc

Rewrite in idiomatic form, fix a typo, break into paragraph, rephrase
slightly.

Change-Id: If146db86aa84214e61128a3bc3e9905396d44710
Reviewed-on: https://go-review.googlesource.com/c/go/+/498716
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Jonathan Amsterdam <jba@google.com>
Reviewed-by: Ansiwen <ansiwen@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
12 months agodoc/go1.21: mention errors.ErrUnsupported
Ian Lance Taylor [Fri, 26 May 2023 23:22:24 +0000 (16:22 -0700)]
doc/go1.21: mention errors.ErrUnsupported

Also mention errors that implement it.

For #41198

Change-Id: I4f01b112f53b19e2494b701bb012cb2cb52f8962
Reviewed-on: https://go-review.googlesource.com/c/go/+/498775
Reviewed-by: Eli Bendersky <eliben@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>

12 months agocrypto/tls: fix cipher suite check when doing 0-RTT resumption
Marten Seemann [Thu, 25 May 2023 08:06:41 +0000 (11:06 +0300)]
crypto/tls: fix cipher suite check when doing 0-RTT resumption

Change-Id: Ia50898308b80149f862457f9cd9f1123da4e6b6f
Reviewed-on: https://go-review.googlesource.com/c/go/+/498215
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Macrombi Lux <macrentals502@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Run-TryBot: Filippo Valsorda <filippo@golang.org>

12 months agodoc/go1.21: mention maps package
Ian Lance Taylor [Sat, 27 May 2023 00:07:49 +0000 (17:07 -0700)]
doc/go1.21: mention maps package

For #57436

Change-Id: I99e8b0819c76f1ccf12154a894c9c4c9d68124d4
Reviewed-on: https://go-review.googlesource.com/c/go/+/498602
Reviewed-by: Eli Bendersky <eliben@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
12 months agodoc/go1.21: mention multipath TCP support
Ian Lance Taylor [Fri, 26 May 2023 23:52:28 +0000 (16:52 -0700)]
doc/go1.21: mention multipath TCP support

For #56539
For #59166

Change-Id: Ief392464916a1a74a8fcc6c3c7bdb213e8c6ef98
Reviewed-on: https://go-review.googlesource.com/c/go/+/498601
Run-TryBot: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Eli Bendersky <eliben@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Matthieu Baerts <matthieu.baerts@tessares.net>
12 months agocmd/go/internal/modload: break more cycles in readModGraph
Bryan C. Mills [Tue, 30 May 2023 14:35:54 +0000 (10:35 -0400)]
cmd/go/internal/modload: break more cycles in readModGraph

Before CL 471595, modload.readModGraph in module with graph pruning
enabled only ever chased down transitive dependencies of unpruned
roots, so pruned dependencies couldn't cause cycles and we didn't
need to dedup them in the loading queue.

However, in 'go get' we are now passing in a set of upgraded modules
to unprune, and those upgraded modules can potentially contain cycles,
leading to an infinite loop during loading.

We have two options for a fix: we could either drop the 'unprune'
check in the enqueue operation (and instead expand the 'unprune'
requirements in a separate pass, as we do in workspace mode), or we
could check for cycles for all modules (not just the ones that are
naturally unpruned). The latter option makes it clearer that this
process must terminate, so we choose that.

(It may be possible to clean up and simplify the workspace-mode case
now that we are passing in the 'unprune' map, but for now we're
looking for a minimal fix for the Go 1.21 release.)

Fixes #60490.

Change-Id: I701f5d43a35e357f6c0c0c9d10b7aa088f917311
Reviewed-on: https://go-review.googlesource.com/c/go/+/499195
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
Run-TryBot: Bryan Mills <bcmills@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>

12 months agointernal/bytealg: fix alignment code in compare_riscv64.s
Mark Ryan [Wed, 24 May 2023 11:20:11 +0000 (13:20 +0200)]
internal/bytealg: fix alignment code in compare_riscv64.s

The riscv64 implementation of compare has an optimization that is
applied when both pointers share the same alignment but that alignment
is not 8 bytes.  In this case it tries to align both pointers to an 8 byte boundaries,
by individually comparing the first few bytes of each buffer.  Unfortunately,
the existing code is incorrect.  It adjusts the pointers by the wrong number
of bytes resulting, in most cases, in pointers that are not 8 byte aligned.

This commit fixes the issue by individually comparing the first
(8 - (pointer & 7)) bytes of each buffer rather than the first
(pointer & 7) bytes.

We also remove an unnecessary immediate MOV instruction.

This particular optimization is not covered by any of the existing
benchmarks so a new benchmark, benchmarkCompareBytesBigBothUnaligned,
is provided.  The benchmark tests the case where both pointers have
the same alignment but may not be 8 byte aligned.  Results of the
new benchmark along with some of the existing benchmarks generated on
a SiFive HiFive Unmatched A00 with 16GB of RAM running Ubuntu 23.04
are presented below.

CompareBytesEqual-4                           70.00n ±  6%   68.32n ±  0%   -2.40% (p=0.020 n=10)
CompareBytesToNil-4                           19.31n ±  0%   18.47n ±  0%   -4.35% (p=0.000 n=10)
CompareBytesEmpty-4                           16.79n ±  0%   15.95n ±  0%   -4.97% (p=0.000 n=10)
CompareBytesIdentical-4                       19.94n ± 15%   18.32n ± 13%   -8.15% (p=0.040 n=10)
CompareBytesSameLength-4                      37.93n ±  0%   42.44n ±  1%  +11.91% (p=0.000 n=10)
CompareBytesDifferentLength-4                 37.93n ±  0%   42.44n ±  0%  +11.89% (p=0.000 n=10)
CompareBytesBigUnaligned/offset=1-4           3.881m ± 14%   3.880m ± 15%        ~ (p=0.436 n=10)
CompareBytesBigUnaligned/offset=2-4           3.884m ±  0%   3.875m ±  0%        ~ (p=0.190 n=10)
CompareBytesBigUnaligned/offset=3-4           3.858m ±  1%   3.868m ±  1%        ~ (p=0.105 n=10)
CompareBytesBigUnaligned/offset=4-4           3.877m ±  1%   3.876m ±  0%        ~ (p=0.529 n=10)
CompareBytesBigUnaligned/offset=5-4           3.859m ±  0%   3.874m ±  0%   +0.39% (p=0.009 n=10)
CompareBytesBigUnaligned/offset=6-4           3.878m ±  1%   3.876m ±  0%        ~ (p=0.353 n=10)
CompareBytesBigUnaligned/offset=7-4           3.868m ±  1%   3.877m ±  0%        ~ (p=0.190 n=10)
CompareBytesBigBothUnaligned/offset=0-4       1.586m ±  0%   1.765m ±  0%  +11.30% (p=0.000 n=10)
CompareBytesBigBothUnaligned/offset=1-4     153.132m ±  1%   1.765m ±  1%  -98.85% (p=0.000 n=10)
CompareBytesBigBothUnaligned/offset=2-4     152.930m ±  1%   1.765m ±  1%  -98.85% (p=0.000 n=10)
CompareBytesBigBothUnaligned/offset=3-4     152.093m ±  1%   1.769m ±  0%  -98.84% (p=0.000 n=10)
CompareBytesBigBothUnaligned/offset=4-4       1.602m ±  0%   1.764m ±  0%  +10.11% (p=0.000 n=10)
CompareBytesBigBothUnaligned/offset=5-4     152.314m ±  1%   1.768m ±  0%  -98.84% (p=0.000 n=10)
CompareBytesBigBothUnaligned/offset=6-4     152.905m ±  1%   1.764m ±  1%  -98.85% (p=0.000 n=10)
CompareBytesBigBothUnaligned/offset=7-4     152.951m ±  1%   1.804m ±  2%  -98.82% (p=0.000 n=10)
CompareBytesBig-4                             1.441m ± 21%   1.373m ± 55%        ~ (p=0.481 n=10)
CompareBytesBigIdentical-4                    19.94n ±  1%   19.10n ±  0%   -4.21% (p=0.001 n=10)
geomean                                       243.7µ         76.65µ        -68.54%

CompareBytesBigUnaligned/offset=1-4          257.7Mi ± 12%     257.7Mi ± 13%          ~ (p=0.424 n=10)
CompareBytesBigUnaligned/offset=2-4          257.5Mi ±  0%     258.1Mi ±  0%          ~ (p=0.190 n=10)
CompareBytesBigUnaligned/offset=3-4          259.2Mi ±  1%     258.5Mi ±  1%          ~ (p=0.105 n=10)
CompareBytesBigUnaligned/offset=4-4          257.9Mi ±  1%     258.0Mi ±  0%          ~ (p=0.529 n=10)
CompareBytesBigUnaligned/offset=5-4          259.1Mi ±  0%     258.1Mi ±  0%     -0.39% (p=0.008 n=10)
CompareBytesBigUnaligned/offset=6-4          257.9Mi ±  1%     258.0Mi ±  0%          ~ (p=0.353 n=10)
CompareBytesBigUnaligned/offset=7-4          258.5Mi ±  1%     257.9Mi ±  0%          ~ (p=0.190 n=10)
CompareBytesBigBothUnaligned/offset=0-4      630.6Mi ±  0%     566.6Mi ±  0%    -10.15% (p=0.000 n=10)
CompareBytesBigBothUnaligned/offset=1-4      6.533Mi ±  1%   566.545Mi ±  1%  +8572.48% (p=0.000 n=10)
CompareBytesBigBothUnaligned/offset=2-4      6.537Mi ±  1%   566.683Mi ±  1%  +8568.27% (p=0.000 n=10)
CompareBytesBigBothUnaligned/offset=3-4      6.576Mi ±  1%   565.200Mi ±  0%  +8495.43% (p=0.000 n=10)
CompareBytesBigBothUnaligned/offset=4-4      624.2Mi ±  0%     566.9Mi ±  0%     -9.18% (p=0.000 n=10)
CompareBytesBigBothUnaligned/offset=5-4      6.566Mi ±  1%   565.758Mi ±  0%  +8516.41% (p=0.000 n=10)
CompareBytesBigBothUnaligned/offset=6-4      6.542Mi ±  1%   567.036Mi ±  1%  +8567.35% (p=0.000 n=10)
CompareBytesBigBothUnaligned/offset=7-4      6.542Mi ±  1%   554.390Mi ±  2%  +8374.05% (p=0.000 n=10)
CompareBytesBig-4                            694.2Mi ± 18%     728.1Mi ± 35%          ~ (p=0.481 n=10)
CompareBytesBigIdentical-4                   47.83Ti ±  1%     49.92Ti ±  0%     +4.39% (p=0.002 n=10)
geomean                                      170.0Mi           813.8Mi         +378.66%

Change-Id: I0a2d0386d5ca1ffa249682a12ebd1533508e31e9
Reviewed-on: https://go-review.googlesource.com/c/go/+/497838
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Joel Sing <joel@sing.id.au>
Reviewed-by: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: M Zhuo <mzh@golangcn.org>
Reviewed-by: Keith Randall <khr@google.com>
Run-TryBot: M Zhuo <mzh@golangcn.org>

12 months agogo/types: don't use user string as format string
Robert Griesemer [Tue, 30 May 2023 15:38:56 +0000 (08:38 -0700)]
go/types: don't use user string as format string

Fixes #60500.

Change-Id: I272c71071f239d5c9472e19ae25461001e7f6a8f
Reviewed-on: https://go-review.googlesource.com/c/go/+/499275
Reviewed-by: Robert Griesemer <gri@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
12 months agosyscall: fix ComputerName on Windows
qmuntal [Mon, 29 May 2023 09:45:14 +0000 (11:45 +0200)]
syscall: fix ComputerName on Windows

GetComputerName expects n to be the size of the buffer, and
on output contains the number of characters copied to the buffer.

CL 493036 broke ComputerName by always setting n to 0.

Change-Id: I3f4b30d2f9825d321a6d28ec82bdc7b6294e04e4
Reviewed-on: https://go-review.googlesource.com/c/go/+/499035
Run-TryBot: Quim Muntal <quimmuntal@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
12 months agocmd/go: update cover flag documentation
Enrico Candino [Thu, 25 May 2023 22:52:57 +0000 (00:52 +0200)]
cmd/go: update cover flag documentation

Cover flag documentation was not up to date, and the -covermode flag
documentation was missing.

Fixes #60438

Change-Id: I11e769fa2a32d074de7a748aa534afdfe2ca4e78
Reviewed-on: https://go-review.googlesource.com/c/go/+/498415
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
12 months agodoc/go1.21: document clear builtin and init order changes
Ian Lance Taylor [Fri, 26 May 2023 21:04:37 +0000 (14:04 -0700)]
doc/go1.21: document clear builtin and init order changes

Also move all the language changes to the same part of the release notes.

For #56351
For #57411

Change-Id: Id1c51b5eb8f7d85e61a2ae44ee7d73bb13036631
Reviewed-on: https://go-review.googlesource.com/c/go/+/498755
TryBot-Bypass: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>

12 months agocmd/go: always track visited packages in setPGOProfilePath
Michael Pratt [Fri, 26 May 2023 19:49:22 +0000 (15:49 -0400)]
cmd/go: always track visited packages in setPGOProfilePath

Currently we only track visited (copied) packages when a copy is
required. When a copy is not required, we will rewalk each package's
entire dependency graph every time we see it, which is terribly
inefficient.

Pull the visited package check up a level so that we visit packages only
once regardless of how many times they are visited.

Fixes #60455.
Fixes #60428.

Change-Id: I4e9b31eeeaa170db650c461a5de2ca984b9aba0f
Reviewed-on: https://go-review.googlesource.com/c/go/+/498735
Run-TryBot: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com>

12 months agodoc/go1.21: mention os package changes
Ian Lance Taylor [Fri, 26 May 2023 23:03:32 +0000 (16:03 -0700)]
doc/go1.21: mention os package changes

Also mention WTF-8 support in the syscall package.

For #32558
For #58977
For #59971

Change-Id: Id1627889b5e498add498748d9bfc69fb58030b35
Reviewed-on: https://go-review.googlesource.com/c/go/+/498600
Reviewed-by: Eli Bendersky <eliben@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>

12 months agodoc/go1.21: mention changes to the reflect package
Ian Lance Taylor [Fri, 26 May 2023 21:25:45 +0000 (14:25 -0700)]
doc/go1.21: mention changes to the reflect package

Added Value.Clear, deprecated SliceHeader and StringHeader.

For #55002
For #56906

Change-Id: Ib7497aff830d56fad90c31ec28596e71a448e9ce
Reviewed-on: https://go-review.googlesource.com/c/go/+/498757
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Eli Bendersky <eliben@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>

12 months agodoc/go1.21: mention regexp.MarshalText and UnmarshalText
Ian Lance Taylor [Fri, 26 May 2023 21:16:24 +0000 (14:16 -0700)]
doc/go1.21: mention regexp.MarshalText and UnmarshalText

For #46159

Change-Id: Ia9cc0827a89d362532d1a662b791de8eebbfb2fe
Reviewed-on: https://go-review.googlesource.com/c/go/+/498756
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Eli Bendersky <eliben@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>

12 months agoall: update vendored dependencies
Matthew Dempsky [Fri, 26 May 2023 21:34:56 +0000 (14:34 -0700)]
all: update vendored dependencies

Generated with x/build/cmd/updatestd.

Updates #36905.

Change-Id: Iecd76e820c5f40a0f5e013684f7e7bef4c3fd482
Reviewed-on: https://go-review.googlesource.com/c/go/+/498598
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>

12 months agodoc/go1.21: remove TODOs for x/ repos
Ian Lance Taylor [Fri, 26 May 2023 20:45:01 +0000 (13:45 -0700)]
doc/go1.21: remove TODOs for x/ repos

Remove x/ repos changes that aren't part of the 1.21 release.

Change-Id: Ia5cbf02ed6c0cc4dc0ff80d68403723b3f9ae0ba
Reviewed-on: https://go-review.googlesource.com/c/go/+/498596
Run-TryBot: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
12 months agocmd/internal/testdir: stop manually adding GOROOT/bin to PATH
Dmitri Shuralyov [Fri, 26 May 2023 00:26:00 +0000 (20:26 -0400)]
cmd/internal/testdir: stop manually adding GOROOT/bin to PATH

The go command already places $GOROOT/bin at the beginning of $PATH in
the test's environment as of Go 1.19¹, so there's no need for the test
to do it anymore. Start enjoying yet another benefit of using 'go test'.

¹ See go.dev/issue/57050.

For #56844.

Change-Id: If7732cd8b8979eabf185485d3c73858a4e546d69
Reviewed-on: https://go-review.googlesource.com/c/go/+/498271
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
12 months agocmd/go: remove stray reference to mkalldocs.sh
Than McIntosh [Fri, 26 May 2023 19:04:37 +0000 (15:04 -0400)]
cmd/go: remove stray reference to mkalldocs.sh

Clean up a stray reference in the docs to 'mkalldocs.sh', which no
longer exists (was replaced by a Go program, in 676794f73e).

Change-Id: I058e86395b14756d7afc184f99f89dbc5ba0184e
Reviewed-on: https://go-review.googlesource.com/c/go/+/498715
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Than McIntosh <thanm@google.com>
Auto-Submit: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

12 months agodoc: release notes for my humble contributions to go1.21
Alan Donovan [Thu, 18 May 2023 18:38:54 +0000 (14:38 -0400)]
doc: release notes for my humble contributions to go1.21

Updates #58645

Change-Id: Ieb4e6062613e26826ba8373cb4c2fd9198d0c692
Reviewed-on: https://go-review.googlesource.com/c/go/+/496116
Reviewed-by: Eli Bendersky <eliben@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Alan Donovan <adonovan@google.com>
TryBot-Bypass: Eli Bendersky <eliben@google.com>

12 months agosyscall: implement wasip1 Fcntl
Chris O'Hara [Thu, 25 May 2023 02:07:07 +0000 (12:07 +1000)]
syscall: implement wasip1 Fcntl

CL 494915 broke non-blocking I/O on wasip1 for files
opened with os.NewFile. This is fixed by providing an
implementation of fcntl(F_GETFL) for wasip1.

Change-Id: I78979076b95495fd4b94814552e5f5b043270cd0
Reviewed-on: https://go-review.googlesource.com/c/go/+/498195
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Achille Roussel <achille.roussel@gmail.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>

12 months agomisc/wasm: set PATH variable in exec
Johan Brandhorst-Satzkorn [Fri, 26 May 2023 16:58:43 +0000 (09:58 -0700)]
misc/wasm: set PATH variable in exec

The PATH variable is required to run the testenv tests.
Set it for all the runtime invocations where we don't
already set it by inheriting from the environment.

For #59583
For #59907
For #60097

Change-Id: If582dd8f086e3f40bc58d555f6034dcffe6f8e5f
Reviewed-on: https://go-review.googlesource.com/c/go/+/498616
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>

12 months agodoc/go1.21: mention syscall package changes
Ian Lance Taylor [Thu, 25 May 2023 20:58:41 +0000 (13:58 -0700)]
doc/go1.21: mention syscall package changes

One of the changes also affects the os package, so mention it
there too.

For #46259

Change-Id: I8041a5ce009725ab210118ee668fc94196d9ff82
Reviewed-on: https://go-review.googlesource.com/c/go/+/498376
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Eli Bendersky <eliben@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>

12 months agoio: clarify that Read(nil) can return 0, EOF
Ian Lance Taylor [Thu, 25 May 2023 18:31:28 +0000 (11:31 -0700)]
io: clarify that Read(nil) can return 0, EOF

Fixes #40385

Change-Id: I965b5db985fd4418a992e883073cbc8309b2cb88
Reviewed-on: https://go-review.googlesource.com/c/go/+/498355
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>

12 months agodoc: add release note on dead global map variable deletion
Than McIntosh [Fri, 26 May 2023 14:10:01 +0000 (10:10 -0400)]
doc: add release note on dead global map variable deletion

Add a short release note blurb on linker dead-coding of global map
variables.

Updates #58645.

Change-Id: Ibfdd3e2b2b78517db4245b1d7eedd5e75a643b47
Reviewed-on: https://go-review.googlesource.com/c/go/+/498575
Reviewed-by: Eli Bendersky <eliben@google.com>
TryBot-Bypass: Than McIntosh <thanm@google.com>

12 months agoruntime: delete a very stale comment
Austin Clements [Fri, 26 May 2023 01:43:33 +0000 (21:43 -0400)]
runtime: delete a very stale comment

This comment claims mark termination re-scans stacks and uses the
write barrier to determine how much of the stack needs to be
rescanned. This hasn't been true since we introduced the hybrid write
barrier and deleted stack rescanning with CL 31766 in Go 1.8.

Updates #17503 I suppose.

Change-Id: I5e90f25020c9fa6f146ec6ed0642ba2b4884c2a8
Reviewed-on: https://go-review.googlesource.com/c/go/+/498435
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Michael Knyszek <mknyszek@google.com>

12 months agocmd/go/internal/modget: remove unused base.Errorf argument
Dmitri Shuralyov [Fri, 26 May 2023 02:43:36 +0000 (22:43 -0400)]
cmd/go/internal/modget: remove unused base.Errorf argument

Found by the vet check that runs with 'go test cmd/go/internal/modget'.

For #57001.
For #60463.

Change-Id: I4be94f7156724459a5c47bb9745cbb5651fb972c
Reviewed-on: https://go-review.googlesource.com/c/go/+/498270
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
Auto-Submit: Dmitri Shuralyov <dmitshur@google.com>

12 months agocrypto/tls: avoid referencing potentially unused symbols in init
Damien Neil [Fri, 26 May 2023 14:57:45 +0000 (07:57 -0700)]
crypto/tls: avoid referencing potentially unused symbols in init

A reference to a function in a "var _ = ..." init-time
initialization keeps the symbol live. Move references to
Config.EncryptTicket and Config.DecryptTicket into tests.
These references increase the size of an unused import of
crypto/tls by about 1MiB.

Change-Id: I6d62a6dcbd73e22972a217afcda7395e909b52cc
Reviewed-on: https://go-review.googlesource.com/c/go/+/498595
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Run-TryBot: Damien Neil <dneil@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

12 months agodoc/go1.21: mention new go test -fullpath option
Ian Lance Taylor [Thu, 25 May 2023 21:17:56 +0000 (14:17 -0700)]
doc/go1.21: mention new go test -fullpath option

For #37708

Change-Id: I7b04d6331c15771c7d74ff77afd523c435e0dafe
Reviewed-on: https://go-review.googlesource.com/c/go/+/498396
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Auto-Submit: Eli Bendersky <eliben@google.com>
Reviewed-by: Eli Bendersky <eliben@google.com>
12 months agodoc: fill out net/http.ErrSchemeMismatch note
Dan Peterson [Sun, 21 May 2023 13:54:28 +0000 (10:54 -0300)]
doc: fill out net/http.ErrSchemeMismatch note

For #44855

Change-Id: I517394b227ea948ed3e1f9ffdaab2bb2676863c8
Reviewed-on: https://go-review.googlesource.com/c/go/+/496795
TryBot-Bypass: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>

12 months agodatabase/sql: fix regression from earlier RawBytes fix
Brad Fitzpatrick [Thu, 25 May 2023 21:52:01 +0000 (14:52 -0700)]
database/sql: fix regression from earlier RawBytes fix

The earlier CL 497675 for #60304 introduced a behavior change
that, while not strictly a bug, caused a bunch of test failures
in a large codebase. Rather than add behavior changes in a 10 year
old package, revert to the old behavior: a context cancelation
between Rows.Next reporting false and a call to Rows.Err should
not result in Rows.Err returning the context error.

That behavior was accidentally added in CL 497675 as part of changing
how contexts and Rows iteration worked.

Updates #60304
Updates #53970

Change-Id: I22f8a6a6b0b5a94b430576cf50e015efd01ec652
Reviewed-on: https://go-review.googlesource.com/c/go/+/498398
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

12 months agodoc: add release notes for new min/max built-ins
Robert Griesemer [Thu, 25 May 2023 21:50:08 +0000 (14:50 -0700)]
doc: add release notes for new min/max built-ins

For #59488.

Change-Id: Iefabb06014767c5f633082a112a81e9ff5f09a30
Reviewed-on: https://go-review.googlesource.com/c/go/+/498397
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
TryBot-Bypass: Robert Griesemer <gri@google.com>

12 months agocmd/go: show full path name (testdata/script/foo.txt) in script errors
Russ Cox [Thu, 25 May 2023 01:00:22 +0000 (21:00 -0400)]
cmd/go: show full path name (testdata/script/foo.txt) in script errors

Showing the full path (relative to the current directory)
instead of just foo.txt lets editors that understand file:line
jump straight to the file without having to edit it to say
testdata/script/ first.

Change-Id: I44177b687249f3c7c724b45d02f5167607369e1b
Reviewed-on: https://go-review.googlesource.com/c/go/+/498119
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Russ Cox <rsc@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
12 months agodoc/go1.21: merge x/exp/slices issue into slices package
Ian Lance Taylor [Thu, 25 May 2023 21:09:45 +0000 (14:09 -0700)]
doc/go1.21: merge x/exp/slices issue into slices package

For #57348

Change-Id: I84943711b033d63f0993133f93d9f09ce2af5965
Reviewed-on: https://go-review.googlesource.com/c/go/+/498395
Reviewed-by: Eli Bendersky <eliben@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>

12 months agogo/types, types2: don't infer type argument for unused parameter in interfaces
Robert Griesemer [Thu, 25 May 2023 16:54:11 +0000 (09:54 -0700)]
go/types, types2: don't infer type argument for unused parameter in interfaces

Two interface types that are assignable don't have to be identical;
specifically, if they are defined types, they can be different
defined types. If those defined types specify type parameters which
are never used, do not infer a type argument based on the instantiation
of a matching defined type.

Adjusted three existing tests where we inferred type arguments incorrectly.

Fixes #60377.

Change-Id: I91fb207235424b3cbc42b5fd93eee619e7541cb7
Reviewed-on: https://go-review.googlesource.com/c/go/+/498315
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

12 months agospec: document min and max built-ins
Robert Griesemer [Wed, 24 May 2023 20:23:14 +0000 (13:23 -0700)]
spec: document min and max built-ins

For #59488.

Change-Id: I50f65216bf02b42c1e0619702833f4a6dbed8925
Reviewed-on: https://go-review.googlesource.com/c/go/+/498136
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Bypass: Robert Griesemer <gri@google.com>

12 months agodoc: add release notes for additions to the slices package
Eli Bendersky [Thu, 25 May 2023 00:35:56 +0000 (17:35 -0700)]
doc: add release notes for additions to the slices package

Updates #60091

Change-Id: I7438811f4e41a2977acbb5ac74c22a02c28c6597
Reviewed-on: https://go-review.googlesource.com/c/go/+/498175
Reviewed-by: Eli Bendersky <eliben@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Eli Bendersky‎ <eliben@golang.org>
Run-TryBot: Eli Bendersky‎ <eliben@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
12 months agocmd/go: fix reporting of test cycles to have proper order
Michael Matloob [Wed, 24 May 2023 18:59:01 +0000 (14:59 -0400)]
cmd/go: fix reporting of test cycles to have proper order

and begin and end with the same package to demonstrate the cyclical
nature of the stack. Also fix the list_test_cycle script test
which was testing for the wrong behavior.

Fixes #59970

Change-Id: I3b3ee6762ee121fec19688ff1823cdfddae94f53
Reviewed-on: https://go-review.googlesource.com/c/go/+/498115
Reviewed-by: Michael Matloob <matloob@golang.org>
Run-TryBot: Michael Matloob <matloob@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

12 months agoruntime: change heapObjectsCanMove to a func
Russ Cox [Thu, 25 May 2023 16:47:06 +0000 (12:47 -0400)]
runtime: change heapObjectsCanMove to a func

A var is problematic because the zero value is already false,
so if it goes away, it will appear to be false.
I'm also not sure about go:linkname on vars,
so switch to func for both reasons.

Also add a test.

Change-Id: I2318a5390d98577aec025152e65543491489defb
Reviewed-on: https://go-review.googlesource.com/c/go/+/498261
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
12 months agocmd/go: rename gover.ToolchainVersion to gover.FromToolchain
Russ Cox [Thu, 25 May 2023 04:33:44 +0000 (00:33 -0400)]
cmd/go: rename gover.ToolchainVersion to gover.FromToolchain

Suggested by bcmills in CL 497555 review but easier to do at the
top of the stack.

For #57001.

Change-Id: I6f2cc0f546e8d6b1e03c7335a89f07dcb45cf5b6
Reviewed-on: https://go-review.googlesource.com/c/go/+/498077
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
Auto-Submit: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>

12 months agocmd/go: avoid duplicate errors in module load
Russ Cox [Thu, 25 May 2023 04:32:39 +0000 (00:32 -0400)]
cmd/go: avoid duplicate errors in module load

Just a missing base.ExitIfErrors.

Fixes #46160.

Change-Id: I41949b0b7b036da94ba269220951677585d3f8e9
Reviewed-on: https://go-review.googlesource.com/c/go/+/498122
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
Auto-Submit: Russ Cox <rsc@golang.org>

12 months agocmd/go: expand acceptable toolchains a bit
Russ Cox [Wed, 24 May 2023 19:22:33 +0000 (15:22 -0400)]
cmd/go: expand acceptable toolchains a bit

Allow both prefix-goVERSION and goVERSION-suffix for custom toolchains.
Also make sure that a tie in the toolchain and min version goes to the
toolchain line.

For #57001.

Change-Id: Ibeea5f47db7349cfdf36da188bb43e195e196f5b
Reviewed-on: https://go-review.googlesource.com/c/go/+/498076
Auto-Submit: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

12 months agocmd/go: add go get go@version and toolchain@version
Russ Cox [Wed, 24 May 2023 01:12:23 +0000 (21:12 -0400)]
cmd/go: add go get go@version and toolchain@version

go get go@version and toolchain@version updates the
go and toolchain lines in go.mod. If toolchain ends up <= go,
it is dropped.

When the go version crosses certain version boundaries,
it may be necessary to run 'go mod tidy -go=version'.
That's left for a followup CL.

When the go or toolchain version ends up higher than the
current toolchain version, we cannot be sure we know how
to write the file out, so we fail with an error message.
In GOTOOLCHAIN auto mode, the newer toolchain should
be downloaded and reinvoked; that's left for a followup CL too.

For #57001.

Change-Id: Ibfdcc549b40555a53bdb2d019816d18f1bd16be6
Reviewed-on: https://go-review.googlesource.com/c/go/+/497081
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
12 months agocmd/go: handle queries properly in go install m@v
Russ Cox [Wed, 24 May 2023 11:10:17 +0000 (07:10 -0400)]
cmd/go: handle queries properly in go install m@v

The original code only handled go install m@v1.0.0
but not queries like go install m@v1 or m@master.
Handle those by invoking more of the module machinery.

For #57001.

Change-Id: I7d54fc3dd65072e5906a17ff95b407b0f7feac69
Reviewed-on: https://go-review.googlesource.com/c/go/+/497879
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
Auto-Submit: Russ Cox <rsc@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>

12 months agocmd/go: refuse to download zip files for too-new modules
Russ Cox [Mon, 22 May 2023 16:34:17 +0000 (12:34 -0400)]
cmd/go: refuse to download zip files for too-new modules

In general an older version of Go does not know how to construct
a module written against a newer version of Go: the details may
change over time, such as for issues like #42965 (an ignore mechanism).

For #57001.

Change-Id: Id43fcfb71497375ad2eb5dfd292bad0adca0652e
Reviewed-on: https://go-review.googlesource.com/c/go/+/497795
Run-TryBot: Russ Cox <rsc@golang.org>
Auto-Submit: Russ Cox <rsc@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

12 months agocmd/dist: drop wasitest from special list
Austin Clements [Thu, 25 May 2023 13:25:05 +0000 (09:25 -0400)]
cmd/dist: drop wasitest from special list

CL 498255 made runtime/internal/wasitest compatible with all platforms
so that "go test std" works again. This means it no longer has to be
in the special dist test list.

While we're here explain the purpose of this list better and implore
people to please not expand it, since almost any addition is a sign
that "go test std cmd" no longer works.

Change-Id: I31c7fb767787fa587f65c2697aed9ed43e95fb18
Reviewed-on: https://go-review.googlesource.com/c/go/+/498256
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Austin Clements <austin@google.com>

12 months agoall: fix buildall.bash
Russ Cox [Thu, 25 May 2023 12:32:13 +0000 (08:32 -0400)]
all: fix buildall.bash

Disable the android and ios builds since cross-compiling fails there.
Also make runtime/internal/wasitest not build on systems that don't
have syscall.Mkfifo for it to use (including, ironically, wasm itself).

Change-Id: I28eb1f216f9952f81a107056e97ee38e350f9287
Reviewed-on: https://go-review.googlesource.com/c/go/+/498255
Reviewed-by: Austin Clements <austin@google.com>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>

12 months agoerrors: add godoc links
Olivier Mengué [Tue, 23 May 2023 14:51:04 +0000 (16:51 +0200)]
errors: add godoc links

Change-Id: I766e656e6b967290d692313ea1391878fc21c92d
Reviewed-on: https://go-review.googlesource.com/c/go/+/497375
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
12 months agoruntime: add heapObjectsCanMove
Russ Cox [Thu, 25 May 2023 04:21:13 +0000 (00:21 -0400)]
runtime: add heapObjectsCanMove

heapObjectsCanMove is always false in the current garbage collector.
It exists for go4.org/unsafe/assume-no-moving-gc, which is an
unfortunate idea that had an even more unfortunate implementation.
Every time a new Go release happened, the package stopped building,
and the authors had to add a new file with a new //go:build line, and
then the entire ecosystem of packages with that as a dependency had to
explicitly update to the new version. Many packages depend on
assume-no-moving-gc transitively, through paths like
inet.af/netaddr -> go4.org/intern -> assume-no-moving-gc.
This was causing a significant amount of friction around each new
release, so we added this bool for the package to //go:linkname
instead. The bool is still unfortunate, but it's not as bad as
breaking the ecosystem on every new release.

If the Go garbage collector ever does move heap objects, we can set
this to true to break all the programs using assume-no-moving-gc.

Change-Id: I06c32bf6ccc4601c8eef741d7382b678aada3508
Reviewed-on: https://go-review.googlesource.com/c/go/+/498121
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
12 months agocrypto/internal/bigmod: don't panic on NewModulusFromBig(0)
Roland Shoemaker [Wed, 24 May 2023 17:53:47 +0000 (10:53 -0700)]
crypto/internal/bigmod: don't panic on NewModulusFromBig(0)

Return an error instead. Makes usages of NewModulusFromBig a bit more
verbose, but better than returning nil or something and just moving the
panic down the road.

Fixes #60411

Change-Id: I10732c6ce56ccd9e4769281cea049dd4beb60a6e
Reviewed-on: https://go-review.googlesource.com/c/go/+/498035
Auto-Submit: Roland Shoemaker <roland@golang.org>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Roland Shoemaker <roland@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
12 months agocrypto/tls: advertise correct ciphers in TLS 1.3 only mode
Monis Khan [Fri, 13 Jan 2023 00:37:56 +0000 (00:37 +0000)]
crypto/tls: advertise correct ciphers in TLS 1.3 only mode

This change updates the makeClientHello logic to only advertise TLS
1.3 ciphers when tls.Config.MinVersion is set to tls.VersionTLS13
(i.e the client only supports TLS 1.3).  Previously, TLS 1.2 ciphers
would be included in the client hello message.

Fixes #57771

Change-Id: Ife4123037b0a4609578ffffb1cdf1e1d4e0a8df6
GitHub-Last-Rev: 45f4275aa9b9550e519e1be5c337b53ab8882007
GitHub-Pull-Request: golang/go#49293
Reviewed-on: https://go-review.googlesource.com/c/go/+/360794
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Run-TryBot: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Marten Seemann <martenseemann@gmail.com>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>

12 months agocmd/go: clear HGRCPATH in script test
Russ Cox [Wed, 24 May 2023 13:19:15 +0000 (09:19 -0400)]
cmd/go: clear HGRCPATH in script test

Invoking 'hg' in a nonexistant HOME can break extensions the user
may have installed; clear HGRCPATH in the script test to keep tests
working in that environment.

Change-Id: I4d21d024c6229ead38e5f24186883863511fd483
Reviewed-on: https://go-review.googlesource.com/c/go/+/497878
Reviewed-by: Bryan Mills <bcmills@google.com>
Auto-Submit: Russ Cox <rsc@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>

12 months agocmd/go: abstract build cache, support implementations via child process
Brad Fitzpatrick [Mon, 6 Feb 2023 03:52:06 +0000 (19:52 -0800)]
cmd/go: abstract build cache, support implementations via child process

Via setting GOCACHEPROG to a binary which speaks JSON over
stdin/stdout.

For now, it requires GOEXPERIMENT=cacheprog.

Fixes golang/go#59719

Change-Id: I824ff04d5ebdf0ba4d1b5bc2e9fbaee26d34c80f
Reviewed-on: https://go-review.googlesource.com/c/go/+/486715
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
12 months agocrypto/tls: don't reverify but check certificate expiration on resumption
Filippo Valsorda [Wed, 24 May 2023 13:49:56 +0000 (15:49 +0200)]
crypto/tls: don't reverify but check certificate expiration on resumption

We used to inconsistently run certificate verification on the server on
resumption, but not on the client. This made TLS 1.3 resumption pretty
much useless, as it didn't save bytes, CPU, or round-trips.

This requires serializing the verified chains into the session ticket,
so it's a tradeoff making the ticket bigger to save computation (and for
consistency).

The previous behavior also had a "stickyness" issue: if a ticket
contained invalid certificates, they would be used even if the client
had in the meantime configured valid certificates for a full handshake.

We also didn't check expiration on the client side on resumption if
InsecureSkipVerify was set. Again for consistency, we do that now.

Also, we used to run VerifyPeerCertificates on resumption even if
NoClientCerts was set.

Fixes #31641

Change-Id: Icc88269ea4adb544fa81158114aae76f3c91a15f
Reviewed-on: https://go-review.googlesource.com/c/go/+/497895
Reviewed-by: Damien Neil <dneil@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Auto-Submit: Filippo Valsorda <filippo@golang.org>

12 months agocrypto/tls: add VersionName
Filippo Valsorda [Wed, 24 May 2023 00:29:15 +0000 (02:29 +0200)]
crypto/tls: add VersionName

Fixes #46308

Change-Id: I5162b26cbce61ae5df5d2e093cf8a28406d15863
Reviewed-on: https://go-review.googlesource.com/c/go/+/497377
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Marten Seemann <martenseemann@gmail.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Samuli Silvius <samuli.silvius@gmail.com>
Reviewed-by: Damien Neil <dneil@google.com>
Run-TryBot: Filippo Valsorda <filippo@golang.org>

12 months agocrypto/tls: implement Extended Master Secret
Filippo Valsorda [Tue, 23 May 2023 23:55:45 +0000 (01:55 +0200)]
crypto/tls: implement Extended Master Secret

All OpenSSL tests now test operation with EMS. To test a handshake
*without* EMS we need to pass -Options=-ExtendedMasterSecret which is
only available in OpenSSL 3.1, which breaks a number of other tests.

Updates #43922

Change-Id: Ib9ac79a1d03fab6bfba5fe9cd66689cff661cda7
Reviewed-on: https://go-review.googlesource.com/c/go/+/497376
Run-TryBot: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
12 months agocrypto/tls: add QUIC 0-RTT APIs
Filippo Valsorda [Mon, 22 May 2023 17:23:04 +0000 (19:23 +0200)]
crypto/tls: add QUIC 0-RTT APIs

Fixes #60107

Change-Id: I158b1c2d80d8ebb5ed7a8e6f313f69060754e220
Reviewed-on: https://go-review.googlesource.com/c/go/+/496995
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Run-TryBot: Filippo Valsorda <filippo@golang.org>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>

12 months agonet: implement wasip1 FileListener and FileConn
Chris O'Hara [Mon, 8 May 2023 07:08:20 +0000 (17:08 +1000)]
net: implement wasip1 FileListener and FileConn

Implements net.FileListener and net.FileConn for wasip1.

net.FileListener can be used with a pre-opened socket. If the WASM
module knows the file descriptor, a listener can be constructed with:

    l, err := net.FileListener(os.NewFile(fd, ""))

If the WASM module does not know the file descriptor, but knows that at
least one of the preopens is a socket, it can find the file descriptor
and construct a listener like so:

    func findListener() (net.Listener, error) {
        // We start looking for pre-opened sockets at fd=3 because 0, 1,
        // and 2 are reserved for stdio. Pre-opened directories also
        // start at fd=3, so we skip fds that aren't sockets. Once we
        // reach EBADF we know there are no more pre-opens.
        for preopenFd := uintptr(3); ; preopenFd++ {
            l, err := net.FileListener(os.NewFile(preopenFd, ""))

            var se syscall.Errno
            switch errors.As(err, &se); se {
            case syscall.ENOTSOCK:
                continue
            case syscall.EBADF:
                err = nil
            }
            return l, err
        }
    }

A similar strategy can be used with net.FileConn and pre-opened
connection sockets.

The wasmtime runtime supports pre-opening listener sockets:

    $ wasmtime --tcplisten 127.0.0.1:8080 module.wasm

Change-Id: Iec6ae4ffa84b3753cce4f56a2817e150445db643
Reviewed-on: https://go-review.googlesource.com/c/go/+/493358
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Bypass: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>
Auto-Submit: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
12 months agoruntime: implement wasip1 netpoll
Chris O'Hara [Mon, 8 May 2023 07:07:18 +0000 (17:07 +1000)]
runtime: implement wasip1 netpoll

Implements netpoll using WASI's poll_oneoff system call.

This enables non-blocking I/O support for wasip1.

Change-Id: Ie395fa49d651c8b8262d485e2847dd65b0a10bc6
Reviewed-on: https://go-review.googlesource.com/c/go/+/493357
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>
Reviewed-by: Julien Fabre <ju.pryz@gmail.com>
Auto-Submit: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>

12 months agoencoding/json: document unsupported float values
Sean Liao [Fri, 19 May 2023 18:04:07 +0000 (19:04 +0100)]
encoding/json: document unsupported float values

Fixes #59627

Change-Id: Icd6a9803e213596de6136ec980b0a352c450e6f7
Reviewed-on: https://go-review.googlesource.com/c/go/+/496142
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
12 months agocrypto/tls: add SessionState.Extra
Filippo Valsorda [Mon, 22 May 2023 09:06:58 +0000 (11:06 +0200)]
crypto/tls: add SessionState.Extra

This can be used by applications to store additional data in a session.

Fixes #57753
For #60105

Change-Id: Ib42387ad64750fa8dbbdf51de5e9c86378bef0ee
Reviewed-on: https://go-review.googlesource.com/c/go/+/496822
Run-TryBot: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Marten Seemann <martenseemann@gmail.com>
Reviewed-by: Damien Neil <dneil@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
12 months agocrypto/tls: add WrapSession and UnwrapSession
Filippo Valsorda [Mon, 22 May 2023 08:49:07 +0000 (10:49 +0200)]
crypto/tls: add WrapSession and UnwrapSession

There was a bug in TestResumption: the first ExpiredSessionTicket was
inserting a ticket far in the future, so the second ExpiredSessionTicket
wasn't actually supposed to fail. However, there was a bug in
checkForResumption->sendSessionTicket, too: if a session was not resumed
because it was too old, its createdAt was still persisted in the next
ticket. The two bugs used to cancel each other out.

For #60105
Fixes #19199

Change-Id: Ic9b2aab943dcbf0de62b8758a6195319dc286e2f
Reviewed-on: https://go-review.googlesource.com/c/go/+/496821
Run-TryBot: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
12 months agocrypto/tls: add ClientSessionState.ResumptionState and NewResumptionState
Filippo Valsorda [Sun, 21 May 2023 19:27:48 +0000 (21:27 +0200)]
crypto/tls: add ClientSessionState.ResumptionState and NewResumptionState

For #60105
Fixes #25351

Change-Id: Iffd658f2663cfc47b48157824226ed6c0260a59e
Reviewed-on: https://go-review.googlesource.com/c/go/+/496820
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Marten Seemann <martenseemann@gmail.com>
12 months agocrypto/tls: use SessionState on the client side
Filippo Valsorda [Sun, 21 May 2023 19:17:56 +0000 (21:17 +0200)]
crypto/tls: use SessionState on the client side

Another internal change, that allows exposing the new APIs easily in
following CLs.

For #60105

Change-Id: I9c61b9f6e9d29af633f952444f514bcbbe82fe4e
Reviewed-on: https://go-review.googlesource.com/c/go/+/496819
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
Run-TryBot: Filippo Valsorda <filippo@golang.org>

12 months agocrypto/tls: add SessionState and use it on the server side
Filippo Valsorda [Sat, 20 May 2023 15:49:21 +0000 (17:49 +0200)]
crypto/tls: add SessionState and use it on the server side

This change by itself is useless, because the application has no way to
access or provide SessionStates to crypto/tls, but they will be provided
in following CLs.

For #60105

Change-Id: I8d5de79b1eda0a778420134cf6f346246a1bb296
Reviewed-on: https://go-review.googlesource.com/c/go/+/496818
Reviewed-by: Marten Seemann <martenseemann@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Filippo Valsorda <filippo@golang.org>

12 months agocrypto/tls: reduce session ticket linkability
Filippo Valsorda [Fri, 19 May 2023 21:28:43 +0000 (23:28 +0200)]
crypto/tls: reduce session ticket linkability

Ever since session ticket key rotation was introduced in CL 9072, we've
been including a prefix in every ticket to identify what key it's
encrypted with. It's a small privacy gain, but the cost of trial
decryptions is also small, especially since the first key is probably
the most frequently used.

Also reissue tickets on every resumption so that the next connection
can't be linked to all the previous ones. Again the privacy gain is
small but the performance cost is small and it comes with a reduction in
complexity.

For #60105

Change-Id: I852f297162d2b79a3d9bf61f6171e8ce94b2537a
Reviewed-on: https://go-review.googlesource.com/c/go/+/496817
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Damien Neil <dneil@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

12 months agocompress/flate, archive/zip: reduce memory allocations
Maksim Meshkov [Wed, 24 May 2023 21:18:15 +0000 (21:18 +0000)]
compress/flate, archive/zip: reduce memory allocations

The existing implementation allocates a new 4KB buffer each time it opens flate-encoded file in a zip archive. This commit allows the flate reader to reuse the buffer on call Reset instead of allocating a new one.

It is noticeable when a zip archive contains a huge amount of files, e.g. zip archive has 50_000 files, for each file 4KB buffer is allocated, so it is 200MB memory allocations. If files are read sequentially only one buffer is needed.

Fixes #59774

Change-Id: Ib16336b101ba58e8f0f30a45dc5fd4eeebc801a1
GitHub-Last-Rev: f3f395b2ad95b7ad7ce9df6f5e49c7b6a0627627
GitHub-Pull-Request: golang/go#59775
Reviewed-on: https://go-review.googlesource.com/c/go/+/487675
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
12 months agogo/types: set correct Pos for T in struct{p.T}
Alan Donovan [Wed, 24 May 2023 18:16:38 +0000 (14:16 -0400)]
go/types: set correct Pos for T in struct{p.T}

Previously, the field Var for T created for struct{p.T}
would use the Pos of the ast.Field, which coincides with p.
This change makes it use the Pos of T.

Errors about the field type are still reported at the
position of the ast.Field (e.g. *p.T) not the field T.

Fixes #60372

Change-Id: I06000874f2018d47159493626da3d16e6716f4c8
Reviewed-on: https://go-review.googlesource.com/c/go/+/497882
Reviewed-by: Robert Findley <rfindley@google.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@google.com>
Run-TryBot: Alan Donovan <adonovan@google.com>

12 months agocmd/compile: Use XORL and X15 for zeroing in ggen's zerorange on AMD64
Jakub Ciolek [Sun, 27 Nov 2022 15:36:35 +0000 (16:36 +0100)]
cmd/compile: Use XORL and X15 for zeroing in ggen's zerorange on AMD64

Prefer a SSE store from X15 over XORL REG REG -> MOVQ.

Use XORL REG, REG to setup 0 for REP STOS.

Remove the nacl related block.

Intel Alder Lake 12600k (Linux):

name                      old time/op    new time/op    delta
BinaryTree17-16              1.52s ± 1%     1.52s ± 1%    ~
(p=0.932 n=12+12)
Fannkuch11-16                1.40s ± 0%     1.46s ± 0%  +4.12%
(p=0.000 n=12+11)
FmtFprintfEmpty-16          13.0ns ± 1%    13.2ns ± 1%  +1.37%
(p=0.000 n=11+12)
FmtFprintfString-16         24.0ns ± 1%    23.2ns ± 1%  -3.53%
(p=0.000 n=12+11)
FmtFprintfInt-16            27.6ns ± 1%    25.5ns ± 1%  -7.53%
(p=0.000 n=12+12)
FmtFprintfIntInt-16         43.1ns ± 1%    41.4ns ± 1%  -4.00%
(p=0.000 n=12+12)
FmtFprintfPrefixedInt-16    56.8ns ± 0%    54.8ns ± 1%  -3.49%
(p=0.000 n=11+12)
FmtFprintfFloat-16          59.0ns ± 0%    59.7ns ± 1%  +1.11%
(p=0.000 n=12+12)
FmtManyArgs-16               159ns ± 1%     160ns ± 1%    ~
(p=0.070 n=12+12)
GobDecode-16                2.37ms ± 2%    2.39ms ± 1%    ~
(p=0.059 n=12+11)
GobEncode-16                1.99ms ± 2%    2.00ms ± 2%    ~
(p=0.291 n=12+12)
Gzip-16                     98.7ms ± 1%    99.2ms ± 0%  +0.51%
(p=0.024 n=12+12)
Gunzip-16                   13.4ms ± 0%    13.5ms ± 0%  +0.20%
(p=0.001 n=11+12)
HTTPClientServer-16         27.0µs ± 6%    26.5µs ± 4%    ~
(p=0.266 n=12+12)
JSONEncode-16               3.41ms ± 5%    3.44ms ± 2%    ~
(p=0.291 n=12+12)
JSONDecode-16               16.6ms ± 1%    16.6ms ± 2%    ~
(p=0.872 n=10+12)
Mandelbrot200-16            1.78ms ± 0%    1.78ms ± 0%    ~
(p=0.514 n=12+12)
GoParse-16                  1.59ms ± 2%    1.57ms ± 2%  -0.82%
(p=0.016 n=12+11)
RegexpMatchEasy0_32-16      21.5ns ± 1%    21.3ns ± 0%  -1.10%
(p=0.000 n=12+12)
RegexpMatchEasy0_1K-16      71.0ns ± 0%    69.9ns ± 0%  -1.58%
(p=0.000 n=11+11)
RegexpMatchEasy1_32-16      18.0ns ± 1%    17.3ns ± 0%  -3.38%
(p=0.000 n=12+12)
RegexpMatchEasy1_1K-16      97.8ns ± 0%    97.2ns ± 1%  -0.56%
(p=0.001 n=10+10)
RegexpMatchMedium_32-16      269ns ± 0%     270ns ± 2%    ~
(p=0.241 n=11+12)
RegexpMatchMedium_1K-16     11.4µs ± 0%    11.3µs ± 1%  -0.69%
(p=0.000 n=11+12)
RegexpMatchHard_32-16        522ns ± 0%     522ns ± 1%    ~
(p=0.811 n=12+12)
RegexpMatchHard_1K-16       15.1µs ± 2%    14.8µs ± 0%  -2.17%
(p=0.000 n=12+12)
Revcomp-16                   194ms ± 1%     195ms ± 2%    ~
(p=0.059 n=11+12)
Template-16                 22.0ms ± 2%    21.5ms ± 2%  -2.11%
(p=0.001 n=12+12)
TimeParse-16                97.3ns ± 1%    97.2ns ± 0%    ~
(p=0.217 n=11+12)
TimeFormat-16               98.2ns ± 2%    97.1ns ± 2%    ~
(p=0.101 n=12+12)
[Geo mean]                  17.7µs         17.6µs       -0.77%

name                      old speed      new speed      delta
GobDecode-16               324MB/s ± 2%   322MB/s ± 1%    ~
(p=0.058 n=12+11)
GobEncode-16               385MB/s ± 2%   383MB/s ± 2%    ~
(p=0.291 n=12+12)
Gzip-16                    197MB/s ± 1%   196MB/s ± 0%  -0.51%
(p=0.023 n=12+12)
Gunzip-16                 1.44GB/s ± 0%  1.44GB/s ± 0%  -0.20%
(p=0.001 n=11+12)
JSONEncode-16              570MB/s ± 5%   565MB/s ± 2%    ~
(p=0.291 n=12+12)
JSONDecode-16              117MB/s ± 1%   117MB/s ± 2%    ~
(p=0.885 n=10+12)
GoParse-16                36.5MB/s ± 2%  36.8MB/s ± 2%  +0.83%
(p=0.018 n=12+11)
RegexpMatchEasy0_32-16    1.49GB/s ± 1%  1.50GB/s ± 0%  +1.12%
(p=0.000 n=12+12)
RegexpMatchEasy0_1K-16    14.4GB/s ± 0%  14.6GB/s ± 0%  +1.61%
(p=0.000 n=11+11)
RegexpMatchEasy1_32-16    1.78GB/s ± 1%  1.84GB/s ± 0%  +3.50%
(p=0.000 n=12+12)
RegexpMatchEasy1_1K-16    10.5GB/s ± 0%  10.5GB/s ± 1%  +0.57%
(p=0.001 n=10+10)
RegexpMatchMedium_32-16    119MB/s ± 0%   119MB/s ± 2%    ~
(p=0.235 n=11+12)
RegexpMatchMedium_1K-16   90.1MB/s ± 0%  90.8MB/s ± 1%  +0.69%
(p=0.000 n=11+12)
RegexpMatchHard_32-16     61.3MB/s ± 0%  61.3MB/s ± 1%    ~
(p=0.765 n=12+12)
RegexpMatchHard_1K-16     67.6MB/s ± 2%  69.1MB/s ± 0%  +2.20%
(p=0.000 n=12+12)
Revcomp-16                1.31GB/s ± 1%  1.30GB/s ± 2%    ~
(p=0.059 n=11+12)
Template-16               88.3MB/s ± 2%  90.2MB/s ± 2%  +2.16%
(p=0.001 n=12+12)
[Geo mean]                 401MB/s        403MB/s       +0.49%

file                                                        before   after    Δ       %
runtime.s                                                   512467   512447   -20     -0.004%
sync.s                                                      16219    16197    -22     -0.136%
internal/singleflight.s                                     2617     2616     -1      -0.038%
internal/testlog.s                                          2157     2152     -5      -0.232%
io.s                                                        18992    18980    -12     -0.063%
text/tabwriter.s                                            8952     8913     -39     -0.436%
syscall.s                                                   85241    85220    -21     -0.025%
go/build/constraint.s                                       12763    12741    -22     -0.172%
time.s                                                      100682   100672   -10     -0.010%
context.s                                                   12316    12305    -11     -0.089%
internal/poll.s                                             45297    45114    -183    -0.404%
io/fs.s                                                     16767    16763    -4      -0.024%
crypto/hmac.s                                               2546     2537     -9      -0.353%
os.s                                                        53983    53964    -19     -0.035%
os/exec.s                                                   25723    25710    -13     -0.051%
os/user.s                                                   12166    12133    -33     -0.271%
debug/gosym.s                                               36980    36948    -32     -0.087%
database/sql.s                                              90990    90863    -127    -0.140%
archive/zip.s                                               52485    52481    -4      -0.008%
debug/dwarf.s                                               117251   117219   -32     -0.027%
encoding/json.s                                             95637    95579    -58     -0.061%
net.s                                                       278084   278056   -28     -0.010%
log.s                                                       12153    12121    -32     -0.263%
vendor/golang.org/x/net/http2/hpack.s                       22562    22552    -10     -0.044%
mime.s                                                      32872    32851    -21     -0.064%
vendor/golang.org/x/crypto/cryptobyte.s                     32035    32024    -11     -0.034%
go/token.s                                                  13689    13645    -44     -0.321%
image/gif.s                                                 22700    22668    -32     -0.141%
text/template/parse.s                                       81696    81683    -13     -0.016%
image/png.s                                                 37704    37692    -12     -0.032%
go/ast.s                                                    63753    63751    -2      -0.003%
internal/dag.s                                              13123    13122    -1      -0.008%
crypto/x509.s                                               137641   137635   -6      -0.004%
text/template.s                                             106615   106592   -23     -0.022%
os/signal.s                                                 7658     7651     -7      -0.091%
go/printer.s                                                90393    90384    -9      -0.010%
runtime/trace.s                                             2844     2819     -25     -0.879%
go/parser.s                                                 111432   111144   -288    -0.258%
html/template.s                                             91633    91619    -14     -0.015%
log/syslog.s                                                6612     6593     -19     -0.287%
net/internal/socktest.s                                     15715    15684    -31     -0.197%
runtime/pprof.s                                             70273    70177    -96     -0.137%
crypto/tls.s                                                288762   288684   -78     -0.027%
testing.s                                                   112376   112300   -76     -0.068%
internal/fuzz.s                                             89544    89535    -9      -0.010%
net/smtp.s                                                  11357    11325    -32     -0.282%
vendor/golang.org/x/net/nettest.s                           27449    27361    -88     -0.321%
testing/internal/testdeps.s                                 6384     6369     -15     -0.235%
go/types.s                                                  484464   484324   -140    -0.029%
cmd/internal/buildid.s                                      17646    17625    -21     -0.119%
go/internal/gccgoimporter.s                                 44931    44920    -11     -0.024%
go/internal/srcimporter.s                                   9989     9983     -6      -0.060%
cmd/api.s                                                   35098    35075    -23     -0.066%
net/http.s                                                  551134   550680   -454    -0.082%
cmd/internal/obj.s                                          121795   121750   -45     -0.037%
cmd/compile/internal/syntax.s                               170092   170075   -17     -0.010%
expvar.s                                                    8959     8945     -14     -0.156%
net/http/httptest.s                                         16201    16198    -3      -0.019%
net/http/httputil.s                                         44379    44339    -40     -0.090%
net/http/fcgi.s                                             18105    18099    -6      -0.033%
cmd/compile/internal/logopt.s                               9916     9905     -11     -0.111%
cmd/vendor/golang.org/x/tools/cover.s                       9722     9720     -2      -0.021%
cmd/compile/internal/base.s                                 38986    38982    -4      -0.010%
cmd/covdata.s                                               39190    39182    -8      -0.020%
cmd/go/internal/fsys.s                                      17948    17938    -10     -0.056%
cmd/dist.s                                                  169725   169616   -109    -0.064%
cmd/compile/internal/types.s                                74666    74639    -27     -0.036%
cmd/go/internal/par.s                                       4517     4516     -1      -0.022%
cmd/go/internal/lockedfile.s                                22412    22410    -2      -0.009%
cmd/compile/internal/types2.s                               476715   476596   -119    -0.025%
cmd/go/internal/trace.s                                     4888     4877     -11     -0.225%
cmd/vendor/golang.org/x/mod/module.s                        20445    20415    -30     -0.147%
cmd/vendor/golang.org/x/mod/sumdb/dirhash.s                 3596     3587     -9      -0.250%
cmd/go/internal/cache.s                                     23871    23839    -32     -0.134%
cmd/vendor/golang.org/x/mod/zip.s                           36602    36567    -35     -0.096%
cmd/vendor/golang.org/x/mod/sumdb.s                         27669    27552    -117    -0.423%
cmd/compile/internal/ir.s                                   253597   253590   -7      -0.003%
cmd/go/internal/vcs.s                                       45027    45025    -2      -0.004%
cmd/go/internal/modfetch/codehost.s                         80672    80583    -89     -0.110%
cmd/go/internal/modindex.s                                  79273    79271    -2      -0.003%
cmd/go/internal/modconv.s                                   14793    14792    -1      -0.007%
cmd/gofmt.s                                                 29600    29587    -13     -0.044%
cmd/go/internal/modfetch.s                                  111067   111017   -50     -0.045%
cmd/go/internal/vcweb.s                                     37882    37872    -10     -0.026%
cmd/compile/internal/typecheck.s                            319852   319834   -18     -0.006%
cmd/vendor/golang.org/x/term.s                              24398    24338    -60     -0.246%
cmd/vendor/github.com/google/pprof/profile.s                149107   149103   -4      -0.003%
cmd/go/internal/modload.s                                   275078   275020   -58     -0.021%
cmd/vendor/github.com/ianlancetaylor/demangle.s             264051   264013   -38     -0.014%
cmd/compile/internal/staticdata.s                           14019    14011    -8      -0.057%
cmd/go/internal/modcmd.s                                    47591    47582    -9      -0.019%
cmd/vendor/github.com/google/pprof/internal/binutils.s      37978    37926    -52     -0.137%
cmd/vendor/golang.org/x/tools/go/analysis/passes/buildtag.s 6880     6864     -16     -0.233%
cmd/go/internal/work.s                                      287700   287637   -63     -0.022%
cmd/vendor/github.com/google/pprof/internal/symbolizer.s    10171    10138    -33     -0.324%
cmd/go/internal/modget.s                                    58314    58250    -64     -0.110%
cmd/go/internal/test.s                                      52538    52534    -4      -0.008%
cmd/trace.s                                                 100245   100242   -3      -0.003%
cmd/vendor/golang.org/x/tools/go/ast/astutil.s              50731    50724    -7      -0.014%
cmd/vendor/golang.org/x/tools/internal/facts.s              13018    13011    -7      -0.054%
cmd/link/internal/ld.s                                      562438   562377   -61     -0.011%
cmd/vendor/github.com/google/pprof/internal/driver.s        148389   148338   -51     -0.034%
cmd/compile/internal/ssa.s                                  3639799  3639727  -72     -0.002%
cmd/compile/internal/ssagen.s                               359076   359028   -48     -0.013%
cmd/compile/internal/amd64.s                                31084    30582    -502    -1.615%
cmd/compile/internal/noder.s                                407972   407949   -23     -0.006%
cmd/compile/internal/gc.s                                   20101    20069    -32     -0.159%
total                                                       20771294 20766881 -4413   -0.021%

Change-Id: I2a4b01449e94906fa1ed3fb96a790977466368d9
Reviewed-on: https://go-review.googlesource.com/c/go/+/453536
Reviewed-by: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
12 months agocrypto/tls: support QUIC as a transport
Damien Neil [Fri, 14 Oct 2022 17:48:42 +0000 (10:48 -0700)]
crypto/tls: support QUIC as a transport

Add a QUICConn type for use by QUIC implementations.

A QUICConn provides unencrypted handshake bytes and connection
secrets to the QUIC layer, and receives handshake bytes.

For #44886

Change-Id: I859dda4cc6d466a1df2fb863a69d3a2a069110d5
Reviewed-on: https://go-review.googlesource.com/c/go/+/493655
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Run-TryBot: Damien Neil <dneil@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Marten Seemann <martenseemann@gmail.com>
12 months agonet/http: second do not force the Content-Length header if nilled
Jorropo [Tue, 16 May 2023 07:19:58 +0000 (09:19 +0200)]
net/http: second do not force the Content-Length header if nilled

This is a second round of CL 469095 which has been fixed after
the issue discovered in the revert CL 495017.

The issue was a missing res.Body.Close() in the newly added test.

Change-Id: Ifd9d8458022e59f4486397443a2862d06383e990
Reviewed-on: https://go-review.googlesource.com/c/go/+/495115
Reviewed-by: Damien Neil <dneil@google.com>
Run-TryBot: Jorropo <jorropo.pgm@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>

12 months agoos: add dirFs.ReadDir to implement fs.ReadDirFS for DirFS
Tobias Klauser [Wed, 24 May 2023 17:49:24 +0000 (19:49 +0200)]
os: add dirFs.ReadDir to implement fs.ReadDirFS for DirFS

Follow CL 416775 which added dirFs.ReadFile.

Fixes #53761

Change-Id: Iec19a815ab7c37a3206be141518cc587a588de20
Reviewed-on: https://go-review.googlesource.com/c/go/+/498015
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>

12 months agonet: root the nodata test domain to avoid search domains
Mateusz Poliwczak [Mon, 15 May 2023 09:33:40 +0000 (09:33 +0000)]
net: root the nodata test domain to avoid search domains

I came across similar issue in CL 455275.
Without rooting this, the search domains might affect
the query, so the test might not prove the right thing.
The search domain will cause a change from no data
to NXDOMAIN error.

Change-Id: I59f4de2635f03c69adf29b74e25e4ebd71e7413b
GitHub-Last-Rev: 3a086c74f1453e4d1f2e88631ac835389984da17
GitHub-Pull-Request: golang/go#60197
Reviewed-on: https://go-review.googlesource.com/c/go/+/494896
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>

12 months agocrypto/rsa,crypto/internal/bigmod: optimized short exponentiations
Filippo Valsorda [Fri, 5 May 2023 09:29:39 +0000 (11:29 +0200)]
crypto/rsa,crypto/internal/bigmod: optimized short exponentiations

RSA encryption and verification performs an exponentiation by a value
usually just a few bits long. The current strategy with table
precomputation is not efficient.

Add an ExpShort bigmod method, and use it in RSA public key operations.

After this, almost all CPU time in encryption/verification is spent
preparing the constants for the modulus, because PublicKey doesn't have
a Precompute function.

This speeds up signing a bit too, because it performs a verification to
protect against faults.

name                    old time/op  new time/op  delta
DecryptPKCS1v15/2048-4  1.13ms ± 0%  1.13ms ± 0%   -0.43%  (p=0.000 n=8+9)
DecryptPKCS1v15/3072-4  3.20ms ± 0%  3.15ms ± 0%   -1.59%  (p=0.000 n=10+8)
DecryptPKCS1v15/4096-4  6.45ms ± 0%  6.42ms ± 0%   -0.49%  (p=0.000 n=10+10)
EncryptPKCS1v15/2048-4   132µs ± 0%   108µs ± 0%  -17.99%  (p=0.000 n=10+10)
DecryptOAEP/2048-4      1.13ms ± 0%  1.14ms ± 0%   +0.91%  (p=0.000 n=10+10)
EncryptOAEP/2048-4       132µs ± 0%   108µs ± 0%  -18.09%  (p=0.000 n=10+10)
SignPKCS1v15/2048-4     1.18ms ± 0%  1.14ms ± 1%   -3.30%  (p=0.000 n=10+10)
VerifyPKCS1v15/2048-4    131µs ± 0%   107µs ± 0%  -18.30%  (p=0.000 n=9+10)
SignPSS/2048-4          1.18ms ± 0%  1.15ms ± 1%   -1.87%  (p=0.000 n=10+10)
VerifyPSS/2048-4         132µs ± 0%   108µs ± 0%  -18.30%  (p=0.000 n=10+9)

Updates #57752

Change-Id: Ic89273a58002b32b1c5c3185a35262694ceef409
Reviewed-on: https://go-review.googlesource.com/c/go/+/492935
Run-TryBot: Filippo Valsorda <filippo@golang.org>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Roland Shoemaker <roland@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
12 months agocrypto/internal/bigmod: switch to saturated limbs
Filippo Valsorda [Sat, 25 Feb 2023 18:09:11 +0000 (19:09 +0100)]
crypto/internal/bigmod: switch to saturated limbs

Turns out that unsaturated limbs being more performant for Montgomery
multiplication was true in portable C89, but is now a misconception.
With add-with-carry instructions, it's possible to run the carry chain
across the limbs, instead of needing the limb-by-limb product to fit in
two words.

Switch to saturated limbs, and import the same Montgomery loop as
math/big, along with its assembly for some architectures. Since here we
know the sizes we care about, we can drop most of the assembly
scaffolding. For amd64, ported to avo, too.

We recover all the Go 1.20 performance loss on private key operations on
both Intel Xeon and AMD EPYC, with even a 10% improvement over Go 1.19
(which used variable-time math/big) for some operations.

goos: linux
goarch: amd64
pkg: crypto/rsa
cpu: Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz
                       │ go1.19.txt  │       go1.20.txt         │         new.txt          │
                       │   sec/op    │    sec/op      vs base   │    sec/op      vs base   │
DecryptPKCS1v15/2048-4   1.175m ± 0%     1.515m ± 0%    +28.95%     1.132m ± 0%     -3.59%
DecryptPKCS1v15/3072-4   3.428m ± 1%     4.516m ± 0%    +31.75%     3.198m ± 0%     -6.69%
DecryptPKCS1v15/4096-4   7.405m ± 0%    10.092m ± 0%    +36.29%     6.446m ± 0%    -12.95%
EncryptPKCS1v15/2048-4   7.426µ ± 0%   170.829µ ± 0%  +2200.57%   131.874µ ± 0%  +1675.97%
DecryptOAEP/2048-4       1.175m ± 0%     1.524m ± 0%    +29.68%     1.137m ± 0%     -3.26%
EncryptOAEP/2048-4       9.609µ ± 0%   173.008µ ± 0%  +1700.48%   132.344µ ± 0%  +1277.29%
SignPKCS1v15/2048-4      1.181m ± 0%     1.563m ± 0%    +32.34%     1.177m ± 0%     -0.37%
VerifyPKCS1v15/2048-4    6.452µ ± 0%   170.092µ ± 0%  +2536.06%   131.225µ ± 0%  +1933.70%
SignPSS/2048-4           1.184m ± 0%     1.574m ± 0%    +32.88%     1.175m ± 0%     -0.84%
VerifyPSS/2048-4         9.151µ ± 1%   172.909µ ± 0%  +1789.50%   132.391µ ± 0%  +1346.74%

                       │  go1.19.txt   │      go1.20.txt       │       new.txt         │
                       │     B/op      │     B/op      vs base │     B/op      vs base │
DecryptPKCS1v15/2048-4    24266.5 ± 0%     640.0 ± 0%  -97.36%     640.0 ± 0%  -97.36%
DecryptPKCS1v15/3072-4   45.465Ki ± 0%   3.375Ki ± 0%  -92.58%   4.688Ki ± 0%  -89.69%
DecryptPKCS1v15/4096-4   61.080Ki ± 0%   4.625Ki ± 0%  -92.43%   6.250Ki ± 0%  -89.77%
EncryptPKCS1v15/2048-4    3.138Ki ± 0%   1.146Ki ± 0%  -63.49%   1.082Ki ± 0%  -65.52%
DecryptOAEP/2048-4        24500.0 ± 0%     872.0 ± 0%  -96.44%     872.0 ± 0%  -96.44%
EncryptOAEP/2048-4        3.610Ki ± 0%   1.371Ki ± 0%  -62.02%   1.308Ki ± 0%  -63.78%
SignPKCS1v15/2048-4       26933.0 ± 0%     896.0 ± 0%  -96.67%     896.0 ± 0%  -96.67%
VerifyPKCS1v15/2048-4      3209.0 ± 0%     912.0 ± 0%  -71.58%     848.0 ± 0%  -73.57%
SignPSS/2048-4           26.940Ki ± 0%   1.266Ki ± 0%  -95.30%   1.266Ki ± 0%  -95.30%
VerifyPSS/2048-4          3.337Ki ± 0%   1.094Ki ± 0%  -67.22%   1.031Ki ± 0%  -69.10%

                       │  go1.19.txt  │     go1.20.txt      │      new.txt          │
                       │  allocs/op   │ allocs/op   vs base │ allocs/op   vs base   │
DecryptPKCS1v15/2048-4    97.000 ± 0%   4.000 ± 0%  -95.88%     4.000 ± 0%  -95.88%
DecryptPKCS1v15/3072-4    107.00 ± 0%   10.00 ± 0%  -90.65%     12.00 ± 0%  -88.79%
DecryptPKCS1v15/4096-4    113.00 ± 0%   10.00 ± 0%  -91.15%     12.00 ± 0%  -89.38%
EncryptPKCS1v15/2048-4     7.000 ± 0%   7.000 ± 0%        ~     7.000 ± 0%        ~
DecryptOAEP/2048-4        103.00 ± 0%   10.00 ± 0%  -90.29%     10.00 ± 0%  -90.29%
EncryptOAEP/2048-4         14.00 ± 0%   13.00 ± 0%   -7.14%     13.00 ± 0%   -7.14%
SignPKCS1v15/2048-4      102.000 ± 0%   5.000 ± 0%  -95.10%     5.000 ± 0%  -95.10%
VerifyPKCS1v15/2048-4      7.000 ± 0%   6.000 ± 0%  -14.29%     6.000 ± 0%  -14.29%
SignPSS/2048-4            108.00 ± 0%   10.00 ± 0%  -90.74%     10.00 ± 0%  -90.74%
VerifyPSS/2048-4           12.00 ± 0%   11.00 ± 0%   -8.33%     11.00 ± 0%   -8.33%

goos: linux
goarch: amd64
pkg: crypto/rsa
cpu: AMD EPYC 7R13 Processor
                       │ go1.19a.txt │       go1.20a.txt        │        newa.txt          │
                       │   sec/op    │    sec/op      vs base   │    sec/op      vs base   │
DecryptPKCS1v15/2048-4   970.0µ ± 0%    1667.6µ ± 0%    +71.92%     951.6µ ± 0%     -1.90%
DecryptPKCS1v15/3072-4   2.949m ± 0%     5.124m ± 0%    +73.75%     2.675m ± 0%     -9.29%
DecryptPKCS1v15/4096-4   6.350m ± 0%    11.660m ± 0%    +83.62%     5.746m ± 0%     -9.51%
EncryptPKCS1v15/2048-4   6.605µ ± 1%   183.807µ ± 0%  +2683.05%   123.720µ ± 0%  +1773.27%
DecryptOAEP/2048-4       973.8µ ± 0%    1670.8µ ± 0%    +71.57%     951.8µ ± 0%     -2.27%
EncryptOAEP/2048-4       8.444µ ± 1%   185.889µ ± 0%  +2101.56%   124.142µ ± 0%  +1370.27%
SignPKCS1v15/2048-4      976.8µ ± 0%    1725.5µ ± 0%    +76.65%     979.6µ ± 0%     +0.28%
VerifyPKCS1v15/2048-4    5.713µ ± 0%   182.983µ ± 0%  +3103.19%   122.737µ ± 0%  +2048.56%
SignPSS/2048-4           980.3µ ± 0%    1729.5µ ± 0%    +76.42%     985.7µ ± 3%     +0.55%
VerifyPSS/2048-4         8.168µ ± 1%   185.312µ ± 0%  +2168.76%   123.772µ ± 0%  +1415.33%

Fixes #59463
Fixes #59442
Updates #57752

Change-Id: I311a9c1f4f5288e47e53ca14f615a443f3132734
Reviewed-on: https://go-review.googlesource.com/c/go/+/471259
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Filippo Valsorda <filippo@golang.org>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Roland Shoemaker <roland@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>

12 months agocmd/compile: use shorter version of movzx for LoweredHASCPUFeature
Jakub Ciolek [Sun, 11 Sep 2022 12:47:36 +0000 (14:47 +0200)]
cmd/compile: use shorter version of movzx for LoweredHASCPUFeature

The values loaded from memory are booleans. Upper 32 bits are not needed.
Use the 32-bit version of movzx.

compilecmp linux/amd64:

math/bits
math/bits.OnesCount 83 -> 78  (-6.02%)

math
math.ceil 109 -> 103  (-5.50%)
math.Gamma changed
math.sinPi changed

runtime
runtime.(*sweepLocked).sweep changed
runtime.(*mspan).countAlloc 182 -> 178  (-2.20%)
runtime.(*pageBits).popcntRange 552 -> 542  (-1.81%)
go:(**mspan).runtime.countAlloc 243 -> 232  (-4.53%)
runtime.sweepLocked.countAlloc 221 -> 215  (-2.71%)
runtime.(*pageCache).allocN changed

math/rand
math/rand.(*Zipf).Uint64 506 -> 499  (-1.38%)

cmd/vendor/golang.org/x/sys/unix
cmd/vendor/golang.org/x/sys/unix.(*CPUSet).Count 147 -> 145  (-1.36%)

cmd/internal/obj/ppc64
cmd/internal/obj/ppc64.(*ctxt9).asmout changed

cmd/cover
main.htmlGen 1170 -> 1164  (-0.51%)

cmd/compile/internal/bitvec
cmd/compile/internal/bitvec.(*BitVec).Count 221 -> 213  (-3.62%)
cmd/compile/internal/bitvec.BitVec.Count changed

cmd/link/internal/loader
cmd/link/internal/loader.(*Bitmap).Count 214 -> 212  (-0.93%)
cmd/link/internal/loader.Bitmap.Count 171 -> 169  (-1.17%)
cmd/link/internal/loader.(*Loader).NReachableSym changed
cmd/link/internal/loader.(*Loader).Stat changed

cmd/vendor/github.com/ianlancetaylor/demangle
cmd/vendor/github.com/ianlancetaylor/demangle.oldRustToString changed

cmd/vendor/github.com/google/pprof/internal/graph
cmd/vendor/github.com/google/pprof/internal/graph.(*builder).addNode changed

cmd/compile/internal/ssa
cmd/compile/internal/ssa.rewriteValuePPC64_OpPPC64FTRUNC changed
cmd/compile/internal/ssa.(*regAllocState).computeLive 10441 -> 10409  (-0.31%)
cmd/compile/internal/ssa.(*regAllocState).regalloc changed
cmd/compile/internal/ssa.rewriteValuePPC64_OpPPC64FCEIL changed
cmd/compile/internal/ssa.(*regAllocState).allocReg changed
cmd/compile/internal/ssa.rewriteValuePPC64_OpPPC64FFLOOR changed
cmd/compile/internal/ssa.countRegs 83 -> 78  (-6.02%)

cmd/compile/internal/liveness
cmd/compile/internal/liveness.ArgLiveness.func2 changed

cmd/compile/internal/amd64
cmd/compile/internal/amd64.ssaGenValue changed

file                               before   after    Δ       %
math/bits.s                        2618     2613     -5      -0.191%
math.s                             37246    37240    -6      -0.016%
runtime.s                          486910   486879   -31     -0.006%
math/rand.s                        9980     9973     -7      -0.070%
cmd/vendor/golang.org/x/sys/unix.s 119232   119230   -2      -0.002%
cmd/cover.s                        31341    31335    -6      -0.019%
cmd/compile/internal/bitvec.s      5542     5534     -8      -0.144%
cmd/link/internal/loader.s         75315    75311    -4      -0.005%
cmd/compile/internal/ssa.s         3570581  3570544  -37     -0.001%
total                              20041552 20041446 -106    -0.001%

Change-Id: I29845744c512a1f833cb1fa3bb43b6b0e0eaac68
Reviewed-on: https://go-review.googlesource.com/c/go/+/430175
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Martin Möhrmann <moehrmann@google.com>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>

12 months agospec: re-order built-ins sections alphabetically (more or less)
Robert Griesemer [Wed, 24 May 2023 18:42:57 +0000 (11:42 -0700)]
spec: re-order built-ins sections alphabetically (more or less)

Put the sections for the various built-ins into alphabetical order
based on the built-in name, while keeping built-ins that belong
together together.

The order is now (captialized letter determines order):

- Append
- Clear
- Close
- Complex, real, imag
- Delete
- Len, cap
- Make
- Min, max (to be inserted here)
- New
- Panic, recover
- Print, println

There are some white space adjustments but no changes to the prose
of the moved sections.

Change-Id: Iaec509918c6bc965df3f28656374de03279bdc9e
Reviewed-on: https://go-review.googlesource.com/c/go/+/498135
Reviewed-by: Robert Griesemer <gri@google.com>
TryBot-Bypass: Robert Griesemer <gri@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
12 months agocmd/go/internal/cache: use internal/godebug for three GODEBUGs
Brad Fitzpatrick [Sat, 22 Apr 2023 02:55:43 +0000 (19:55 -0700)]
cmd/go/internal/cache: use internal/godebug for three GODEBUGs

And register/document them.

Change-Id: If0f1cf3c09230e0f63d03c52e56e51a030468ab2
Reviewed-on: https://go-review.googlesource.com/c/go/+/487655
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>

12 months agocmd/compile: prioritize non-CALL struct member comparisons
Derek Parker [Mon, 8 May 2023 21:28:43 +0000 (21:28 +0000)]
cmd/compile: prioritize non-CALL struct member comparisons

This patch optimizes reflectdata.geneq to pick apart structs in array
equality and prioritize non-CALL comparisons over those which involve
a runtime function call. This is similar to how arrays of strings
operate currently. Instead of looping over the entire array of structs
once, if there are any comparisons which involve a runtime function
call we instead loop twice. The first loop is all simple, quick
comparisons. If no inequality is found in the first loop the second loop
calls runtime functions for larger memory comparison, which is more
expensive.

For the benchmarks added in this change:

Old:

```
goos: linux
goarch: amd64
pkg: cmd/compile/internal/reflectdata
cpu: AMD Ryzen 9 3950X 16-Core Processor
BenchmarkEqArrayOfStructsEq
BenchmarkEqArrayOfStructsEq-32            797196              1497 ns/op
BenchmarkEqArrayOfStructsEq-32            758332              1581 ns/op
BenchmarkEqArrayOfStructsEq-32            764871              1599 ns/op
BenchmarkEqArrayOfStructsEq-32            760706              1558 ns/op
BenchmarkEqArrayOfStructsEq-32            763112              1476 ns/op
BenchmarkEqArrayOfStructsEq-32            747696              1547 ns/op
BenchmarkEqArrayOfStructsEq-32            756526              1562 ns/op
BenchmarkEqArrayOfStructsEq-32            768829              1486 ns/op
BenchmarkEqArrayOfStructsEq-32            764248              1477 ns/op
BenchmarkEqArrayOfStructsEq-32            752767              1545 ns/op
BenchmarkEqArrayOfStructsNotEq
BenchmarkEqArrayOfStructsNotEq-32         757194              1542 ns/op
BenchmarkEqArrayOfStructsNotEq-32         748942              1552 ns/op
BenchmarkEqArrayOfStructsNotEq-32         766687              1554 ns/op
BenchmarkEqArrayOfStructsNotEq-32         732069              1541 ns/op
BenchmarkEqArrayOfStructsNotEq-32         759163              1576 ns/op
BenchmarkEqArrayOfStructsNotEq-32         796402              1629 ns/op
BenchmarkEqArrayOfStructsNotEq-32         726610              1570 ns/op
BenchmarkEqArrayOfStructsNotEq-32         735770              1584 ns/op
BenchmarkEqArrayOfStructsNotEq-32         745255              1610 ns/op
BenchmarkEqArrayOfStructsNotEq-32         743872              1591 ns/op
PASS
ok      cmd/compile/internal/reflectdata        35.446s
```

New:

```
goos: linux
goarch: amd64
pkg: cmd/compile/internal/reflectdata
cpu: AMD Ryzen 9 3950X 16-Core Processor
BenchmarkEqArrayOfStructsEq
BenchmarkEqArrayOfStructsEq-32            618379              1827 ns/op
BenchmarkEqArrayOfStructsEq-32            619368              1922 ns/op
BenchmarkEqArrayOfStructsEq-32            616023              1910 ns/op
BenchmarkEqArrayOfStructsEq-32            617575              1905 ns/op
BenchmarkEqArrayOfStructsEq-32            610399              1889 ns/op
BenchmarkEqArrayOfStructsEq-32            615378              1823 ns/op
BenchmarkEqArrayOfStructsEq-32            613732              1883 ns/op
BenchmarkEqArrayOfStructsEq-32            613924              1894 ns/op
BenchmarkEqArrayOfStructsEq-32            657799              1876 ns/op
BenchmarkEqArrayOfStructsEq-32            665580              1873 ns/op
BenchmarkEqArrayOfStructsNotEq
BenchmarkEqArrayOfStructsNotEq-32        1834915               627.4 ns/op
BenchmarkEqArrayOfStructsNotEq-32        1806370               660.5 ns/op
BenchmarkEqArrayOfStructsNotEq-32        1828075               625.5 ns/op
BenchmarkEqArrayOfStructsNotEq-32        1819741               641.6 ns/op
BenchmarkEqArrayOfStructsNotEq-32        1813128               632.3 ns/op
BenchmarkEqArrayOfStructsNotEq-32        1865250               643.7 ns/op
BenchmarkEqArrayOfStructsNotEq-32        1828617               632.8 ns/op
BenchmarkEqArrayOfStructsNotEq-32        1862748               633.6 ns/op
BenchmarkEqArrayOfStructsNotEq-32        1825432               638.7 ns/op
BenchmarkEqArrayOfStructsNotEq-32        1804382               628.8 ns/op
PASS
ok      cmd/compile/internal/reflectdata        36.571s
```

Benchstat comparison:

```
name                      old time/op  new time/op  delta
EqArrayOfStructsEq-32     1.53µs ± 4%  1.88µs ± 3%  +22.66%  (p=0.000 n=10+10)
EqArrayOfStructsNotEq-32  1.57µs ± 3%  0.64µs ± 4%  -59.59%  (p=0.000 n=10+10)
```

So, the equal case is a bit slower (unrolling the loop helps with that),
but the non-equal case is now much faster.

Change-Id: I05d776456c79c48a3d6d74b18c45246e58ffbea6
GitHub-Last-Rev: f57ee07d053ec4269a6d7d9109c845d8c862cba1
GitHub-Pull-Request: golang/go#59409
Reviewed-on: https://go-review.googlesource.com/c/go/+/481895
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
12 months agocmd/go: quote entries in list-valued variables for go env in plan9
miller [Mon, 8 May 2023 15:56:21 +0000 (16:56 +0100)]
cmd/go: quote entries in list-valued variables for go env in plan9

When 'go env' without an argument prints environment variables as
a script which can be executed by the shell, variables with a
list value in Plan 9 (such as GOPATH) need to be printed with each
element enclosed in single quotes in case it contains characters
significant to the Plan 9 shell (such as ' ' or '=').

For #58508

Change-Id: Ia30f51307cc6d07a7e3ada6bf9d60bf9951982ff
Reviewed-on: https://go-review.googlesource.com/c/go/+/493535
Run-TryBot: Cherry Mui <cherryyz@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Russ Cox <rsc@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>

12 months agodoc: add release note for runtime/metrics additions
Michael Anthony Knyszek [Wed, 24 May 2023 18:41:32 +0000 (18:41 +0000)]
doc: add release note for runtime/metrics additions

For #56857.

Change-Id: I03bdba906d271d97ce29874c50d5aba55dc285b1
Reviewed-on: https://go-review.googlesource.com/c/go/+/498075
Run-TryBot: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
12 months agocrypto/tls: enforce 1.3 record version semantics
Roland Shoemaker [Tue, 18 Apr 2023 17:24:32 +0000 (10:24 -0700)]
crypto/tls: enforce 1.3 record version semantics

1.3 expects the record version is always 1.2 (0x0303), this previously
wasn't enforced.

Change-Id: I8bc88f588e76f9b862b57601336bb5c5ff08b30e
Reviewed-on: https://go-review.googlesource.com/c/go/+/485876
Reviewed-by: Damien Neil <dneil@google.com>
Auto-Submit: Roland Shoemaker <roland@golang.org>
Run-TryBot: Roland Shoemaker <roland@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>

12 months agonet/http: check for nil, nil return from DialContext as well as Dial
fangguizhen [Tue, 3 Jan 2023 18:18:35 +0000 (18:18 +0000)]
net/http: check for nil, nil return from DialContext as well as Dial

Change-Id: I3b6dd9c40b3c10db2eda6a25b9d556c9c3733bbc
GitHub-Last-Rev: fd9b0c4193511a75b4a0073f37aa3116db23a46f
GitHub-Pull-Request: golang/go#57448
Reviewed-on: https://go-review.googlesource.com/c/go/+/458876
Reviewed-by: Javad Rajabzadeh <ja7ad@live.com>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>

12 months agocrypto/tls: remove unused nonAESGCMAEADCiphers variable
Sebastiaan van Stijn [Mon, 14 Nov 2022 20:29:26 +0000 (20:29 +0000)]
crypto/tls: remove unused nonAESGCMAEADCiphers variable

It was no longer used since CL 314609

Change-Id: Id103b7490a6088a589d76442d3740f8a1453c25d
GitHub-Last-Rev: 20a7fe0778fbfcfd789a194456e87dd4a60b655e
GitHub-Pull-Request: golang/go#56608
Reviewed-on: https://go-review.googlesource.com/c/go/+/448277
Reviewed-by: Roland Shoemaker <roland@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>

12 months agomaps: move test funcs to maps_test.go
Tobias Klauser [Wed, 24 May 2023 10:28:25 +0000 (12:28 +0200)]
maps: move test funcs to maps_test.go

keysForBenchmarking and valuesForBenchmarking are only used in benchmark
tests.

Change-Id: Ie4fcb81e0470cc8627b395644787429b79952538
Reviewed-on: https://go-review.googlesource.com/c/go/+/497380
Reviewed-by: Keith Randall <khr@google.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Bypass: Ian Lance Taylor <iant@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>

12 months agolog/slog: add link to handler-writing guide
Jonathan Amsterdam [Wed, 17 May 2023 20:12:42 +0000 (16:12 -0400)]
log/slog: add link to handler-writing guide

Add a shortlink in the doc to a guide to writing handlers, which is a work
in progress.

Change-Id: I1b01c90468382ffe53d9ad6f38253906e3f44857
Reviewed-on: https://go-review.googlesource.com/c/go/+/495920
Reviewed-by: Alan Donovan <adonovan@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Jonathan Amsterdam <jba@google.com>

12 months agonet/http/pprof: adjust URL in package doc
Joe Tsai [Tue, 21 Mar 2023 03:28:47 +0000 (20:28 -0700)]
net/http/pprof: adjust URL in package doc

The indentation makes the URL be treated as a code block,
thus preventing automatic detection of this URL.
Avoid using a code block for this.

Change-Id: Ie37ae18ec0969ef2d5a6e3b92b2512dac093dbf6
Reviewed-on: https://go-review.googlesource.com/c/go/+/478015
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
12 months agonet/http: add doc details regarding Transport retries
Simon Kotwicz [Sun, 20 Feb 2022 08:24:08 +0000 (08:24 +0000)]
net/http: add doc details regarding Transport retries

Add doc details to Transport mentioning retries only occur if a connection
has been already been used successfully.

Change-Id: I37afbad50b885248e0e6cd5e799ad848bf97c86b
GitHub-Last-Rev: 7c45c32aec2bd3266c525bf28ab1879acbecf193
GitHub-Pull-Request: golang/go#51273
Reviewed-on: https://go-review.googlesource.com/c/go/+/386994
Run-TryBot: Damien Neil <dneil@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>

12 months agointernal/coverage: fix comment dupword, error typo
Oleksandr Redko [Mon, 17 Apr 2023 09:32:12 +0000 (12:32 +0300)]
internal/coverage: fix comment dupword, error typo

- Correct duplicated word in comments.
- Fix typo in error message.

Change-Id: I688d723ea3ac4d0b1981afd747e4b2df00c81448
Reviewed-on: https://go-review.googlesource.com/c/go/+/485016
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
12 months agoos: explicitly check for invalid FD in NewFile
Michael Pratt [Wed, 24 May 2023 15:25:12 +0000 (11:25 -0400)]
os: explicitly check for invalid FD in NewFile

CL 497075 refactored NewFile to unconditionally dereference the file
returned by newFile. However, newFile can return nil if passed a
negative FD, which now causes a crash.

Resolve this by moving the invalid check earlier in NewFile, which also
lets us avoid a useless fcntl syscall on a negative FD.

Since we convert to int to check sign, adjust newFile to take an int
rather than uintptr, which cleans up a lot of conversions.

Fixes #60406

Change-Id: I382a74e22f1cc01f7a2dcf1ff4efca6a79c4dd57
Reviewed-on: https://go-review.googlesource.com/c/go/+/497877
Run-TryBot: Michael Pratt <mpratt@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
12 months agocmd/go: implement 'toolchain local'
Russ Cox [Tue, 23 May 2023 18:23:31 +0000 (14:23 -0400)]
cmd/go: implement 'toolchain local'

The actual selection code already worked
(except for the x/mod parser not reading the file),
so all that is necessary is a test.
For the test, move the version check up before
the module line presence check.

For #57001.

Change-Id: Iaa4f9b92d38fcfd99dc1665ec8d3eb0e52007bb4
Reviewed-on: https://go-review.googlesource.com/c/go/+/497555
TryBot-Bypass: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
12 months agoruntime: fix alignment code in memclr_riscv64.s
Mark Ryan [Fri, 19 May 2023 12:00:10 +0000 (14:00 +0200)]
runtime: fix alignment code in memclr_riscv64.s

The existing code incorrectly determines whether the pointer passed to
memclrNoHeapPointers is 8 byte aligned (it currently checks to see whether
it's 4 byte aligned).

In addition, the code that aligns the pointer, by individually filling
the first few bytes of the buffer with zeros, is also incorrect.  It adjusts
the pointer by the wrong number of bytes, resulting in most cases, in
an unaligned pointer.

This commit fixes both of these issues by anding the pointer with 7
rather than 3 to determine its alignment, and by individually filling
the first (8 - (pointer & 7)) bytes with 0 to align the buffer, rather
than the first (pointer & 3) bytes.

We also remove an unnecessary immediate MOV instruction.

A new benchmark is added to test the performance of memclrNoHeapPointers
on non-aligned pointers.  Results of the existing and the new benchmark
on a SiFive HiFive Unmatched A00 with 16GB of RAM running Ubuntu 23.04
are presented below.

Memclr/5-4                     21.98n ± 7%   22.66n ± 9%        ~ (p=0.079 n=10)
Memclr/16-4                    20.85n ± 3%   21.09n ± 5%        ~ (p=0.796 n=10)
Memclr/64-4                    28.20n ± 4%   27.50n ± 3%        ~ (p=0.093 n=10)
Memclr/256-4                   53.66n ± 8%   53.44n ± 8%        ~ (p=0.280 n=10)
Memclr/4096-4                  522.6n ± 1%   523.4n ± 1%        ~ (p=0.240 n=10)
Memclr/65536-4                 24.17µ ± 0%   24.13µ ± 0%   -0.19% (p=0.029 n=10)
Memclr/1M-4                    446.9µ ± 0%   446.9µ ± 0%        ~ (p=0.684 n=10)
Memclr/4M-4                    12.69m ± 2%   12.79m ± 3%   +0.78% (p=0.043 n=10)
Memclr/8M-4                    29.75m ± 0%   29.76m ± 0%   +0.03% (p=0.015 n=10)
Memclr/16M-4                   60.34m ± 0%   60.32m ± 0%        ~ (p=0.247 n=10)
Memclr/64M-4                   241.2m ± 0%   241.3m ± 0%        ~ (p=0.247 n=10)
MemclrUnaligned/0_5-4          27.71n ± 0%   27.72n ± 1%        ~ (p=0.142 n=10)
MemclrUnaligned/0_16-4         26.95n ± 0%   26.04n ± 0%   -3.38% (p=0.000 n=10)
MemclrUnaligned/0_64-4         38.27n ± 4%   40.15n ± 6%   +4.89% (p=0.005 n=10)
MemclrUnaligned/0_256-4        63.95n ± 3%   64.19n ± 2%        ~ (p=0.971 n=10)
MemclrUnaligned/0_4096-4       532.6n ± 1%   530.9n ± 1%        ~ (p=0.324 n=10)
MemclrUnaligned/0_65536-4      24.30µ ± 0%   24.22µ ± 0%   -0.32% (p=0.023 n=10)
MemclrUnaligned/1_5-4          29.40n ± 0%   29.39n ± 0%        ~ (p=0.060 n=10)
MemclrUnaligned/1_16-4        632.65n ± 1%   63.80n ± 2%  -89.92% (p=0.000 n=10)
MemclrUnaligned/1_64-4       4091.00n ± 1%   73.23n ± 1%  -98.21% (p=0.000 n=10)
MemclrUnaligned/1_256-4     17803.50n ± 1%   92.03n ± 1%  -99.48% (p=0.000 n=10)
MemclrUnaligned/1_4096-4    294150.0n ± 1%   561.9n ± 1%  -99.81% (p=0.000 n=10)
MemclrUnaligned/1_65536-4    4692.80µ ± 1%   24.44µ ± 0%  -99.48% (p=0.000 n=10)
MemclrUnaligned/4_5-4          27.71n ± 0%   27.71n ± 0%        ~ (p=0.308 n=10)
MemclrUnaligned/4_16-4       1187.00n ± 1%   50.74n ± 3%  -95.72% (p=0.000 n=10)
MemclrUnaligned/4_64-4       4617.00n ± 1%   59.89n ± 2%  -98.70% (p=0.000 n=10)
MemclrUnaligned/4_256-4     18472.50n ± 1%   84.76n ± 2%  -99.54% (p=0.000 n=10)
MemclrUnaligned/4_4096-4    292904.0n ± 1%   553.7n ± 0%  -99.81% (p=0.000 n=10)
MemclrUnaligned/4_65536-4    4716.12µ ± 0%   24.38µ ± 0%  -99.48% (p=0.000 n=10)
MemclrUnaligned/7_5-4          29.39n ± 0%   29.39n ± 0%        ~ (p=1.000 n=10)
MemclrUnaligned/7_16-4        636.80n ± 1%   48.33n ± 5%  -92.41% (p=0.000 n=10)
MemclrUnaligned/7_64-4       4094.00n ± 1%   58.88n ± 3%  -98.56% (p=0.000 n=10)
MemclrUnaligned/7_256-4     17869.00n ± 2%   82.70n ± 3%  -99.54% (p=0.000 n=10)
MemclrUnaligned/7_4096-4    294110.5n ± 1%   554.6n ± 1%  -99.81% (p=0.000 n=10)
MemclrUnaligned/7_65536-4    4735.00µ ± 1%   24.28µ ± 0%  -99.49% (p=0.000 n=10)
MemclrUnaligned/0_1M-4         447.8µ ± 0%   450.0µ ± 1%   +0.51% (p=0.000 n=10)
MemclrUnaligned/0_4M-4         12.68m ± 1%   12.64m ± 2%   -0.33% (p=0.015 n=10)
MemclrUnaligned/0_8M-4         29.76m ± 0%   29.79m ± 2%        ~ (p=0.075 n=10)
MemclrUnaligned/0_16M-4        60.34m ± 1%   60.49m ± 1%        ~ (p=0.353 n=10)
MemclrUnaligned/0_64M-4        241.3m ± 0%   241.4m ± 0%        ~ (p=0.247 n=10)
MemclrUnaligned/1_1M-4       75937.3µ ± 1%   449.9µ ± 0%  -99.41% (p=0.000 n=10)
MemclrUnaligned/1_4M-4        313.96m ± 2%   12.69m ± 0%  -95.96% (p=0.000 n=10)
MemclrUnaligned/1_8M-4        630.97m ± 1%   29.76m ± 0%  -95.28% (p=0.000 n=10)
MemclrUnaligned/1_16M-4      1263.47m ± 1%   60.35m ± 2%  -95.22% (p=0.000 n=10)
MemclrUnaligned/1_64M-4       5053.5m ± 0%   241.3m ± 0%  -95.23% (p=0.000 n=10)
MemclrUnaligned/4_1M-4       75880.5µ ± 2%   446.5µ ± 0%  -99.41% (p=0.000 n=10)
MemclrUnaligned/4_4M-4        314.00m ± 1%   12.71m ± 2%  -95.95% (p=0.000 n=10)
MemclrUnaligned/4_8M-4        630.63m ± 1%   29.77m ± 2%  -95.28% (p=0.000 n=10)
MemclrUnaligned/4_16M-4      1257.80m ± 0%   60.34m ± 2%  -95.20% (p=0.000 n=10)
MemclrUnaligned/4_64M-4       5041.3m ± 1%   241.2m ± 0%  -95.21% (p=0.000 n=10)
MemclrUnaligned/7_1M-4       75866.2µ ± 1%   446.9µ ± 0%  -99.41% (p=0.000 n=10)
MemclrUnaligned/7_4M-4        309.86m ± 1%   12.70m ± 1%  -95.90% (p=0.000 n=10)
MemclrUnaligned/7_8M-4        626.67m ± 1%   29.75m ± 2%  -95.25% (p=0.000 n=10)
MemclrUnaligned/7_16M-4      1252.84m ± 1%   60.31m ± 0%  -95.19% (p=0.000 n=10)
MemclrUnaligned/7_64M-4       5015.8m ± 1%   241.4m ± 0%  -95.19% (p=0.000 n=10)
geomean                        339.1µ        35.83µ       -89.43%

Change-Id: I3b958a1d8e8f5ef205052e6b985a5ce21e92ef85
Reviewed-on: https://go-review.googlesource.com/c/go/+/496455
Run-TryBot: Joel Sing <joel@sing.id.au>
Reviewed-by: Joel Sing <joel@sing.id.au>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: M Zhuo <mzh@golangcn.org>
Reviewed-by: Keith Randall <khr@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

12 months agofmt: correct documentation for Formatter
Paul Jolly [Wed, 24 May 2023 04:51:09 +0000 (05:51 +0100)]
fmt: correct documentation for Formatter

Before this CL, the documentation for Formatter suggested that
implementers of Format(f State, verb rune) could use Fprint(f) or
Sprint(f) to generate output. The Sprint(f) suggestion however is
invalid.

Fix that by simply suggesting Sprint() alongside Fprint(f).

Fixes #60358

Change-Id: I024e996f6360b812968ef2cd5073cb4c223459e3
Reviewed-on: https://go-review.googlesource.com/c/go/+/497379
Reviewed-by: Bryan Mills <bcmills@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Paul Jolly <paul@myitcv.org.uk>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
12 months agonet/http: fix spelling issues in comments and tests
Oleksandr Redko [Thu, 18 May 2023 08:12:23 +0000 (11:12 +0300)]
net/http: fix spelling issues in comments and tests

Change-Id: I1b90619fd073a0c41188278a50ed149b763f0fa8
Reviewed-on: https://go-review.googlesource.com/c/go/+/496135
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

12 months agoruntime: ensure consistency of /gc/scan/*
Michael Anthony Knyszek [Wed, 24 May 2023 16:43:47 +0000 (16:43 +0000)]
runtime: ensure consistency of /gc/scan/*

Currently /gc/scan/total:bytes is computed as a separate sum. Compute it
using the same inputs so it's always consistent with the sum of
everything else in /gc/scan/*.

For #56857.

Change-Id: I43d9148a23b1d2eb948ae990193dca1da85df8a3
Reviewed-on: https://go-review.googlesource.com/c/go/+/497880
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>