]> Cypherpunks repositories - gostls13.git/log
gostls13.git
5 months agosyscall: disable O_DIRECTORY on Windows for js/wasm
Zxilly [Tue, 18 Feb 2025 15:21:23 +0000 (15:21 +0000)]
syscall: disable O_DIRECTORY on Windows for js/wasm

O_DIRECTORY is not available on all platforms, as described at

https://nodejs.org/docs/latest/api/fs.html#file-open-constants .

On Windows, only O_APPEND, O_CREAT, O_EXCL, O_RDONLY, O_RDWR,
O_TRUNC, O_WRONLY, and UV_FS_O_FILEMAP are available.

Fixes #71758

Change-Id: Iacc890ba9a30dcd75eb746ec324fa0c3e368048e
GitHub-Last-Rev: a0160e8fc82583c4f903ae165fe9f204896cf56d
GitHub-Pull-Request: golang/go#71770
Reviewed-on: https://go-review.googlesource.com/c/go/+/650015
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Bypass: Dmitri Shuralyov <dmitshur@golang.org>

5 months agoall: use a more straightforward return value
cuishuang [Sat, 15 Feb 2025 03:22:16 +0000 (11:22 +0800)]
all: use a more straightforward return value

Change-Id: I27e86c221da7f541c4823f501801e02942c9a829
Reviewed-on: https://go-review.googlesource.com/c/go/+/649935
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
5 months agogo/format: format comment to match code
Luka Krmpotić [Sat, 15 Feb 2025 10:25:50 +0000 (10:25 +0000)]
go/format: format comment to match code

Change-Id: I9434a8d04ca4282da86cb2622a6a541db3961a2b
GitHub-Last-Rev: f28908e338e9160ca3d4033161647832fdd76840
GitHub-Pull-Request: golang/go#71763
Reviewed-on: https://go-review.googlesource.com/c/go/+/649955
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>

5 months agoos: deal with chmod error for TestRootConsistencyChmod
Jes Cok [Mon, 17 Feb 2025 11:45:51 +0000 (11:45 +0000)]
os: deal with chmod error for TestRootConsistencyChmod

Previously the error returned by chmod has not actually been used.

Change-Id: I97c947a2278a084c58784fd100630ce2a54bfb03
GitHub-Last-Rev: ddc60a044f641d264c9ee88d87b2da7e2f766741
GitHub-Pull-Request: golang/go#71744
Reviewed-on: https://go-review.googlesource.com/c/go/+/649418
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>

5 months agocmd/cgo: explicitly use void for functions with no parameters
Mauri de Souza Meneguzzo [Mon, 17 Feb 2025 13:57:12 +0000 (13:57 +0000)]
cmd/cgo: explicitly use void for functions with no parameters

Currently, exported Go functions with no parameters generate C functions
with an empty parameter list. In C, a function with an empty parameter
list can accept any number of arguments, whereas a function with a single
void parameter explicitly declares that it takes no arguments.

To align the generated C functions with their Go prototypes, update the
code generation to explicitly include a void parameter for functions
with no parameters.

Fixes #68411

Change-Id: Iab9456aa0236200bf21d1181a2e18e82869df63f
GitHub-Last-Rev: 6ff21a98dfef81df649c76221d9c0858dc0e35e1
GitHub-Pull-Request: golang/go#70981
Reviewed-on: https://go-review.googlesource.com/c/go/+/638635
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
5 months agocrypto/internal/fips140deps/cpu: use const and var blocks
Joel Sing [Sat, 15 Feb 2025 07:09:59 +0000 (18:09 +1100)]
crypto/internal/fips140deps/cpu: use const and var blocks

Rather than repeating ourselves, use a single const block and a single
var block. Also separate architectures for readability.

Change-Id: Iab5bda3514eae0c9b5bb16a99277fd4b95f272aa
Reviewed-on: https://go-review.googlesource.com/c/go/+/649658
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Joel Sing <joel@sing.id.au>

5 months agoruntime: remove unused fipstls_runtime_arg0 function
qmuntal [Fri, 22 Nov 2024 15:14:21 +0000 (16:14 +0100)]
runtime: remove unused fipstls_runtime_arg0 function

fipstls_runtime_arg0 is unused since CL 629675.

Change-Id: I981e55e95f4d1cbd33f4c438c1947ec39385376b
Reviewed-on: https://go-review.googlesource.com/c/go/+/631215
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Daniel McCarney <daniel@binaryparadox.net>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Quim Muntal <quimmuntal@gmail.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
5 months agoruntime: print pp.schedtick in scheddetail even when !detailed
Nicolas Hillegeer [Thu, 12 Dec 2024 16:49:03 +0000 (08:49 -0800)]
runtime: print pp.schedtick in scheddetail even when !detailed

Provides, on one line, an approximation of P scheduling throughput: how
many times execute() was called for a given P. Said another way: how
many RUNNABLE to RUNNING transitions have happened for this P.

This allows discerning whether a P actually did anything, and how it
compares to other periods of a processes operation.

This should be useful to analyze (kernel) scheduler hiccups.

Investigators will want to subtract the tick values from subsequent
schedtrace lines to get a rate of schedulings. I've opted to add a space
around the first and last element as well to make it more uniform to do
the proposed subtracting with tools like AWK.

Change-Id: I69d6dae1509ad285d43799f38bcaa3aa0fb2352e
Reviewed-on: https://go-review.googlesource.com/c/go/+/635636
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Nicolas Hillegeer <aktau@google.com>

5 months agoruntime: only read pp.m in schedtrace if needed
Nicolas Hillegeer [Thu, 12 Dec 2024 16:35:17 +0000 (08:35 -0800)]
runtime: only read pp.m in schedtrace if needed

Change-Id: Iad3353431a2ef97c1e0c440bdd84b78cb5ea990e
Reviewed-on: https://go-review.googlesource.com/c/go/+/635635
Reviewed-by: Michael Pratt <mpratt@google.com>
Auto-Submit: Nicolas Hillegeer <aktau@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

5 months agoruntime: check LSE support on ARM64 at runtime init
Andrey Bokhanko [Fri, 31 Jan 2025 13:59:02 +0000 (16:59 +0300)]
runtime: check LSE support on ARM64 at runtime init

Check presence of LSE support on ARM64 chip if we targeted it at compile
time.

Related to #69124
Updates #60905
Fixes #71411

Change-Id: I65e899a28ff64a390182572c0c353aa5931fc85d
Reviewed-on: https://go-review.googlesource.com/c/go/+/645795
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>

6 months agocmd/compile: on AMD64, turn x < 128 into x <= 127
Jakub Ciolek [Fri, 3 Jan 2025 12:52:11 +0000 (13:52 +0100)]
cmd/compile: on AMD64, turn x < 128 into x <= 127

x < 128 -> x <= 127
x >= 128 -> x > 127

This allows for shorter encoding as 127 fits into
a single-byte immediate.

archive/tar benchmark (Alder Lake 12600K)

name              old time/op    new time/op    delta
/Writer/USTAR-16    1.46µs ± 0%    1.32µs ± 0%  -9.43%  (p=0.008 n=5+5)
/Writer/GNU-16      1.85µs ± 1%    1.79µs ± 1%  -3.47%  (p=0.008 n=5+5)
/Writer/PAX-16      3.21µs ± 0%    3.11µs ± 2%  -2.96%  (p=0.008 n=5+5)
/Reader/USTAR-16    1.38µs ± 1%    1.37µs ± 0%    ~     (p=0.127 n=5+4)
/Reader/GNU-16       798ns ± 1%     800ns ± 2%    ~     (p=0.548 n=5+5)
/Reader/PAX-16      3.07µs ± 1%    3.00µs ± 0%  -2.35%  (p=0.008 n=5+5)
[Geo mean]          1.76µs         1.70µs       -3.15%

compilecmp:

hash/maphash
hash/maphash.(*Hash).Write 517 -> 510  (-1.35%)

runtime
runtime.traceReadCPU 1626 -> 1615  (-0.68%)

runtime [cmd/compile]
runtime.traceReadCPU 1626 -> 1615  (-0.68%)

math/rand/v2
type:.eq.[128]float32 65 -> 59  (-9.23%)

bytes
bytes.trimLeftUnicode 378 -> 373  (-1.32%)
bytes.IndexAny 1189 -> 1157  (-2.69%)
bytes.LastIndexAny 1256 -> 1239  (-1.35%)
bytes.lastIndexFunc 263 -> 261  (-0.76%)

strings
strings.FieldsFuncSeq.func1 411 -> 399  (-2.92%)
strings.EqualFold 625 -> 624  (-0.16%)
strings.trimLeftUnicode 248 -> 231  (-6.85%)

math/rand
type:.eq.[128]float32 65 -> 59  (-9.23%)

bytes [cmd/compile]
bytes.LastIndexAny 1256 -> 1239  (-1.35%)
bytes.lastIndexFunc 263 -> 261  (-0.76%)
bytes.trimLeftUnicode 378 -> 373  (-1.32%)
bytes.IndexAny 1189 -> 1157  (-2.69%)

regexp/syntax
regexp/syntax.(*parser).parseEscape 1113 -> 1102  (-0.99%)

math/rand/v2 [cmd/compile]
type:.eq.[128]float32 65 -> 59  (-9.23%)

strings [cmd/compile]
strings.EqualFold 625 -> 624  (-0.16%)
strings.FieldsFuncSeq.func1 411 -> 399  (-2.92%)
strings.trimLeftUnicode 248 -> 231  (-6.85%)

math/rand [cmd/compile]
type:.eq.[128]float32 65 -> 59  (-9.23%)

regexp
regexp.(*inputString).context 198 -> 197  (-0.51%)
regexp.(*inputBytes).context 221 -> 212  (-4.07%)

image/jpeg
image/jpeg.(*decoder).processDQT 500 -> 491  (-1.80%)

regexp/syntax [cmd/compile]
regexp/syntax.(*parser).parseEscape 1113 -> 1102  (-0.99%)

regexp [cmd/compile]
regexp.(*inputString).context 198 -> 197  (-0.51%)
regexp.(*inputBytes).context 221 -> 212  (-4.07%)

encoding/csv
encoding/csv.(*Writer).fieldNeedsQuotes 269 -> 266  (-1.12%)

cmd/vendor/golang.org/x/sys/unix
type:.eq.[131]struct 855 -> 823  (-3.74%)

vendor/golang.org/x/text/unicode/norm
vendor/golang.org/x/text/unicode/norm.nextDecomposed 4831 -> 4826  (-0.10%)
vendor/golang.org/x/text/unicode/norm.(*Iter).returnSlice 281 -> 275  (-2.14%)

vendor/golang.org/x/text/secure/bidirule
vendor/golang.org/x/text/secure/bidirule.init.0 85 -> 83  (-2.35%)

go/scanner
go/scanner.isDigit 100 -> 98  (-2.00%)
go/scanner.(*Scanner).next 431 -> 422  (-2.09%)
go/scanner.isLetter 142 -> 124  (-12.68%)

encoding/asn1
encoding/asn1.parseTagAndLength 1189 -> 1182  (-0.59%)
encoding/asn1.makeField 3481 -> 3463  (-0.52%)

text/scanner
text/scanner.(*Scanner).next 1242 -> 1236  (-0.48%)

archive/tar
archive/tar.isASCII 133 -> 127  (-4.51%)
archive/tar.(*Writer).writeRawFile 1206 -> 1198  (-0.66%)
archive/tar.(*Reader).readHeader.func1 9 -> 7  (-22.22%)
archive/tar.toASCII 393 -> 383  (-2.54%)
archive/tar.splitUSTARPath 405 -> 396  (-2.22%)
archive/tar.(*Writer).writePAXHeader.func1 627 -> 620  (-1.12%)

text/template
text/template.jsIsSpecial 59 -> 57  (-3.39%)

go/doc
go/doc.assumedPackageName 714 -> 701  (-1.82%)

vendor/golang.org/x/net/http/httpguts
vendor/golang.org/x/net/http/httpguts.headerValueContainsToken 965 -> 952  (-1.35%)
vendor/golang.org/x/net/http/httpguts.tokenEqual 280 -> 269  (-3.93%)
vendor/golang.org/x/net/http/httpguts.IsTokenRune 28 -> 26  (-7.14%)

net/mail
net/mail.isVchar 26 -> 24  (-7.69%)
net/mail.isAtext 106 -> 104  (-1.89%)
net/mail.(*Address).String 1084 -> 1052  (-2.95%)
net/mail.isQtext 39 -> 37  (-5.13%)
net/mail.isMultibyte 9 -> 7  (-22.22%)
net/mail.isDtext 45 -> 43  (-4.44%)
net/mail.(*addrParser).consumeQuotedString 1050 -> 1029  (-2.00%)
net/mail.quoteString 741 -> 714  (-3.64%)

cmd/internal/obj/s390x
cmd/internal/obj/s390x.preprocess 6405 -> 6393  (-0.19%)

cmd/internal/obj/x86
cmd/internal/obj/x86.toDisp8 303 -> 301  (-0.66%)

fmt [cmd/compile]
fmt.Fprintf 4726 -> 4662  (-1.35%)

go/scanner [cmd/compile]
go/scanner.(*Scanner).next 431 -> 422  (-2.09%)
go/scanner.isLetter 142 -> 124  (-12.68%)
go/scanner.isDigit 100 -> 98  (-2.00%)

cmd/compile/internal/syntax
cmd/compile/internal/syntax.(*source).nextch 879 -> 847  (-3.64%)

cmd/vendor/golang.org/x/mod/module
cmd/vendor/golang.org/x/mod/module.checkElem 1253 -> 1235  (-1.44%)
cmd/vendor/golang.org/x/mod/module.escapeString 519 -> 517  (-0.39%)

go/doc [cmd/compile]
go/doc.assumedPackageName 714 -> 701  (-1.82%)

cmd/compile/internal/syntax [cmd/compile]
cmd/compile/internal/syntax.(*scanner).escape 1965 -> 1933  (-1.63%)
cmd/compile/internal/syntax.(*scanner).next 8975 -> 8847  (-1.43%)

cmd/internal/obj/s390x [cmd/compile]
cmd/internal/obj/s390x.preprocess 6405 -> 6393  (-0.19%)

cmd/internal/obj/x86 [cmd/compile]
cmd/internal/obj/x86.toDisp8 303 -> 301  (-0.66%)

cmd/internal/gcprog
cmd/internal/gcprog.(*Writer).Repeat 688 -> 677  (-1.60%)
cmd/internal/gcprog.(*Writer).varint 442 -> 439  (-0.68%)

cmd/compile/internal/ir
cmd/compile/internal/ir.splitPkg 331 -> 325  (-1.81%)

cmd/compile/internal/ir [cmd/compile]
cmd/compile/internal/ir.splitPkg 331 -> 325  (-1.81%)

net/http
net/http.containsDotDot.FieldsFuncSeq.func1 411 -> 399  (-2.92%)
net/http.isNotToken 33 -> 30  (-9.09%)
net/http.containsDotDot 606 -> 588  (-2.97%)
net/http.isCookieNameValid 197 -> 191  (-3.05%)
net/http.parsePattern 4330 -> 4317  (-0.30%)
net/http.ParseCookie 1099 -> 1096  (-0.27%)
net/http.validMethod 197 -> 187  (-5.08%)

cmd/vendor/golang.org/x/text/unicode/norm
cmd/vendor/golang.org/x/text/unicode/norm.(*Iter).returnSlice 281 -> 275  (-2.14%)
cmd/vendor/golang.org/x/text/unicode/norm.nextDecomposed 4831 -> 4826  (-0.10%)

net/http/cookiejar
net/http/cookiejar.encode 1936 -> 1918  (-0.93%)

expvar
expvar.appendJSONQuote 972 -> 965  (-0.72%)

cmd/cgo/internal/test
cmd/cgo/internal/test.stack128 116 -> 114  (-1.72%)

cmd/vendor/rsc.io/markdown
cmd/vendor/rsc.io/markdown.newATXHeading 1637 -> 1628  (-0.55%)
cmd/vendor/rsc.io/markdown.isUnicodePunct 197 -> 179  (-9.14%)

Change-Id: I578bdf42ef229d687d526e378d697ced51e1880c
Reviewed-on: https://go-review.googlesource.com/c/go/+/639935
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Keith Randall <khr@google.com>
6 months agoruntime/maps: fix typo in group.go comment (H1 -> H2)
Artyom Litovets [Fri, 14 Feb 2025 12:03:06 +0000 (12:03 +0000)]
runtime/maps: fix typo in group.go comment (H1 -> H2)

Fixes a typo to correctly describe the hash bits of the control word.

Change-Id: Id3c2ae0bd529e579a95258845f9d8028e23d10d2
GitHub-Last-Rev: 1baa81be5d292d5625d5d7788b8ea090453f962c
GitHub-Pull-Request: golang/go#71730
Reviewed-on: https://go-review.googlesource.com/c/go/+/649416
Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
6 months agocrypto/internal/boring: remove unnecessary struct field
Roland Shoemaker [Fri, 24 Jan 2025 20:27:08 +0000 (12:27 -0800)]
crypto/internal/boring: remove unnecessary struct field

That could result in a hanging pointer.

Change-Id: I547950a3d3010e03b75f70f5f021f20124e2cef0
Reviewed-on: https://go-review.googlesource.com/c/go/+/644120
Auto-Submit: Roland Shoemaker <roland@golang.org>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
6 months agostd: add //go:fix inline directives to some deprecated functions
Alan Donovan [Wed, 12 Feb 2025 16:18:30 +0000 (11:18 -0500)]
std: add //go:fix inline directives to some deprecated functions

In particular, we apply it only to functions where it is always
a code improvement to inline the call.
We also apply it to some constants.

In a few cases this may introduce a panic statement at the
caller, which is debatable, but making the potential for panic
evident is the purpose of the deprecation.

The gofix analyzer in gopls v0.18 will show a diagnostic for calls
to the annotated functions, and will offer to inline the call.

The new //go:fix annotation needs a special exemption in the
pragma check in the compiler.

Updates #32816

Change-Id: I43bf15648ac12251734109eb7102394f8a76d55e
Reviewed-on: https://go-review.googlesource.com/c/go/+/648995
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Commit-Queue: Alan Donovan <adonovan@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Auto-Submit: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

6 months agocmd/compile: fix sign extension of paired 32-bit loads on arm64
Keith Randall [Sat, 15 Feb 2025 00:13:44 +0000 (16:13 -0800)]
cmd/compile: fix sign extension of paired 32-bit loads on arm64

Fixes #71759

Change-Id: Iab05294ac933cc9972949158d3fe2bdc3073df5e
Reviewed-on: https://go-review.googlesource.com/c/go/+/649895
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
6 months agocrypto/internal/fips140/subtle: provide riscv64 assembly implementation for xorBytes
Joel Sing [Fri, 3 Jan 2025 08:06:18 +0000 (19:06 +1100)]
crypto/internal/fips140/subtle: provide riscv64 assembly implementation for xorBytes

Provide a riscv64 assembly implementation of xorBytes, which
can process up to 64 bytes per loop and has better handling
for unaligned inputs. This provides a considerable performance
gain compared to the generic code.

On a StarFive VisionFive 2:

                                     │   subtle.1   │              subtle.2               │
                                     │    sec/op    │   sec/op     vs base                │
XORBytes/8Bytes-4                       59.54n ± 0%   58.15n ± 0%   -2.33% (p=0.000 n=10)
XORBytes/128Bytes-4                    125.60n ± 0%   74.93n ± 0%  -40.35% (p=0.000 n=10)
XORBytes/2048Bytes-4                   1088.5n ± 0%   602.4n ± 0%  -44.66% (p=0.000 n=10)
XORBytes/8192Bytes-4                    4.163µ ± 0%   2.271µ ± 0%  -45.45% (p=0.000 n=10)
XORBytes/32768Bytes-4                   35.47µ ± 0%   28.12µ ± 0%  -20.74% (p=0.000 n=10)
XORBytesUnaligned/8Bytes0Offset-4       59.80n ± 0%   57.48n ± 0%   -3.86% (p=0.000 n=10)
XORBytesUnaligned/8Bytes1Offset-4       72.97n ± 0%   57.48n ± 0%  -21.23% (p=0.000 n=10)
XORBytesUnaligned/8Bytes2Offset-4       72.97n ± 0%   57.50n ± 0%  -21.21% (p=0.000 n=10)
XORBytesUnaligned/8Bytes3Offset-4       72.99n ± 0%   57.48n ± 0%  -21.26% (p=0.000 n=10)
XORBytesUnaligned/8Bytes4Offset-4       72.96n ± 0%   57.44n ± 0%  -21.28% (p=0.000 n=10)
XORBytesUnaligned/8Bytes5Offset-4       72.93n ± 0%   57.48n ± 0%  -21.18% (p=0.000 n=10)
XORBytesUnaligned/8Bytes6Offset-4       72.97n ± 0%   57.47n ± 0%  -21.25% (p=0.000 n=10)
XORBytesUnaligned/8Bytes7Offset-4       72.96n ± 0%   57.47n ± 0%  -21.24% (p=0.000 n=10)
XORBytesUnaligned/128Bytes0Offset-4    125.30n ± 0%   74.18n ± 0%  -40.80% (p=0.000 n=10)
XORBytesUnaligned/128Bytes1Offset-4     557.4n ± 0%   131.1n ± 0%  -76.48% (p=0.000 n=10)
XORBytesUnaligned/128Bytes2Offset-4     557.3n ± 0%   132.5n ± 0%  -76.22% (p=0.000 n=10)
XORBytesUnaligned/128Bytes3Offset-4     557.6n ± 0%   133.7n ± 0%  -76.02% (p=0.000 n=10)
XORBytesUnaligned/128Bytes4Offset-4     557.4n ± 0%   125.0n ± 0%  -77.57% (p=0.000 n=10)
XORBytesUnaligned/128Bytes5Offset-4     557.7n ± 0%   125.7n ± 0%  -77.46% (p=0.000 n=10)
XORBytesUnaligned/128Bytes6Offset-4     557.5n ± 0%   127.0n ± 0%  -77.22% (p=0.000 n=10)
XORBytesUnaligned/128Bytes7Offset-4     557.7n ± 0%   128.3n ± 0%  -76.99% (p=0.000 n=10)
XORBytesUnaligned/2048Bytes0Offset-4   1088.5n ± 0%   601.9n ± 0%  -44.71% (p=0.000 n=10)
XORBytesUnaligned/2048Bytes1Offset-4   8243.0n ± 0%   655.7n ± 0%  -92.05% (p=0.000 n=10)
XORBytesUnaligned/2048Bytes2Offset-4   8244.0n ± 0%   657.1n ± 0%  -92.03% (p=0.000 n=10)
XORBytesUnaligned/2048Bytes3Offset-4   8247.5n ± 0%   658.7n ± 0%  -92.01% (p=0.000 n=10)
XORBytesUnaligned/2048Bytes4Offset-4   8243.0n ± 0%   649.8n ± 0%  -92.12% (p=0.000 n=10)
XORBytesUnaligned/2048Bytes5Offset-4   8247.0n ± 0%   650.2n ± 0%  -92.12% (p=0.000 n=10)
XORBytesUnaligned/2048Bytes6Offset-4   8243.0n ± 0%   651.6n ± 0%  -92.09% (p=0.000 n=10)
XORBytesUnaligned/2048Bytes7Offset-4   8244.0n ± 0%   652.8n ± 0%  -92.08% (p=0.000 n=10)
geomean                                 410.1n        147.2n       -64.10%

                                     │   subtle.1   │                subtle.2                 │
                                     │     B/s      │      B/s       vs base                  │
XORBytes/8Bytes-4                      128.1Mi ± 0%    131.2Mi ± 0%     +2.40% (p=0.000 n=10)
XORBytes/128Bytes-4                    971.6Mi ± 0%   1629.2Mi ± 0%    +67.69% (p=0.000 n=10)
XORBytes/2048Bytes-4                   1.752Gi ± 0%    3.166Gi ± 0%    +80.68% (p=0.000 n=10)
XORBytes/8192Bytes-4                   1.833Gi ± 0%    3.360Gi ± 0%    +83.35% (p=0.000 n=10)
XORBytes/32768Bytes-4                  881.0Mi ± 0%   1111.5Mi ± 0%    +26.16% (p=0.000 n=10)
XORBytesUnaligned/8Bytes0Offset-4      127.6Mi ± 0%    132.7Mi ± 0%     +4.02% (p=0.000 n=10)
XORBytesUnaligned/8Bytes1Offset-4      104.5Mi ± 0%    132.7Mi ± 0%    +26.95% (p=0.000 n=10)
XORBytesUnaligned/8Bytes2Offset-4      104.6Mi ± 0%    132.7Mi ± 0%    +26.92% (p=0.000 n=10)
XORBytesUnaligned/8Bytes3Offset-4      104.5Mi ± 0%    132.8Mi ± 0%    +27.01% (p=0.000 n=10)
XORBytesUnaligned/8Bytes4Offset-4      104.6Mi ± 0%    132.8Mi ± 0%    +27.02% (p=0.000 n=10)
XORBytesUnaligned/8Bytes5Offset-4      104.6Mi ± 0%    132.7Mi ± 0%    +26.89% (p=0.000 n=10)
XORBytesUnaligned/8Bytes6Offset-4      104.5Mi ± 0%    132.8Mi ± 0%    +26.99% (p=0.000 n=10)
XORBytesUnaligned/8Bytes7Offset-4      104.6Mi ± 0%    132.8Mi ± 0%    +26.97% (p=0.000 n=10)
XORBytesUnaligned/128Bytes0Offset-4    974.4Mi ± 0%   1645.7Mi ± 0%    +68.90% (p=0.000 n=10)
XORBytesUnaligned/128Bytes1Offset-4    219.0Mi ± 0%    931.3Mi ± 0%   +325.23% (p=0.000 n=10)
XORBytesUnaligned/128Bytes2Offset-4    219.0Mi ± 0%    921.2Mi ± 0%   +320.57% (p=0.000 n=10)
XORBytesUnaligned/128Bytes3Offset-4    218.9Mi ± 0%    912.9Mi ± 0%   +316.97% (p=0.000 n=10)
XORBytesUnaligned/128Bytes4Offset-4    219.0Mi ± 0%    976.4Mi ± 0%   +345.85% (p=0.000 n=10)
XORBytesUnaligned/128Bytes5Offset-4    218.9Mi ± 0%    971.2Mi ± 0%   +343.70% (p=0.000 n=10)
XORBytesUnaligned/128Bytes6Offset-4    219.0Mi ± 0%    961.1Mi ± 0%   +338.86% (p=0.000 n=10)
XORBytesUnaligned/128Bytes7Offset-4    218.9Mi ± 0%    951.1Mi ± 0%   +334.52% (p=0.000 n=10)
XORBytesUnaligned/2048Bytes0Offset-4   1.752Gi ± 0%    3.169Gi ± 0%    +80.83% (p=0.000 n=10)
XORBytesUnaligned/2048Bytes1Offset-4   236.9Mi ± 0%   2978.6Mi ± 0%  +1157.10% (p=0.000 n=10)
XORBytesUnaligned/2048Bytes2Offset-4   236.9Mi ± 0%   2972.1Mi ± 0%  +1154.48% (p=0.000 n=10)
XORBytesUnaligned/2048Bytes3Offset-4   236.8Mi ± 0%   2965.1Mi ± 0%  +1152.05% (p=0.000 n=10)
XORBytesUnaligned/2048Bytes4Offset-4   236.9Mi ± 0%   3005.9Mi ± 0%  +1168.65% (p=0.000 n=10)
XORBytesUnaligned/2048Bytes5Offset-4   236.8Mi ± 0%   3004.0Mi ± 0%  +1168.42% (p=0.000 n=10)
XORBytesUnaligned/2048Bytes6Offset-4   236.9Mi ± 0%   2997.2Mi ± 0%  +1164.96% (p=0.000 n=10)
XORBytesUnaligned/2048Bytes7Offset-4   236.9Mi ± 0%   2991.9Mi ± 0%  +1162.93% (p=0.000 n=10)
geomean                                260.4Mi         806.7Mi        +209.73%

Change-Id: I9bec9c8f48df7284f8414ac745615c2a093e9ae9
Reviewed-on: https://go-review.googlesource.com/c/go/+/639858
Reviewed-by: Mark Ryan <markdryan@rivosinc.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Meng Zhuo <mengzhuo1203@gmail.com>
TryBot-Bypass: Joel Sing <joel@sing.id.au>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
6 months agoos: explicitly return nil for rootChown in root_openat.go
Jes Cok [Fri, 14 Feb 2025 13:50:24 +0000 (13:50 +0000)]
os: explicitly return nil for rootChown in root_openat.go

It is consistent with the same function in root_noopenat.go.

Change-Id: I6ddbf4dfcc725cb2023bc6bed961cc525b9c43d2
GitHub-Last-Rev: 0802150a6a8e5d4bd395b702ecc518df1e8dd4c0
GitHub-Pull-Request: golang/go#71743
Reviewed-on: https://go-review.googlesource.com/c/go/+/649417
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>

6 months agocmd/internal/obj/riscv: support MOVD with floating point constants
Joel Sing [Mon, 1 Jul 2024 14:31:53 +0000 (00:31 +1000)]
cmd/internal/obj/riscv: support MOVD with floating point constants

Currently, we only support loading of values from memory (or other
registers). Add floating point constant support to MOVD. This is
implemented by storing the floating point constant to a symbol,
which is then loaded into the floating point register.

Change-Id: I6db242d27f606f0d5d084a3ab93538698d3a4f8c
Reviewed-on: https://go-review.googlesource.com/c/go/+/631876
Reviewed-by: Meng Zhuo <mengzhuo1203@gmail.com>
Reviewed-by: Mark Ryan <markdryan@rivosinc.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

6 months agoruntime: use return for async preemption resumption on arm64
Joel Sing [Wed, 5 Feb 2025 13:38:51 +0000 (00:38 +1100)]
runtime: use return for async preemption resumption on arm64

Use return with register for async preemption resumption on arm64.
This has the same behaviour as the current use of JMP, however
is permitted when Branch Target Identification is being enforced,
while a JMP with register is considered an indirect call and
requires a `BTI J` marker at the resumption address.

Updates #66054

Change-Id: I135ac577073467bedd9efd8df15b76c97dc08767
Reviewed-on: https://go-review.googlesource.com/c/go/+/646782
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
6 months agocmd/go/internal: use pathpkg name more
cuishuang [Thu, 21 Nov 2024 09:14:21 +0000 (17:14 +0800)]
cmd/go/internal: use pathpkg name more

The package "path" is already imported under the name pathpkg and used
many times in these files. It's not worth it to also make it available
under the name path, so keep using pathpkg.

Change-Id: I7f8fa7a11de338b9a7c0f58a48d5af68b5639cfe
Reviewed-on: https://go-review.googlesource.com/c/go/+/630475
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Sam Thanawalla <samthanawalla@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
6 months agocrypto/internal/fips140/edwards25519: make Scalar.SetCanonicalBytes constant time
Filippo Valsorda [Mon, 10 Feb 2025 10:30:52 +0000 (11:30 +0100)]
crypto/internal/fips140/edwards25519: make Scalar.SetCanonicalBytes constant time

Internally we only use SetCanonicalBytes as part of Ed25519
verification, where all inputs are public, so it doesn't need to be
constant time.

However, this code is replicated outside of the standard library. Even
there, an attack is not practical, so this should not be considered a
security vulnerability:

  - For specific scalars, this only leaks at most four bits of
    information, and always the same four bits (so it's not an adaptive
    attack).

  - For derived scalars, assuming they are valid and uniformly
    distributed, the loop would return true on the first iteration with
    probability (1 - 2⁻¹²⁷) due to the shape of the scalar field order.

Still, making it constant time is easy enough and saves the next person
from having to think about it.

This was previously reported by Yawning Angel, and then as part of a
security audit.

Change-Id: I6a6a46563c8abecb0b4a6f12033a71c4c4da6fa7
Reviewed-on: https://go-review.googlesource.com/c/go/+/648035
Reviewed-by: Roland Shoemaker <roland@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Filippo Valsorda <filippo@golang.org>

6 months agointernal/godebugs: add fips140 as an opaque godebug setting
Ian Lance Taylor [Thu, 13 Feb 2025 22:40:01 +0000 (14:40 -0800)]
internal/godebugs: add fips140 as an opaque godebug setting

This permits using "godebug fips140=on" in go.mod and
using "//go:debug fips140=on" in the main package.

Change code references to the godebug setting to remove the #
which is no longer required.

For #71666

Change-Id: I3a60ecc55b03848dadd6d431eb43137b6df6568b
Reviewed-on: https://go-review.googlesource.com/c/go/+/649495
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
6 months agocrypto/rsa: add benchmarks for not and partially optimized keys
Filippo Valsorda [Tue, 17 Dec 2024 19:40:49 +0000 (20:40 +0100)]
crypto/rsa: add benchmarks for not and partially optimized keys

Updates #59695

Change-Id: I7944195c805cd9da819cdf2bd49ecb2423ccd73b
Reviewed-on: https://go-review.googlesource.com/c/go/+/637178
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Roland Shoemaker <roland@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Daniel McCarney <daniel@binaryparadox.net>
6 months agodoc/godebug: mention GODEBUG=fips140
Ian Lance Taylor [Tue, 11 Feb 2025 23:53:20 +0000 (15:53 -0800)]
doc/godebug: mention GODEBUG=fips140

Fixes #71666

Change-Id: Ice816cf2943c5b6660f05934b4c7ca38545714b0
Reviewed-on: https://go-review.googlesource.com/c/go/+/648520
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Commit-Queue: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
6 months agocmd/compile: add type-based alias analysis
Andrey Bokhanko [Wed, 27 Nov 2024 17:47:58 +0000 (20:47 +0300)]
cmd/compile: add type-based alias analysis

Make ssa.disjoint call ssa.disjointTypes to disambiguate Values based on
their types. Only one type-based rule is employed: a Type can't alias
with a pointer (https://pkg.go.dev/unsafe#Pointer).

Fixes #70488

Change-Id: I5a7e75292c2b6b5a01fb9048e3e2360e31dbcdd9
Reviewed-on: https://go-review.googlesource.com/c/go/+/632176
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Keith Randall <khr@google.com>
6 months agobytes: add examples for Lines, SplitSeq, SplitAfterSeq, FieldsSeq and FieldsFuncSeq
cuishuang [Thu, 13 Feb 2025 07:28:21 +0000 (15:28 +0800)]
bytes: add examples for Lines, SplitSeq, SplitAfterSeq, FieldsSeq and FieldsFuncSeq

Change-Id: I0e755d5c73f14d2c98853bdd31a7f2e84c92a906
Reviewed-on: https://go-review.googlesource.com/c/go/+/648860
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

6 months agointernal/syscall/unix: correct fchmodat on openbsd
Joel Sing [Fri, 14 Feb 2025 17:45:04 +0000 (04:45 +1100)]
internal/syscall/unix: correct fchmodat on openbsd

This is incorrectly calling the fchownat trampoline - call fchmodat
as intended.

Change-Id: I7b1e758d456006303ca95b70df9e6b52d3020158
Reviewed-on: https://go-review.googlesource.com/c/go/+/649655
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Bypass: Damien Neil <dneil@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
Commit-Queue: Damien Neil <dneil@google.com>
Auto-Submit: Damien Neil <dneil@google.com>

6 months agosyscall: skip testAmbientCaps tests if there is no nobody user
Carlos Ramos Carreño [Fri, 14 Feb 2025 10:14:29 +0000 (10:14 +0000)]
syscall: skip testAmbientCaps tests if there is no nobody user

When there is not a nobody user (for example inside Docker), the
tests TestAmbientCaps and TestAmbientCapsUserns should be skipped
instead of failing.

Fixes #71644

Change-Id: I7f92db19e2b6f449d8d897650a0ecd89f5150f4a
GitHub-Last-Rev: a4c4f5bb61929b4981dc0b92d773bd4ef13d7d3d
GitHub-Pull-Request: golang/go#71729
Reviewed-on: https://go-review.googlesource.com/c/go/+/649396
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Carlos Amedee <carlos@golang.org>
6 months agointernal/syscall/unix: fix fchownat linkname for AIX & Solaris
Damien Neil [Fri, 14 Feb 2025 17:06:21 +0000 (09:06 -0800)]
internal/syscall/unix: fix fchownat linkname for AIX & Solaris

Typo fix: libc_chownat => libc_fchownat

Change-Id: I6721a988c19e3438b967a73559159c948ed51a0e
Reviewed-on: https://go-review.googlesource.com/c/go/+/649636
Auto-Submit: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
6 months agonet/http: use runtime.AddCleanup instead of runtime.SetFinalizer
Carlos Amedee [Tue, 11 Feb 2025 20:50:55 +0000 (15:50 -0500)]
net/http: use runtime.AddCleanup instead of runtime.SetFinalizer

Replace the usage of runtime.SetFinalizer with runtime.AddCleanup in
tests.

Updates #70907

Change-Id: Idd3f1c07f6a7709352ca09948fbcb4a0ad9418bb
Reviewed-on: https://go-review.googlesource.com/c/go/+/648655
Auto-Submit: Carlos Amedee <carlos@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

6 months agointernal/trace: emit sync event before deferred spilled error
Michael Anthony Knyszek [Thu, 13 Feb 2025 19:45:52 +0000 (19:45 +0000)]
internal/trace: emit sync event before deferred spilled error

CL 648315 and CL 648195 fixed #71615 in the case where we fail to read
the next generation by emitting an extra sync event before returning an
error. But, it's possible we failed to even read the next spilled batch
when we read the first generation, and have been carrying the error from
trying to read a spilled batch since the last generation. In this case,
we don't emit a final sync event, meaning that there are still some
cases where #71615 happens.

This change emits the final sync event in this corner case. I believe
this is the final corner case. I could previously reproduce the issue
by running the test under stress2, but I can no longer reproduce any
failures after this change.

Fixes #71615, for real this time.

Change-Id: I10688a3c0e4b8327a95f31add365338c77c091ab
Reviewed-on: https://go-review.googlesource.com/c/go/+/649259
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

6 months agocrypto/rsa: normalize GenerateKey benchmark
Filippo Valsorda [Sat, 28 Dec 2024 21:32:59 +0000 (22:32 +0100)]
crypto/rsa: normalize GenerateKey benchmark

Benchmarking key generation is a pain. The number of random candidates
explored before finding a prime varies greatly, and on top of that some
rejections happen in the trial divisions step and some in the
Miller-Rabin step.

However, we can calculate on average how many candidates we should
reject before finding a prime, and of those how many should be divisible
by small primes. (And even the number of multiplications in a
Miller-Rabin iteration.) The new checked in sequence of candidates is
normalized to represent the average case.

It doesn't normalize the runtime of GCD, but running the benchmark with
20 different randomly generated "average cases" produces very consistent
results, so it must not matter much.

goos: darwin
goarch: arm64
pkg: crypto/rsa
cpu: Apple M2
                   │  regen.txt  │
                   │   sec/op    │
GenerateKey/2048-8   136.4m ± 0%

Changed slightly the excess masking in keygen.go to make it easier to
feed fixed candidates. This might also make it easier to share test
vectors in the future.

Change-Id: I66696c693f35da7bda27db537aa3bf3b991e970e
Reviewed-on: https://go-review.googlesource.com/c/go/+/639335
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Daniel McCarney <daniel@binaryparadox.net>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

6 months agonet/http: unskip TestDisableContentLength/h2
Dmitri Shuralyov [Fri, 14 Feb 2025 00:15:49 +0000 (19:15 -0500)]
net/http: unskip TestDisableContentLength/h2

h2_bundle.go has been updated.

Change-Id: I055b8db9aab964621c980e4731011c89f7694405
Reviewed-on: https://go-review.googlesource.com/c/go/+/649496
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>

6 months agocmd/go: use runtime.AddCleanup instead of runtime.SetFinalizer
Carlos Amedee [Mon, 6 Jan 2025 18:15:51 +0000 (13:15 -0500)]
cmd/go: use runtime.AddCleanup instead of runtime.SetFinalizer

Replace the usage of runtime.SetFinalizer with runtime.AddCleanup.
This changes a test and how when the Go command panics when a file is
left locked.

Updates #70907

Change-Id: I8d8c56d16486728f9bd4b910b81796ae506bda74
Reviewed-on: https://go-review.googlesource.com/c/go/+/640736
Reviewed-by: Sam Thanawalla <samthanawalla@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

6 months agosync: use runtime.AddCleanup instead of runtime.SetFinalizer
Carlos Amedee [Mon, 6 Jan 2025 17:59:07 +0000 (12:59 -0500)]
sync: use runtime.AddCleanup instead of runtime.SetFinalizer

This changes the use of finalizers to the cleanup implementation in
tests.

Updates #70907

Change-Id: I7d7289999a83fa53f538698f34294f7d9651c921
Reviewed-on: https://go-review.googlesource.com/c/go/+/640735
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

6 months agocmd/asm,cmd/internal/obj/riscv: implement vector configuration setting instructions
Joel Sing [Sun, 24 Nov 2024 01:39:20 +0000 (12:39 +1100)]
cmd/asm,cmd/internal/obj/riscv: implement vector configuration setting instructions

Implement vector configuration setting instructions (VSETVLI,
VSETIVLI, VSETL).  These allow the vector length (vl) and vector
type (vtype) CSRs to be configured via a single instruction.
Unfortunately each instruction has its own dedicated encoding.

In the case of VSETVLI/VSETIVLI, the vector type is specified via
a series of special operands, which specify the selected element
width (E8, E16, E32, E64), the vector register group multiplier
(M1, M2, M4, M8, MF2, MF4, MF8), the vector tail policy (TU, TA)
and vector mask policy (MU, MA). Note that the order of these
special operands matches non-Go assemblers.

Partially based on work by Pengcheng Wang <wangpengcheng.pp@bytedance.com>.

Cq-Include-Trybots: luci.golang.try:gotip-linux-riscv64
Change-Id: I431f59c1e048a3e84754f0643a963da473a741fe
Reviewed-on: https://go-review.googlesource.com/c/go/+/631936
Reviewed-by: Mark Ryan <markdryan@rivosinc.com>
Reviewed-by: Meng Zhuo <mengzhuo1203@gmail.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
6 months agocmd/dist: use slices.Index
qiulaidongfeng [Wed, 12 Feb 2025 16:41:13 +0000 (00:41 +0800)]
cmd/dist: use slices.Index

Change-Id: Ifcab176faa2ac55e60576cf6acd96a18d0e860ab
Reviewed-on: https://go-review.googlesource.com/c/go/+/648859
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>

6 months agotesting: panic in AllocsPerRun if parallel tests are running
Russ Cox [Wed, 20 Nov 2024 16:01:27 +0000 (11:01 -0500)]
testing: panic in AllocsPerRun if parallel tests are running

If other tests are running, AllocsPerRun's result will be inherently flaky.
Saw this with CL 630136 and #70327.

Proposed in #70464.

Fixes #70464.

Change-Id: I190afdf26bc31299f6e5e8665b4fb420ffd554ee
Reviewed-on: https://go-review.googlesource.com/c/go/+/630137
Auto-Submit: Russ Cox <rsc@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
6 months agocmd/link,cmd/internal: add R_GOT_PCREL_ITYPE_RELOC for riscv64
Meng Zhuo [Thu, 12 Sep 2024 12:03:59 +0000 (20:03 +0800)]
cmd/link,cmd/internal: add R_GOT_PCREL_ITYPE_RELOC for riscv64

This CL adds new relocation type for riscv64: R_GOT_PCREL_ITYPE_RELOC
which generate an AUIPC + I-type pair with relocation type of GOT_HI20
and PCREL_LO12_I.
According to RISCV elf psabi doc, medium position independent code
model, the GNU as example is:

```
# Calculate address of non-local symbol
.Ltmp3: aupipc a0, %got_pcrel_hi(symbol)
ld a0, %pcrel_lo(.Ltmp3)(a0)
```

Change-Id: I719dd05e009ca2d9291f0689b346c059f9c56918
Reviewed-on: https://go-review.googlesource.com/c/go/+/612635
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Joel Sing <joel@sing.id.au>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

6 months agonet/http, net/http/internal/httpcommon: add httpcommon package
Damien Neil [Thu, 13 Feb 2025 22:38:09 +0000 (14:38 -0800)]
net/http, net/http/internal/httpcommon: add httpcommon package

The golang.org/x/net/internal/httpcommon package is
a new package containing internal functions common to the
HTTP/2 and HTTP/3 implementations.

Update to golang.org/x/net@v0.35.1-0.20250213222735-884432780bfd,
which includes the httpcommon package.

Since net/http can't depend on a x/net/internal package,
add net/http/internal/httpcommon which bundles the x/net
package.

Change-Id: Iba6c4be7b3e2d9a9d79c4b5153497b0e04b4497b
Reviewed-on: https://go-review.googlesource.com/c/go/+/649296
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
6 months agoos: add Root.Chown
Damien Neil [Mon, 10 Feb 2025 23:35:17 +0000 (15:35 -0800)]
os: add Root.Chown

For #67002

Change-Id: I546537618cbe32217fa72264d49db2b1a1d3b6db
Reviewed-on: https://go-review.googlesource.com/c/go/+/648295
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Damien Neil <dneil@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
6 months agocmd/compile: make write barrier code amenable to paired loads/stores
Keith Randall [Sun, 24 Nov 2024 01:35:02 +0000 (17:35 -0800)]
cmd/compile: make write barrier code amenable to paired loads/stores

It currently isn't because it does load/store/load/store/...
Rework to do overwrite processing in pairs so it is instead
load/load/store/store/...

Change-Id: If7be629bc4048da5f2386dafb8f05759b79e9e2b
Reviewed-on: https://go-review.googlesource.com/c/go/+/631495
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

6 months agocmd/compile: regalloc: handle desired registers of 2-output insns
Keith Randall [Sat, 23 Nov 2024 18:58:47 +0000 (10:58 -0800)]
cmd/compile: regalloc: handle desired registers of 2-output insns

Particularly with 2-word load instructions, this becomes important.
Classic example is:

    func f(p *string) string {
        return *p
    }

We want the two loads to put the return values directly into
the two ABI return registers.

At this point in the stack, cmd/go is 1.1% smaller.

Change-Id: I51fd1710238e81d15aab2bfb816d73c8e7c207b1
Reviewed-on: https://go-review.googlesource.com/c/go/+/631137
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

6 months agocmd/compile: pair loads and stores on arm64
khr@golang.org [Sun, 17 Nov 2024 20:07:34 +0000 (12:07 -0800)]
cmd/compile: pair loads and stores on arm64

Look for possible paired load/store operations on arm64.
I don't expect this would be a lot faster, but it will save
binary space, and indirectly through the icache at least a bit
of time.

Change-Id: I4dd73b0e6329c4659b7453998f9b75320fcf380b
Reviewed-on: https://go-review.googlesource.com/c/go/+/629256
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
6 months agocmd/compile: add variants of LDP/STP for arm64 load/store combining
khr@golang.org [Mon, 18 Nov 2024 00:42:37 +0000 (16:42 -0800)]
cmd/compile: add variants of LDP/STP for arm64 load/store combining

These will be used in a subsequent CL.

Change-Id: I96562668da502e5cb41096c9831c59292644be72
Reviewed-on: https://go-review.googlesource.com/c/go/+/629255
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

6 months agoos: explicitly return nil for {rootChmod,rootMkdir,rootRemove} in root_openat.go
Jes Cok [Thu, 13 Feb 2025 16:02:20 +0000 (16:02 +0000)]
os: explicitly return nil for {rootChmod,rootMkdir,rootRemove} in root_openat.go

It is consistent with same functions in root_noopenat.go.

Change-Id: I81415fd3922101499fcbbdec97e315add0671acb
GitHub-Last-Rev: 3444e8546ee1877feb644202ad2b05379b4b7e74
GitHub-Pull-Request: golang/go#71715
Reviewed-on: https://go-review.googlesource.com/c/go/+/649235
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

6 months agoos: consolidate and clarify File.Fd docs
Ian Lance Taylor [Tue, 11 Feb 2025 20:56:27 +0000 (12:56 -0800)]
os: consolidate and clarify File.Fd docs

Change-Id: Id062b969fe7d6908a0797b36a4a379e4d46ba557
Reviewed-on: https://go-review.googlesource.com/c/go/+/648516
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
6 months agocmd/compile: move []byte->string map key optimization to ssa
Keith Randall [Mon, 6 Jan 2025 23:28:22 +0000 (15:28 -0800)]
cmd/compile: move []byte->string map key optimization to ssa

If we call slicebytetostring immediately (with no intervening writes)
before calling map access or delete functions with the resulting
string as the key, then we can just use the ptr/len of the
slicebytetostring argument as the key. This avoids an allocation.

Fixes #44898
Update #71132

There's old code in cmd/compile/internal/walk/order.go that handles
some of these cases.

1. m[string(b)]
2. s := string(b); m[s]
3. m[[2]string{string(b1),string(b2)}]

The old code handled cases 1&3. The new code handles cases 1&2.
We'll leave the old code around to keep 3 working, although it seems
not terribly common.

Case 2 happens particularly after inlining, so it is pretty common.

Change-Id: I8913226ca79d2c65f4e2bd69a38ac8c976a57e43
Reviewed-on: https://go-review.googlesource.com/c/go/+/640656
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

6 months agocmd/compile: lower x*z + y to FMA if FMA enabled
Jakub Ciolek [Sun, 2 Feb 2025 22:42:43 +0000 (23:42 +0100)]
cmd/compile: lower x*z + y to FMA if FMA enabled

There is a generic opcode for FMA, but we don't use it in rewrite rules.
This is maybe because some archs, like WASM and MIPS don't have a late
lowering rule for it.

Fixes #71204

Intel Alder Lake 12600k (GOAMD64=v3):

math:

name                    old time/op  new time/op  delta
Acos-16                 4.58ns ± 0%  3.36ns ± 0%  -26.68%  (p=0.008 n=5+5)
Acosh-16                8.04ns ± 1%  6.44ns ± 0%  -19.95%  (p=0.008 n=5+5)
Asin-16                 4.28ns ± 0%  3.32ns ± 0%  -22.24%  (p=0.008 n=5+5)
Asinh-16                9.92ns ± 0%  8.62ns ± 0%  -13.13%  (p=0.008 n=5+5)
Atan-16                 2.31ns ± 0%  1.84ns ± 0%  -20.02%  (p=0.008 n=5+5)
Atanh-16                7.79ns ± 0%  7.03ns ± 0%   -9.67%  (p=0.008 n=5+5)
Atan2-16                3.93ns ± 0%  3.52ns ± 0%  -10.35%  (p=0.000 n=5+4)
Cbrt-16                 4.62ns ± 0%  4.41ns ± 0%   -4.57%  (p=0.016 n=4+5)
Ceil-16                 0.14ns ± 1%  0.14ns ± 2%     ~     (p=0.103 n=5+5)
Copysign-16             0.33ns ± 0%  0.33ns ± 0%   +0.03%  (p=0.029 n=4+4)
Cos-16                  4.87ns ± 0%  4.75ns ± 0%   -2.44%  (p=0.016 n=5+4)
Cosh-16                 4.86ns ± 0%  4.86ns ± 0%     ~     (p=0.317 n=5+5)
Erf-16                  2.71ns ± 0%  2.25ns ± 0%  -16.69%  (p=0.008 n=5+5)
Erfc-16                 3.06ns ± 0%  2.67ns ± 0%  -13.00%  (p=0.016 n=5+4)
Erfinv-16               3.88ns ± 0%  2.84ns ± 3%  -26.83%  (p=0.008 n=5+5)
Erfcinv-16              4.08ns ± 0%  3.01ns ± 1%  -26.27%  (p=0.008 n=5+5)
Exp-16                  3.29ns ± 0%  3.37ns ± 2%   +2.64%  (p=0.016 n=4+5)
ExpGo-16                8.44ns ± 0%  7.48ns ± 1%  -11.37%  (p=0.008 n=5+5)
Expm1-16                4.46ns ± 0%  3.69ns ± 2%  -17.26%  (p=0.016 n=4+5)
Exp2-16                 8.20ns ± 0%  7.39ns ± 2%   -9.94%  (p=0.008 n=5+5)
Exp2Go-16               8.26ns ± 0%  7.23ns ± 0%  -12.49%  (p=0.016 n=4+5)
Abs-16                  0.26ns ± 3%  0.22ns ± 1%  -16.34%  (p=0.008 n=5+5)
Dim-16                  0.38ns ± 1%  0.40ns ± 2%   +5.02%  (p=0.008 n=5+5)
Floor-16                0.11ns ± 1%  0.17ns ± 4%  +54.99%  (p=0.008 n=5+5)
Max-16                  1.24ns ± 0%  1.24ns ± 0%     ~     (p=0.619 n=5+5)
Min-16                  1.24ns ± 0%  1.24ns ± 0%     ~     (p=0.484 n=5+5)
Mod-16                  13.4ns ± 1%  12.8ns ± 0%   -4.21%  (p=0.016 n=5+4)
Frexp-16                1.70ns ± 0%  1.71ns ± 0%   +0.46%  (p=0.008 n=5+5)
Gamma-16                3.97ns ± 0%  3.97ns ± 0%     ~     (p=0.643 n=5+5)
Hypot-16                2.11ns ± 0%  2.11ns ± 0%     ~     (p=0.762 n=5+5)
HypotGo-16              2.48ns ± 4%  2.26ns ± 0%   -8.94%  (p=0.008 n=5+5)
Ilogb-16                1.67ns ± 0%  1.67ns ± 0%   -0.07%  (p=0.048 n=5+5)
J0-16                   19.8ns ± 0%  19.3ns ± 0%     ~     (p=0.079 n=4+5)
J1-16                   19.4ns ± 0%  18.9ns ± 0%   -2.63%  (p=0.000 n=5+4)
Jn-16                   41.5ns ± 0%  40.6ns ± 0%   -2.32%  (p=0.016 n=4+5)
Ldexp-16                2.26ns ± 0%  2.26ns ± 0%     ~     (p=0.683 n=5+5)
Lgamma-16               4.40ns ± 0%  4.21ns ± 0%   -4.21%  (p=0.008 n=5+5)
Log-16                  4.05ns ± 0%  4.05ns ± 0%     ~     (all equal)
Logb-16                 1.69ns ± 0%  1.69ns ± 0%     ~     (p=0.429 n=5+5)
Log1p-16                5.00ns ± 0%  3.99ns ± 0%  -20.14%  (p=0.008 n=5+5)
Log10-16                4.22ns ± 0%  4.21ns ± 0%   -0.15%  (p=0.008 n=5+5)
Log2-16                 2.27ns ± 0%  2.25ns ± 0%   -0.94%  (p=0.008 n=5+5)
Modf-16                 1.44ns ± 0%  1.44ns ± 0%     ~     (p=0.492 n=5+5)
Nextafter32-16          2.09ns ± 0%  2.09ns ± 0%     ~     (p=0.079 n=4+5)
Nextafter64-16          2.09ns ± 0%  2.09ns ± 0%     ~     (p=0.095 n=4+5)
PowInt-16               10.8ns ± 0%  10.8ns ± 0%     ~     (all equal)
PowFrac-16              25.3ns ± 0%  25.3ns ± 0%   -0.09%  (p=0.000 n=5+4)
Pow10Pos-16             0.52ns ± 1%  0.52ns ± 0%     ~     (p=0.810 n=5+5)
Pow10Neg-16             0.82ns ± 0%  0.82ns ± 0%     ~     (p=0.381 n=5+5)
Round-16                0.93ns ± 0%  0.93ns ± 0%     ~     (p=0.056 n=5+5)
RoundToEven-16          1.64ns ± 0%  1.64ns ± 0%     ~     (all equal)
Remainder-16            12.4ns ± 2%  12.0ns ± 0%   -3.27%  (p=0.008 n=5+5)
Signbit-16              0.37ns ± 0%  0.37ns ± 0%   -0.19%  (p=0.008 n=5+5)
Sin-16                  4.04ns ± 0%  3.92ns ± 0%   -3.13%  (p=0.000 n=4+5)
Sincos-16               5.99ns ± 0%  5.80ns ± 0%   -3.03%  (p=0.008 n=5+5)
Sinh-16                 5.22ns ± 0%  5.22ns ± 0%     ~     (p=0.651 n=5+4)
SqrtIndirect-16         0.41ns ± 0%  0.41ns ± 0%     ~     (p=0.333 n=4+5)
SqrtLatency-16          2.66ns ± 0%  2.66ns ± 0%     ~     (p=0.079 n=4+5)
SqrtIndirectLatency-16  2.66ns ± 0%  2.66ns ± 0%     ~     (p=1.000 n=5+5)
SqrtGoLatency-16        30.1ns ± 0%  28.6ns ± 1%   -4.84%  (p=0.008 n=5+5)
SqrtPrime-16             645ns ± 0%   645ns ± 0%     ~     (p=0.095 n=5+4)
Tan-16                  4.21ns ± 0%  4.09ns ± 0%   -2.76%  (p=0.029 n=4+4)
Tanh-16                 5.36ns ± 0%  5.36ns ± 0%     ~     (p=0.444 n=5+5)
Trunc-16                0.12ns ± 6%  0.11ns ± 1%   -6.79%  (p=0.008 n=5+5)
Y0-16                   19.2ns ± 0%  18.7ns ± 0%   -2.52%  (p=0.000 n=5+4)
Y1-16                   19.1ns ± 0%  18.4ns ± 0%     ~     (p=0.079 n=4+5)
Yn-16                   40.7ns ± 0%  39.5ns ± 0%   -2.82%  (p=0.008 n=5+5)
Float64bits-16          0.21ns ± 0%  0.21ns ± 0%     ~     (p=0.603 n=5+5)
Float64frombits-16      0.21ns ± 0%  0.21ns ± 0%     ~     (p=0.984 n=4+5)
Float32bits-16          0.21ns ± 0%  0.21ns ± 0%     ~     (p=0.778 n=4+5)
Float32frombits-16      0.21ns ± 0%  0.20ns ± 0%     ~     (p=0.397 n=5+5)
FMA-16                  0.82ns ± 0%  0.82ns ± 0%   +0.02%  (p=0.029 n=4+4)
[Geo mean]              2.87ns       2.74ns        -4.61%

math/cmplx:

name        old time/op  new time/op  delta
Abs-16      2.07ns ± 0%  2.05ns ± 0%   -0.70%  (p=0.016 n=5+4)
Acos-16     36.5ns ± 0%  35.7ns ± 0%   -2.33%  (p=0.029 n=4+4)
Acosh-16    37.0ns ± 0%  36.2ns ± 0%   -2.20%  (p=0.008 n=5+5)
Asin-16     36.5ns ± 0%  35.7ns ± 0%   -2.29%  (p=0.008 n=5+5)
Asinh-16    33.5ns ± 0%  31.6ns ± 0%   -5.51%  (p=0.008 n=5+5)
Atan-16     15.5ns ± 0%  13.9ns ± 0%  -10.61%  (p=0.008 n=5+5)
Atanh-16    15.0ns ± 0%  13.6ns ± 0%   -9.73%  (p=0.008 n=5+5)
Conj-16     0.11ns ± 5%  0.11ns ± 1%     ~     (p=0.421 n=5+5)
Cos-16      12.3ns ± 0%  12.2ns ± 0%   -0.60%  (p=0.000 n=4+5)
Cosh-16     12.1ns ± 0%  12.0ns ± 0%     ~     (p=0.079 n=4+5)
Exp-16      10.0ns ± 0%   9.8ns ± 0%   -1.77%  (p=0.008 n=5+5)
Log-16      14.5ns ± 0%  13.7ns ± 0%   -5.67%  (p=0.008 n=5+5)
Log10-16    14.5ns ± 0%  13.7ns ± 0%   -5.55%  (p=0.000 n=5+4)
Phase-16    5.11ns ± 0%  4.25ns ± 0%  -16.90%  (p=0.008 n=5+5)
Polar-16    7.12ns ± 0%  6.35ns ± 0%  -10.90%  (p=0.008 n=5+5)
Pow-16      64.3ns ± 0%  63.7ns ± 0%   -0.97%  (p=0.008 n=5+5)
Rect-16     5.74ns ± 0%  5.58ns ± 0%   -2.73%  (p=0.016 n=4+5)
Sin-16      12.2ns ± 0%  12.2ns ± 0%   -0.54%  (p=0.000 n=4+5)
Sinh-16     12.1ns ± 0%  12.0ns ± 0%   -0.58%  (p=0.000 n=5+4)
Sqrt-16     5.30ns ± 0%  5.18ns ± 0%   -2.36%  (p=0.008 n=5+5)
Tan-16      22.7ns ± 0%  22.6ns ± 0%   -0.33%  (p=0.008 n=5+5)
Tanh-16     21.2ns ± 0%  20.9ns ± 0%   -1.32%  (p=0.008 n=5+5)
[Geo mean]  11.3ns       10.8ns        -3.97%

Change-Id: Idcc4b357ba68477929c126289e5095b27a827b1b
Reviewed-on: https://go-review.googlesource.com/c/go/+/646335
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
6 months agocmd: use cmd/internal/hash.New32 and Sum32 only
Russ Cox [Tue, 7 Jan 2025 16:28:44 +0000 (11:28 -0500)]
cmd: use cmd/internal/hash.New32 and Sum32 only

Do not use New16, New20, Sum16, Sum20 anymore.
As of CL 641096, these are just wrappers around New32 and Sum32.
Change call sites to use them directly.

Change-Id: Icea91a77449f6839b903894997057ba404bd04e0
Reviewed-on: https://go-review.googlesource.com/c/go/+/641076
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Russ Cox <rsc@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
6 months agocmd/compile: implement signed loads from read-only memory
Keith Randall [Thu, 13 Feb 2025 16:04:03 +0000 (08:04 -0800)]
cmd/compile: implement signed loads from read-only memory

In addition to unsigned loads which already exist.

This helps code that does switches on strings to constant-fold
the switch away when the string being switched on is constant.

Fixes #71699

Change-Id: If3051af0f7255d2a573da6f96b153a987a7f159d
Reviewed-on: https://go-review.googlesource.com/c/go/+/649295
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Keith Randall <khr@google.com>

6 months agoruntime: fix usleep on s390x/linux
Paul Murphy [Wed, 12 Feb 2025 14:45:34 +0000 (08:45 -0600)]
runtime: fix usleep on s390x/linux

The timespec argument takes the remainder in nanoseconds, not
microseconds. Convert the remaining time to nsec.

Fixes #71714

Change-Id: I36cbbe3a088830c5e3afcc9516ef42e96ee21268
Reviewed-on: https://go-review.googlesource.com/c/go/+/648915
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Mauri de Souza Meneguzzo <mauri870@gmail.com>
Reviewed-by: Axel Busch <axel.busch@ibm.com>
Run-TryBot: Paul Murphy <murp@ibm.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Vishwanatha HD <vishwanatha.hd@ibm.com>
6 months agocmd/go: do not apply kill timeout to go test with -bench
Sam Thanawalla [Mon, 10 Feb 2025 21:06:02 +0000 (21:06 +0000)]
cmd/go: do not apply kill timeout to go test with -bench

The testing package already does this. go test should do the same thing.

Fixes: #69181
Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest,gotip-windows-amd64-longtest
Change-Id: I942bd09c5832b48d498a2eb1f1500e1d294d0a2c
Reviewed-on: https://go-review.googlesource.com/c/go/+/648236
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
6 months agogo/types: propagate *ast.LabeledStmt in blockBranches properly
Mateusz Poliwczak [Tue, 24 Dec 2024 07:23:13 +0000 (07:23 +0000)]
go/types: propagate *ast.LabeledStmt in blockBranches properly

Fixes #70974

Change-Id: I330c0ae53dcbcdb173ab514ee94f2ca53944df09
GitHub-Last-Rev: 7c2b740da6d6e94ac8787f04ad8942f3776ac56c
GitHub-Pull-Request: golang/go#70976
Reviewed-on: https://go-review.googlesource.com/c/go/+/638257
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Commit-Queue: Alan Donovan <adonovan@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
6 months agoio: use runtime.AddCleanup instead of runtime.SetFinalizer
Carlos Amedee [Mon, 23 Dec 2024 16:34:03 +0000 (11:34 -0500)]
io: use runtime.AddCleanup instead of runtime.SetFinalizer

Replace the usage of runtime.SetFinalizer with runtime.AddCleanup.

Updates #70907

Change-Id: Id604ca44ea67dcf8f87797e27347c6f4e9ad0b86
Reviewed-on: https://go-review.googlesource.com/c/go/+/638556
Reviewed-by: Michael Pratt <mpratt@google.com>
Auto-Submit: Carlos Amedee <carlos@golang.org>
TryBot-Bypass: Carlos Amedee <carlos@golang.org>

6 months agogo/types: use documented version of gotypesalias GODEBUG
Mateusz Poliwczak [Sat, 14 Dec 2024 11:03:27 +0000 (11:03 +0000)]
go/types: use documented version of gotypesalias GODEBUG

This way the code would panic, in case it does not exist.

Change-Id: I95de7460c0386afdc5d3f6a847e9fcbd22446010
GitHub-Last-Rev: 9ae0502a091feed45169f5c1a7e2761f8ffa2841
GitHub-Pull-Request: golang/go#70845
Reviewed-on: https://go-review.googlesource.com/c/go/+/636097
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
6 months agoos: use AddCleanup to close files
Carlos Amedee [Mon, 23 Dec 2024 16:27:20 +0000 (11:27 -0500)]
os: use AddCleanup to close files

This changes the finalizer mechanism used to close files from
runtime.SetFinalizer to runtime.AddCleanup.

Updates #70907

Change-Id: I47582b81b0ed69609dd9dac158ec7bb8819c8c77
Reviewed-on: https://go-review.googlesource.com/c/go/+/638555
Reviewed-by: Michael Pratt <mpratt@google.com>
Auto-Submit: Carlos Amedee <carlos@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

6 months agocrypto/internal/fips140test: fix TestACVP env vars
Daniel McCarney [Thu, 13 Feb 2025 15:31:53 +0000 (10:31 -0500)]
crypto/internal/fips140test: fix TestACVP env vars

Fix TestACVP environment construction to include both ACVP_WRAPPER and
GODEBUG.

Previously we were accidentally overwriting the cmd.Env, stomping the
ACVP_WRAPPER env var and replacing it with just the GODEBUG env var.
This in turn makes the tests start to fail when the test binary
subprocess is invoked without knowing it's fulfilling the role of the
wrapper, and not the test driver.

Change-Id: Ie6ee30c8b93b2051a671e12aaa63d2116c5eb8c8
Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest
Reviewed-on: https://go-review.googlesource.com/c/go/+/649016
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Auto-Submit: Filippo Valsorda <filippo@golang.org>

6 months agoruntime/debug: document DefaultGODEBUG as a BuildSetting
Sean Liao [Fri, 12 Jul 2024 19:56:19 +0000 (20:56 +0100)]
runtime/debug: document DefaultGODEBUG as a BuildSetting

Fixes #66465

Change-Id: I60c017ddba29fa5b452b665d8521cd6c8e20438c
Reviewed-on: https://go-review.googlesource.com/c/go/+/597979
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Jorropo <jorropo.pgm@gmail.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: qiu laidongfeng2 <2645477756@qq.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
6 months agocmd/dist: test GOFIPS140=latest rather than just the GODEBUG
Filippo Valsorda [Wed, 12 Feb 2025 11:37:52 +0000 (12:37 +0100)]
cmd/dist: test GOFIPS140=latest rather than just the GODEBUG

GOFIPS140=latest turns on the GODEBUG by default, and it's otherwise
untested.

Change-Id: I6a6a4656ff7ad313ce2c61ee4144ad2858bd148c
Reviewed-on: https://go-review.googlesource.com/c/go/+/648819
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Daniel McCarney <daniel@binaryparadox.net>
Reviewed-by: Roland Shoemaker <roland@golang.org>
6 months agocrypto/internal/fips140test: require FIPS 140 mode for the ACVP wrapper
Filippo Valsorda [Thu, 6 Feb 2025 10:34:48 +0000 (11:34 +0100)]
crypto/internal/fips140test: require FIPS 140 mode for the ACVP wrapper

Change-Id: I6a6a46565c14cf1d924a8fcfbf6752e9646ec63d
Reviewed-on: https://go-review.googlesource.com/c/go/+/648818
Reviewed-by: Daniel McCarney <daniel@binaryparadox.net>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
6 months agocrypto/internal/fips140test: support disabling PAA/PAI
Filippo Valsorda [Wed, 5 Feb 2025 12:51:26 +0000 (13:51 +0100)]
crypto/internal/fips140test: support disabling PAA/PAI

FIPS 140-3 testing requires testing the module both with and without
platform hardware acceleration.

Change-Id: I6a6a4656faad883062d64bc8e2363d4c59bd8cce
Reviewed-on: https://go-review.googlesource.com/c/go/+/648817
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Daniel McCarney <daniel@binaryparadox.net>
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
6 months agocrypto/internal/fips140test: make TestCASTFailures standalone
Filippo Valsorda [Mon, 27 Jan 2025 12:02:27 +0000 (13:02 +0100)]
crypto/internal/fips140test: make TestCASTFailures standalone

We want it to work even when fips140test.test is cross-compiled and
moved to a different machine. Also, make it log more.

Change-Id: I6a6a46566712f05f6b551ecde75672baf2c0fc6b
Reviewed-on: https://go-review.googlesource.com/c/go/+/644644
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Reviewed-by: Daniel McCarney <daniel@binaryparadox.net>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Filippo Valsorda <filippo@golang.org>

6 months agocrypto/internal/fips140test: add functional tests
Filippo Valsorda [Mon, 27 Jan 2025 12:02:27 +0000 (13:02 +0100)]
crypto/internal/fips140test: add functional tests

Running TestIntegrityCheckFailure|TestCASTFailures|TestFIPS140 with -v
and the appropriate GOFIPS140 environment variables will produce logs
sufficient for the functional testing session of the FIPS 140-3
validation. The tests can also be cross-compiled with -c and executed on
the target.

Change-Id: I6a6a465606518923d3f288e030c0f1b977aa6415
Reviewed-on: https://go-review.googlesource.com/c/go/+/648816
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Daniel McCarney <daniel@binaryparadox.net>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Roland Shoemaker <roland@golang.org>
6 months agointernal/abi: remove go122 flag
Keith Randall [Wed, 12 Feb 2025 23:24:10 +0000 (15:24 -0800)]
internal/abi: remove go122 flag

We no longer need this flag in case we need to rollback.

Change-Id: Id8b8f76380237f2d80a14037e88df4917c843f03
Reviewed-on: https://go-review.googlesource.com/c/go/+/649095
Reviewed-by: Michael Stapelberg <stapelberg@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Keith Randall <khr@google.com>

6 months agocmd/pprof: update vendored github.com/google/pprof [generated]
Dmitri Shuralyov [Tue, 11 Feb 2025 23:08:32 +0000 (18:08 -0500)]
cmd/pprof: update vendored github.com/google/pprof [generated]

Pull in the latest published version of github.com/google/pprof
as part of the continuous process of keeping Go's dependencies
up to date.

For #36905.

[git-generate]
cd src/cmd
go get github.com/google/pprof@v0.0.0-20250208200701-d0013a598941
go mod tidy
go mod vendor

Change-Id: I87e5621286d3db85f358fb86875aaf65bd7811a9
Reviewed-on: https://go-review.googlesource.com/c/go/+/648916
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
6 months agoreflect, internal/abi: speed up TypeFor[T]
Mateusz Poliwczak [Wed, 12 Feb 2025 07:16:32 +0000 (07:16 +0000)]
reflect, internal/abi: speed up TypeFor[T]

goos: linux
goarch: amd64
pkg: reflect
cpu: AMD Ryzen 5 4600G with Radeon Graphics
                 │ /tmp/before  │              /tmp/after              │
                 │    sec/op    │    sec/op     vs base                │
TypeForString-12    2.091n ± 1%    1.174n ± 1%  -43.84% (p=0.000 n=20)
TypeForError-12    7.5810n ± 3%   0.9372n ± 1%  -87.64% (p=0.000 n=20)

Change-Id: I22022f99b2dd2029f02d9ed8477b209adf7e9496
GitHub-Last-Rev: 64d2ac5bb2f3b2a659663832a4641ff4fc83bddd
GitHub-Pull-Request: golang/go#71654
Reviewed-on: https://go-review.googlesource.com/c/go/+/648395
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>

6 months agointernal/syscall: add cgo_import_dynamic for Fchmodat on AIX and Solaris
Damien Neil [Wed, 12 Feb 2025 17:23:14 +0000 (09:23 -0800)]
internal/syscall: add cgo_import_dynamic for Fchmodat on AIX and Solaris

For #67002

Change-Id: I1709fd51ba52c074501420943d311c785a49d851
Reviewed-on: https://go-review.googlesource.com/c/go/+/649015
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Damien Neil <dneil@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
6 months agocrypto/tls: document FIPS 140-3 mode behavior
Filippo Valsorda [Thu, 6 Feb 2025 10:34:20 +0000 (11:34 +0100)]
crypto/tls: document FIPS 140-3 mode behavior

Change-Id: I6a6a465612cf76d148b9758ee3fcdc8606497830
Reviewed-on: https://go-review.googlesource.com/c/go/+/648835
Reviewed-by: Daniel McCarney <daniel@binaryparadox.net>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
6 months agovet: add regression test for printf checker regression
Alan Donovan [Wed, 4 Sep 2024 16:30:47 +0000 (12:30 -0400)]
vet: add regression test for printf checker regression

Updates golang/go#68796

Change-Id: I5bfa80216deff76fd9aabe9882f93fbfaebef957
Reviewed-on: https://go-review.googlesource.com/c/go/+/610737
Auto-Submit: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
6 months agocmd/go: clarify vcs suffix to repo mapping
Sean Liao [Tue, 11 Feb 2025 16:30:22 +0000 (16:30 +0000)]
cmd/go: clarify vcs suffix to repo mapping

For #71635

Change-Id: I12ec2a810cfcaf2565b0d9c518b0921ec54e9f12
Reviewed-on: https://go-review.googlesource.com/c/go/+/648475
Reviewed-by: Michael Matloob <matloob@golang.org>
Auto-Submit: Sam Thanawalla <samthanawalla@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Sam Thanawalla <samthanawalla@google.com>
6 months agocmd/go: add errors obtaining c compiler version to cache key
Michael Matloob [Mon, 10 Feb 2025 20:17:54 +0000 (15:17 -0500)]
cmd/go: add errors obtaining c compiler version to cache key

If there's an error getting the version of the c compiler, add the error
to the input used to produce the cache key. In the case where we can't
parse the version, the text of the output of the command is part of the
error, so different unparseable versions will produce different cache
keys. Before, we wouldn't add anything to the key when there was an
error getting the version, so we wouldn't distinguish a missing compiler
from one where we couldn't parse the version.

Fixes #64589

Change-Id: I27f853e8ff40002e2f045b2210633b38f93d0130
Reviewed-on: https://go-review.googlesource.com/c/go/+/648196
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Sam Thanawalla <samthanawalla@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
6 months agoall: update vendored dependencies [generated]
Dmitri Shuralyov [Tue, 11 Feb 2025 22:59:59 +0000 (17:59 -0500)]
all: update vendored dependencies [generated]

The tree has opened for Go 1.25 development. This is a time to update
all golang.org/x/... module versions that contribute packages to the
std and cmd modules in the standard library to latest master versions.

For #36905.

[git-generate]
go install golang.org/x/build/cmd/updatestd@latest
go install golang.org/x/tools/cmd/bundle@latest
updatestd -goroot=$(pwd) -branch=master

# Update a cmd/vet test case.
cat <<EOF | patch
diff --git a/src/cmd/vet/testdata/print/print.go b/src/cmd/vet/testdata/print/print.go
index a2ad0f1298..fffe571163 100644
--- a/src/cmd/vet/testdata/print/print.go
+++ b/src/cmd/vet/testdata/print/print.go
@@ -200,8 +200,8 @@ func PrintfTests() {
  // Bad argument reorderings.
  Printf("%[xd", 3)                      // ERROR "Printf format %\[xd is missing closing \]"
  Printf("%[x]d x", 3)                   // ERROR "Printf format has invalid argument index \[x\]"
- Printf("%[3]*s x", "hi", 2)            // ERROR "Printf format has invalid argument index \[3\]"
- _ = fmt.Sprintf("%[3]d x", 2)          // ERROR "Sprintf format has invalid argument index \[3\]"
+ Printf("%[3]*s x", "hi", 2)            // ERROR "Printf format %\[3\]\*s reads arg #3, but call has 2 args"
+ _ = fmt.Sprintf("%[3]d x", 2)          // ERROR "Sprintf format %\[3\]d reads arg #3, but call has 1 arg"
  Printf("%[2]*.[1]*[3]d x", 2, "hi", 4) // ERROR "Printf format %\[2]\*\.\[1\]\*\[3\]d uses non-int \x22hi\x22 as argument of \*"
  Printf("%[0]s x", "arg1")              // ERROR "Printf format has invalid argument index \[0\]"
  Printf("%[0]d x", 1)                   // ERROR "Printf format has invalid argument index \[0\]"
EOF

# Temporarily hold x/net back to leave out CL 643780 because it's
# causing an import cycle in net/http's generated h2_bundle.go.
cd src
sed -i '' 's|"golang.org/x/net/internal/httpcommon"||' net/http/h2_bundle.go
go get golang.org/x/net@v0.34.1-0.20250123000230-c72e89d6a9e4  # version before CL 643780
go mod tidy
go mod vendor
go generate net/http

Change-Id: I91967ceb797bbc741af024cd2d2dba29dc558384
Reviewed-on: https://go-review.googlesource.com/c/go/+/648735
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>

6 months agoruntime: make TestSpuriousWakeupsNeverHangSemasleep more robust
Michael Anthony Knyszek [Tue, 11 Feb 2025 17:56:21 +0000 (17:56 +0000)]
runtime: make TestSpuriousWakeupsNeverHangSemasleep more robust

This change modifies this test (which involves an arbitrary timeout) to
be a little less flaky by double-checking that our subprocess program
completed even if the ticker fires and we've exceeded our timeout. The
logic behind this change is that the testing goroutine might get delayed
for any number of reasons, but the subprocess could still complete in
time. Still, the goroutine will wake up to handle the ticker and see its
over time, even though the event it was waiting for did actually happen.

I can't reproduce #71548 locally, so I suspect because this test calls
t.Parallel other load can delay the testing goroutine enough for this to
happen (especially with GODEBUG=gccheckmark=1, which pauses
everything to perform a full mark and sweep, and runtime tests love to
call runtime.GC).

For #71548.

Change-Id: I83e86a0115f65950886b57b5af0b4a517ef5f90f
Reviewed-on: https://go-review.googlesource.com/c/go/+/648576
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
Commit-Queue: Michael Knyszek <mknyszek@google.com>

6 months agocmd/go: initialize req.Header when loading git credential
Quan Tong [Fri, 7 Feb 2025 11:42:26 +0000 (18:42 +0700)]
cmd/go: initialize req.Header when loading git credential

Fixes #71604

Change-Id: I3d733a50b4451dfb571aba91a28387ba9e0614dc
Reviewed-on: https://go-review.googlesource.com/c/go/+/647615
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Sam Thanawalla <samthanawalla@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
6 months agocmd/go: document -modfile and other flags for 'go tool'
thepudds [Tue, 11 Feb 2025 17:59:54 +0000 (12:59 -0500)]
cmd/go: document -modfile and other flags for 'go tool'

Mention -modfile, -C, -overlay, and -modcacherw in the 'go tool'
documentation. We let a reference to 'go help build' give a pointer to
more detailed information.

The -modfile flag in particular is newly useful with the Go 1.24 support
for user-defined tools with 'go tool'.

Updates #48429
Updates #33926
Updates #71663
Fixes #71502

Change-Id: Ida67df50ff774a0886733d661a40e27c2cadc0f6
Reviewed-on: https://go-review.googlesource.com/c/go/+/648577
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Conrad Irwin <conrad.irwin@gmail.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Sam Thanawalla <samthanawalla@google.com>
Auto-Submit: Sam Thanawalla <samthanawalla@google.com>

6 months agocmd/dist: correct gccheckmark test name
Cherry Mui [Wed, 12 Feb 2025 01:47:55 +0000 (20:47 -0500)]
cmd/dist: correct gccheckmark test name

The test actually runs with gccheckmark=1, not gcstoptheworld=2.
Make the name match.

Change-Id: If38822a3f1ef65bc92fe47b375381df49a684c1d
Reviewed-on: https://go-review.googlesource.com/c/go/+/648755
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

6 months agomake.bat,race.bat: simplify --dist-tool handling
qmuntal [Tue, 11 Feb 2025 18:23:11 +0000 (18:23 +0000)]
make.bat,race.bat: simplify --dist-tool handling

make.bat accepts the --dist-tool flag on multiple flag positions
and also allows omitting the trailing dash. Doing so adds complexity
and is not aligned with the make.bash and make.rc behavior. Remove that
flexibility to simplify the code and make it more consistent. This also
fixes a bug where dist.exe wouldn't be removed from cmd\dist when
running make.bat --dist-tool.

Also, there is no need for race.bat to invoke make.bat with --dist-tool.
It uses it to get the GOHOSTARCH env value, but we can already get
that from the built-in PROCESSOR_ARCHITECTURE env variable.

Change-Id: Ia673562c1ae6aff9bd3ec7aa8cdd25ff187eeb79
Reviewed-on: https://go-review.googlesource.com/c/go/+/648615
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
6 months agocrypto/internal/fips140test: add cSHAKE ACVP tests
Daniel McCarney [Thu, 23 Jan 2025 19:34:46 +0000 (14:34 -0500)]
crypto/internal/fips140test: add cSHAKE ACVP tests

Adds ACVP test coverage for the SP 800-185 cSHAKE-128 and cSHAKE-256
algorithms based on the NIST spec:

  https://pages.nist.gov/ACVP/draft-celi-acvp-xof.html

Updates #69642

Change-Id: I4a6ef9a99dfe520f3177e0e7c258326475690f5f
Reviewed-on: https://go-review.googlesource.com/c/go/+/648455
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Auto-Submit: Roland Shoemaker <roland@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
6 months agocrypto/internal/fips140test: add KTS-IFC ACVP tests
Daniel McCarney [Wed, 22 Jan 2025 19:49:46 +0000 (14:49 -0500)]
crypto/internal/fips140test: add KTS-IFC ACVP tests

Adds ACVP test coverage for the SP 800-56Brev2 KTS-OAEP-basic algorithm
based on the NIST spec:

   https://pages.nist.gov/ACVP/draft-hammett-acvp-kas-ifc.html

Change-Id: I31240af30a73ee9f0ef00f47129738860378ea8f
Reviewed-on: https://go-review.googlesource.com/c/go/+/648436
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Auto-Submit: Roland Shoemaker <roland@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

6 months agocrypto/internal/fips140test: add OneStepNoCounter ACVP tests
Daniel McCarney [Tue, 14 Jan 2025 19:56:20 +0000 (14:56 -0500)]
crypto/internal/fips140test: add OneStepNoCounter ACVP tests

Adds ACVP test coverage for the SP 800-56Crev2 IG D.P KDA
OneStepNoCounter mode algorithm based on the NIST spec:

  https://pages.nist.gov/ACVP/draft-hammett-acvp-kas-kdf-onestepnocounter.html

Coverage is added for all SHA2 and SHA3 HMACs.

Updates #69642

Change-Id: I337bf824a71fce6c796a1440b7f08c4f5413d92f
Reviewed-on: https://go-review.googlesource.com/c/go/+/648435
Reviewed-by: Roland Shoemaker <roland@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Roland Shoemaker <roland@golang.org>

6 months agoruntime: update HACKING.md with execution traces and debuglog
Michael Anthony Knyszek [Sat, 1 Feb 2025 05:51:33 +0000 (05:51 +0000)]
runtime: update HACKING.md with execution traces and debuglog

Change-Id: Iedd3c6f292ad76f57c6c04beafd655e2e4d83043
Reviewed-on: https://go-review.googlesource.com/c/go/+/646017
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>

6 months agointernal/trace/tracev2: add guide for trace experiments
Michael Anthony Knyszek [Tue, 28 Jan 2025 20:59:54 +0000 (20:59 +0000)]
internal/trace/tracev2: add guide for trace experiments

Change-Id: I6fb354a57f3e73bd6589570868c7d68369adcf3c
Reviewed-on: https://go-review.googlesource.com/c/go/+/645136
Reviewed-by: Michael Pratt <mpratt@google.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

6 months agointernal/trace: interpret string ID arguments for experimental events
Michael Anthony Knyszek [Tue, 28 Jan 2025 20:54:34 +0000 (20:54 +0000)]
internal/trace: interpret string ID arguments for experimental events

Currently one of the reasons experimental events are tricky to use is
because:
- There's no way to take advantage of the existing infrastructure, like
  strings and stacks, and
- There's no way to attach arbitrary data to an event (except through
  strings, possibly).

Fix this by abstracting away the raw arguments in an ExperimentalEvent
and requiring access to the arguments via a new method, ArgValue. This
returns a Value, which gives us an opportunity to construct a typed
value for the raw argument dynamically, and a way to access existing
tables. The type of the argument is deduced from conventions for the
argument's name. This seems more than sufficient for experimental
events.

To make this work, we also need to add a "string" variant to the Value
type. This may be a little confusing since they're primarily used for
metrics, but one could imagine other scenarios in which this is useful,
such as including build information in the trace as a metric, so I think
this is fine.

This change also updates the Value API to accomodate a String method for
use with things that expect a fmt.Stringer, which means renaming the
value assertion methods to have a "To" prefix.

Change-Id: I43a2334f6cd306122c5b94641a6252ca4258b39f
Reviewed-on: https://go-review.googlesource.com/c/go/+/645135
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>

6 months agointernal/trace: move fake P IDs to internal/trace/traceviewer
Michael Anthony Knyszek [Mon, 27 Jan 2025 21:47:24 +0000 (21:47 +0000)]
internal/trace: move fake P IDs to internal/trace/traceviewer

These fake P IDs really only belong to the traceviewer.

Change-Id: I7976beb5750f1efca85e28975074a8c570a9c959
Reviewed-on: https://go-review.googlesource.com/c/go/+/644876
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>

6 months agointernal/trace: clean up parser.go
Michael Anthony Knyszek [Mon, 27 Jan 2025 21:42:34 +0000 (21:42 +0000)]
internal/trace: clean up parser.go

parser.go is an old file that contains trace v1 definitions and a second
equivalent definition for stack frames. These are redundant and useless.
Delete these definitions and rename the file to fakep.go, which
describes the only thing left in this file, a bunch of fake P IDs used
by the trace viewer.

We should consider moving the fake P definitions elsewhere, too.

Change-Id: Ifd0768bd73c39009069445afe0155f1e352f00c3
Reviewed-on: https://go-review.googlesource.com/c/go/+/644875
Reviewed-by: Michael Pratt <mpratt@google.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

6 months agoruntime: use internal/trace/tracev2 definitions
Michael Anthony Knyszek [Wed, 29 Jan 2025 17:17:04 +0000 (17:17 +0000)]
runtime: use internal/trace/tracev2 definitions

This change deduplicates trace wire format definitions between the
runtime and the trace parser by making the internal/trace/tracev2
package the source of truth.

Change-Id: Ia0721d3484a80417e40ac473ec32870bee73df09
Reviewed-on: https://go-review.googlesource.com/c/go/+/644221
Auto-Submit: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

6 months agointernal/trace: move maxArgs into tracev2 and validate specs
Michael Anthony Knyszek [Sat, 1 Feb 2025 05:26:17 +0000 (05:26 +0000)]
internal/trace: move maxArgs into tracev2 and validate specs

This change moves maxArgs to tracev2 and renames it MaxTimedEventArgs.
It also updates the tests to make sure the specs conform to this
requirement.

Change-Id: I7b0c888a4dfd83306a470a4c9b0f9e44fe2e7818
Reviewed-on: https://go-review.googlesource.com/c/go/+/646016
TryBot-Bypass: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>

6 months agointernal/trace/tracev2: add test to validate spec invariants
Michael Anthony Knyszek [Sat, 1 Feb 2025 04:52:57 +0000 (04:52 +0000)]
internal/trace/tracev2: add test to validate spec invariants

This change adds a test to help guide people adding experiments to this
package by validating that the spec is written correctly.

Also, makes some minor tweaks to the package in order to get the tests
to pass.

Change-Id: I3daa420c5a9ec3ea536415c8e5d06f41666a9566
Reviewed-on: https://go-review.googlesource.com/c/go/+/646015
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>

6 months ago{all,clean,make,race,run}.bat: simplify error handling
qmuntal [Tue, 11 Feb 2025 08:17:08 +0000 (09:17 +0100)]
{all,clean,make,race,run}.bat: simplify error handling

The bat files can use "if" + parentheses to make it easier to
understand how the if-case is handled rather than the more cryptic
"if" + "goto".

While here, replace some "goto"s with direct "exit" calls.

Change-Id: I20e1804439b5088f8f1e5cbf8676f3d58560109d
Reviewed-on: https://go-review.googlesource.com/c/go/+/648375
Auto-Submit: Damien Neil <dneil@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
6 months agonet/http/httptest: match net/http ContentLength behavior for http.NoBody
Sean Liao [Fri, 19 Jul 2024 22:28:54 +0000 (23:28 +0100)]
net/http/httptest: match net/http ContentLength behavior for http.NoBody

Fixes #68476

Change-Id: I05122e5ec5e6b290eec93f3db444fcf1de19c030
Reviewed-on: https://go-review.googlesource.com/c/go/+/599815
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Daniel Martí <mvdan@mvdan.cc>

6 months agocmd/go/internal/modload: don't set GIT_SSH_COMMAND
Sean Liao [Sun, 9 Feb 2025 13:32:27 +0000 (13:32 +0000)]
cmd/go/internal/modload: don't set GIT_SSH_COMMAND

Allows git core.sshcommand to take effect when set by the user.
This was originally added to work around an issue in
OpenSSH < 7.3 (2016), see https://go.dev/issue/13453 .
A fixed version of OpenSSH should be widely available enough
that it is no longer necessary

Fixes #71482

Change-Id: I6f44cc354e8a4063e226cac78ec27117fcc40e93
Reviewed-on: https://go-review.googlesource.com/c/go/+/647995
Reviewed-by: Sam Thanawalla <samthanawalla@google.com>
Auto-Submit: Daniel Martí <mvdan@mvdan.cc>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
6 months agointernal/trace: increment sync counter before final Sync on error
Michael Anthony Knyszek [Mon, 10 Feb 2025 23:54:56 +0000 (23:54 +0000)]
internal/trace: increment sync counter before final Sync on error

CL 648195 was supposed to have fixed #71615, but it didn't include an
update to r.syncs. I can confirm this CL fixes the issue even when
running the test many times in a row.

Fixes #71615.

Change-Id: I97db3d639dc5bc8648a191696f90b0e5087307c8
Reviewed-on: https://go-review.googlesource.com/c/go/+/648315
Auto-Submit: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Bypass: Michael Knyszek <mknyszek@google.com>

6 months agostrings: add examples for Lines, SplitSeq, SplitAfterSeq, FieldsSeq and FieldsFuncSeq
cuishuang [Fri, 7 Feb 2025 09:11:36 +0000 (17:11 +0800)]
strings: add examples for Lines, SplitSeq, SplitAfterSeq, FieldsSeq and FieldsFuncSeq

Change-Id: I1e5085ff2ed7f3d75ac3dc34ab72be6b55729fb7
Reviewed-on: https://go-review.googlesource.com/c/go/+/647575
Auto-Submit: Ian Lance Taylor <iant@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Commit-Queue: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

6 months agoos: add Root.Chmod
Damien Neil [Thu, 30 Jan 2025 23:53:06 +0000 (15:53 -0800)]
os: add Root.Chmod

For #67002

Change-Id: Id6c3a2096bd10f5f5f6921a0441dc6d9e6cdeb3b
Reviewed-on: https://go-review.googlesource.com/c/go/+/645718
Commit-Queue: Damien Neil <dneil@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Damien Neil <dneil@google.com>

6 months agocrypto/internal/fips140test: add feedback KDF ACVP tests
Daniel McCarney [Fri, 3 Jan 2025 19:30:02 +0000 (14:30 -0500)]
crypto/internal/fips140test: add feedback KDF ACVP tests

Adds ACVP test coverage for the SP 800-108r1 KDF feedback mode algorithm
based on the NIST spec:

  https://pages.nist.gov/ACVP/draft-celi-acvp-kbkdf.html

The HKDF-based implementation in our FIPS module fixes some parameters,
requiring tailoring of the advertised capability to match. Notably:

* We only support fixedDataOrder "after fixed data"
* We only support a counter length of 8 bits
* We only support empty IVs

No acvp_test.config.json update accompanies this support because the
ACVP tests for this algorithm aren't amenable to fixed data testing.

Updates #69642

Change-Id: I729e899377a64d2b613d6435241aebabeef93bca
Reviewed-on: https://go-review.googlesource.com/c/go/+/640016
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Filippo Valsorda <filippo@golang.org>

6 months agocrypto/internal/fips140test: add RSA ACVP tests
Daniel McCarney [Fri, 10 Jan 2025 16:10:12 +0000 (11:10 -0500)]
crypto/internal/fips140test: add RSA ACVP tests

Adds ACVP test coverage for the RSA algorithm based on the NIST spec:
  https://pages.nist.gov/ACVP/draft-celi-acvp-rsa.html

Includes coverage for keyGen, sigGen and sigVer across a variety of
modulus sizes. For sigGen and sigVer both PKCS1v1.5 and PSS are
supported with a variety of SHA2 digests.

The static test data from go-acvp only includes sigVer vectors/expected.
The keyGen and sigGen test types aren't amenable to fixed data testing.

Updates #69642

Change-Id: Ia61a69115f2d2a984b95435a37d4c9c6db90a89a
Reviewed-on: https://go-review.googlesource.com/c/go/+/642135
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
6 months agocrypto/internal/fips140test: add counter KDF ACVP tests
Daniel McCarney [Thu, 19 Dec 2024 17:45:57 +0000 (12:45 -0500)]
crypto/internal/fips140test: add counter KDF ACVP tests

Adds ACVP test coverage for the SP 800-108r1 KDF counter mode algorithm
based on the NIST spec:

  https://pages.nist.gov/ACVP/draft-celi-acvp-kbkdf.html

The implementation in our FIPS module fixes some parameters, requiring
tailoring of the advertised capability to match. Notably:

* We only support macModes CMAC-AES-128, -192, and -256
* We only support supportedLengths 256 (matching the [32]byte output
  from CounterKDF.DeriveKey)
* We only support fixedDataOrder "before fixed data"
* We only support counterLength 16

No acvp_test.config.json update accompanies this support because the
ACVP tests for this algorithm aren't amenable to fixed data testing.

Updates #69642

Change-Id: I9e02d6c8cb6e209ac8e4c9fba926fffbad916098
Reviewed-on: https://go-review.googlesource.com/c/go/+/639776
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

6 months agocrypto/internal/fips140test: add ctr DRBG ACVP tests
Daniel McCarney [Thu, 2 Jan 2025 20:09:39 +0000 (15:09 -0500)]
crypto/internal/fips140test: add ctr DRBG ACVP tests

Adds ACVP test coverage for the SP 800-90A rev 1 ctrDRBG algorithm based
on the NIST spec:
  https://pages.nist.gov/ACVP/draft-vassilev-acvp-drbg.html#section-7.2

The implementation in our FIPS module is a minimal implementation
tailored to the specific needs of stdlib crypto. As a result we
customize the ACVP capability registration so that:

* predResistanceEnabled is false
* only mode AES-256 is supported
* for that mode,
  * derFuncEnabled is false
  * persoStringLen is 0 to disable personalization
  * additionalInputLen is 384 to match the [48]byte argument in our API

Other capability values are chosen based on Table 4's ctrDRBG AES-256
w/o `derFuncEnabled` row:
  https://pages.nist.gov/ACVP/draft-vassilev-acvp-drbg.html#section-7.4

We do enable reseed in the capability, necessitating two acvptool
commands: one that expects only 6 args and doesn't reseed
("ctrDRBG/AES-256"), and one that expects 8 args and does
("ctrDRBG-reseed/AES-256").

Updates #69642

Change-Id: I0f01a2f9496f45b130ee7d10916708093236f473
Reviewed-on: https://go-review.googlesource.com/c/go/+/639795
Reviewed-by: Roland Shoemaker <roland@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

6 months agointernal/trace: emit a Sync event even if the next generation is broken
Michael Anthony Knyszek [Mon, 10 Feb 2025 20:10:22 +0000 (20:10 +0000)]
internal/trace: emit a Sync event even if the next generation is broken

Since CL 644215 each Sync event now represents the coming generation,
with a final Sync event emitted even when there's nothing ahead. This
change however failed to emit a Sync event at the end of a completely
valid generation when the next generation was invalid, causing the
runtime test TestCrashWhileTracing to start failing.

Fix this by emitting a final Sync event even when the next generation is
broken. We hold onto the error in parsing the next generation and emit
it after that final Sync event.

(Should these "final" Sync events distinguish themselves in some way?)

Fixes #71615.

Change-Id: I1f8abee5abaa39e1219e6fa05e9f82f1478db4c9
Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest
Reviewed-on: https://go-review.googlesource.com/c/go/+/648195
Auto-Submit: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>