]> Cypherpunks repositories - gostls13.git/log
gostls13.git
14 months agonet: support context cancellation in acquireThread
Mateusz Poliwczak [Wed, 21 Feb 2024 17:18:43 +0000 (17:18 +0000)]
net: support context cancellation in acquireThread

acquireThread is already waiting on a channel, so
it can be easily wired up to support context cancellation.
This change will make sure that contexts that are
cancelled at the acquireThread stage (when the limit of
threads is reached) do not queue unnecessarily and cause
an unnecessary cgo call that will be soon aborted by
the doBlockingWithCtx function.

Updates #63978

Change-Id: I8ae4debd51995637567d8f51c6f1ed60f23d6c0c
GitHub-Last-Rev: 4189b9faf07c073a2ca440becee07b6aa9c4e795
GitHub-Pull-Request: golang/go#63985
Reviewed-on: https://go-review.googlesource.com/c/go/+/539360
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Commit-Queue: Ian Lance Taylor <iant@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

14 months agocmd/go: remove unused var BuildToolchainLinker and BuildToolchainCompiler
qiulaidongfeng [Wed, 21 Feb 2024 09:29:17 +0000 (09:29 +0000)]
cmd/go: remove unused var BuildToolchainLinker and BuildToolchainCompiler

Change-Id: I4bb855f6ada5c550a46f69313a2f47631bf657ca
GitHub-Last-Rev: 2af07f9d7bda0de31b61d434635cd1c2c568af06
GitHub-Pull-Request: golang/go#65838
Reviewed-on: https://go-review.googlesource.com/c/go/+/565517
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
14 months agogo/types: generate typestring.go from types2 source
Robert Griesemer [Wed, 21 Feb 2024 00:14:42 +0000 (16:14 -0800)]
go/types: generate typestring.go from types2 source

This CL reduces the amount of code that needs to be maintained
manually by about 500 LOC.

Change-Id: I643bea15203f7a916ef78b2738f125aa5b312eed
Reviewed-on: https://go-review.googlesource.com/c/go/+/565438
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Robert Griesemer <gri@google.com>

14 months agogo/types: generate conversions.go from types2 source
Robert Griesemer [Tue, 20 Feb 2024 23:40:44 +0000 (15:40 -0800)]
go/types: generate conversions.go from types2 source

This CL reduces the amount of code that needs to be maintained
manually by about 300 LOC.

Change-Id: I749e47668e90e77e99109005fbe19045d4a5ad29
Reviewed-on: https://go-review.googlesource.com/c/go/+/565437
Reviewed-by: Robert Findley <rfindley@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Griesemer <gri@google.com>
14 months agogo/types: generate builtins_test.go from types2 source
Robert Griesemer [Thu, 8 Feb 2024 23:13:11 +0000 (15:13 -0800)]
go/types: generate builtins_test.go from types2 source

Added new conversion functions to generate_test.go to handle the
translation of builtins_test.go.

Simplify some existing code by using the renameMap mechanism.

This CL reduces the amount of code that needs to be maintained
manually by about 250 LOC.

Change-Id: I1a455c1921512fb3647fd92ac7c278b1b80ea884
Reviewed-on: https://go-review.googlesource.com/c/go/+/562837
Reviewed-by: Robert Findley <rfindley@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>

14 months agogo/types: generate builtins.go from types2 source
Robert Griesemer [Thu, 8 Feb 2024 22:29:26 +0000 (14:29 -0800)]
go/types: generate builtins.go from types2 source

Minor changes to types2.builtin.go to simplify automatic translation.

Added new conversion functions to generate_test.go to handle the
translation of builtins.go.

While at it, added additional helper functions to generate_test.go
and simplified some of the existing conversion functions.

This CL reduces the amount of code that needs to be maintained
manually by about 1000 LOC.

Change-Id: I1bd5c8eda0c0194a0b47e69882d2b987d91eef50
Reviewed-on: https://go-review.googlesource.com/c/go/+/562835
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>

14 months agocmd/go: change the naming of flag counters
Michael Matloob [Fri, 16 Feb 2024 20:01:47 +0000 (15:01 -0500)]
cmd/go: change the naming of flag counters

We're making the following changes:
 * From cmd/go/flag-<flagname> to cmd/go/flag:<flagname>
 * From cmd/go/<subcommand-name>:flag-<flagname> to
       cmd/go/flag:<subcommand-name>-<flagname>
 * From cmd/go:subcommand-<subcommand-name> to
       cmd/go/subcommand:<subcommand-name>

Change-Id: Id682840bb4330fceeb070fc69203d0bfb03f3a29
Reviewed-on: https://go-review.googlesource.com/c/go/+/564857
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Reviewed-by: Robert Findley <rfindley@google.com>
14 months agocmd/go/internal/modcmd: correctly filter out main modules in verify
Michael Matloob [Tue, 20 Feb 2024 21:13:33 +0000 (16:13 -0500)]
cmd/go/internal/modcmd: correctly filter out main modules in verify

This change fixes a bug where we incorrectly filtered out the main
modules from the beginning of the build list before verifying them. We
made the assumption that the first MainModules.Len() entries of the
build list were the main modules, but now it can contain the go and
toolchain version entries, so removing the first MainModules.Len()
entries could leave main module names in the build list if any of
their names sorted after the string 'go'.

Fixes #62663

Change-Id: I35ab6857a556f58d306303322afe24c48fc8b38f
Reviewed-on: https://go-review.googlesource.com/c/go/+/565378
Reviewed-by: Bryan Mills <bcmills@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

14 months agocmd/asm, cmd/internal/obj: enable rounding mode suffix for riscv64
Meng Zhuo [Tue, 20 Jun 2023 03:16:56 +0000 (11:16 +0800)]
cmd/asm, cmd/internal/obj: enable rounding mode suffix for riscv64

This CL adds rounding modes for riscv64 floating point conversion
instructions by suffix with 5 modes: RNE, RTZ, RDN, RUP and RMM.

For example, for round to nearest (RNE), we can use `FCVTLD.RNE`
According to RISCV manual 8.7 and 9.5, we changed these
conversion instructions:

FCVTWS
FCVTLS
FCVTWUS
FCVTLUS
FCVTWD
FCVTLD
FCVTWUD
FCVTLUD

Note: Round towards zero (RTZ) by default for all these instructions above.

Change-Id: I491e522e14d721e24aa7f528ee0c4640c54c5808
Reviewed-on: https://go-review.googlesource.com/c/go/+/504736
Reviewed-by: Joel Sing <joel@sing.id.au>
Run-TryBot: M Zhuo <mengzhuo1203@gmail.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
14 months agonet: harmonize the time units used for TCP keep-alive on DragonFly and other UNIX...
Andy Pan [Tue, 20 Feb 2024 08:17:06 +0000 (16:17 +0800)]
net: harmonize the time units used for TCP keep-alive on DragonFly and other UNIX's by seconds

Follows up CL 542275

Fixes #65809

Change-Id: Iba01efb4ff0fbb7a67840875322f0338337ebb78
Reviewed-on: https://go-review.googlesource.com/c/go/+/565315
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
Run-TryBot: Andy Pan <panjf2000@gmail.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

14 months agoruntime/internal/atomic: add s390x operators for And/Or
Mauri de Souza Meneguzzo [Sat, 17 Feb 2024 10:30:01 +0000 (10:30 +0000)]
runtime/internal/atomic: add s390x operators for And/Or

These primitives will be used by the new And/Or sync/atomic apis.

For #61395

Change-Id: Ia9b4877048002d3d7d1dffa2311d0ec5f38e4ee5
GitHub-Last-Rev: 20dea110c824913c0c3d9c259e3e21e7ff8e4ba9
GitHub-Pull-Request: golang/go#63318
Reviewed-on: https://go-review.googlesource.com/c/go/+/531678
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Mauri de Souza Meneguzzo <mauri870@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
14 months agocmd/compile: make jump table symbol static
Cherry Mui [Tue, 20 Feb 2024 20:05:29 +0000 (15:05 -0500)]
cmd/compile: make jump table symbol static

The jump table symbol is accessed only from the function symbol
(in the same package), so it can be static. Also, if the function
is DUPOK and it is, somehow, compiled differently in two different
packages, the linker must choose the jump table symbol associated
to the function symbol it chose. Currently the jump table symbol
is DUPOK, so that is not guaranteed. Making it static will
guarantee that, as each copy of the function symbol refers to its
own jump table symbol.

For #65783.

Change-Id: I27e051d01ef585d07700b75d4dfac5768f16441e
Reviewed-on: https://go-review.googlesource.com/c/go/+/565535
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@golang.org>
14 months agocmd/compile/internal/typecheck: remove constant bounds check
Cuong Manh Le [Fri, 2 Feb 2024 02:35:07 +0000 (09:35 +0700)]
cmd/compile/internal/typecheck: remove constant bounds check

types2 handles all constant-related bounds checks in user Go code now,
so it's safe to remove the check from typecheck, avoid the inconsistency
with type parameter.

Fixes #65417

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

14 months agocmd/go/testdata/script: add darwin skips for selected buildrepro tests
Than McIntosh [Tue, 20 Feb 2024 16:49:43 +0000 (16:49 +0000)]
cmd/go/testdata/script: add darwin skips for selected buildrepro tests

Skip two build reproducibility tests (build_issue48319 and
build_plugin_reproducible) on Darwin if GO_BUILDER_NAME is set until
issue 64947 can be resolved; on the LUCI darwin longtest builder the
more contemporary version of Xcode is doing things that are unfriendly
to Go's build reproducibility.

For #64947.

Change-Id: Iebd433ad6dfeb84b6504ae9355231d897d8ae174
Reviewed-on: https://go-review.googlesource.com/c/go/+/565376
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

14 months agoRevert "hash/maphash: parallel run test"
Michael Pratt [Tue, 20 Feb 2024 20:39:53 +0000 (20:39 +0000)]
Revert "hash/maphash: parallel run test"

This reverts CL 564576.

Reason for revert: flaky on linux-386-longtest

Fixes #65823.

Change-Id: I20e11f15af050eae9a6c15e756a52ffad327c458
Reviewed-on: https://go-review.googlesource.com/c/go/+/565536
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
14 months agointernal/msan: add new package
Mauri de Souza Meneguzzo [Fri, 16 Feb 2024 23:24:12 +0000 (23:24 +0000)]
internal/msan: add new package

The internal/msan package contains helper functions for manually
instrumenting code for the memory sanitizer. It exports the private
msan routines in runtime unconditionally, making the functions a
no-op if the build flag "msan" is not present.

For #64611

Change-Id: If43f29e112ac79a47083c9dbdf2c61a0641e80b1
GitHub-Last-Rev: 0a644bd6f10a9052c33992f1c56b1f0037ca98c7
GitHub-Pull-Request: golang/go#64637
Reviewed-on: https://go-review.googlesource.com/c/go/+/548676
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

14 months agolog/slog: correct formatting
Joel Sing [Fri, 16 Feb 2024 15:21:11 +0000 (02:21 +1100)]
log/slog: correct formatting

Code added in CL #558755 and CL #561315 (both via github) were not
appropriately formatted. Run gofmt to address this.

Change-Id: Iaf7abca9c2ad4e0fabecc417234b743b6b15e9c9
Reviewed-on: https://go-review.googlesource.com/c/go/+/564719
Run-TryBot: Joel Sing <joel@sing.id.au>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
14 months agonet: mention the cgo thread limit in package docs
Mateusz Poliwczak [Tue, 20 Feb 2024 17:15:51 +0000 (17:15 +0000)]
net: mention the cgo thread limit in package docs

Updates #63978

Change-Id: I39a5c812b4f604baf4ca5ffcff52b8dc17d4990d
GitHub-Last-Rev: 4ab6e262f4fd37ff32d6b3eb756fea187e5d6e53
GitHub-Pull-Request: golang/go#63990
Reviewed-on: https://go-review.googlesource.com/c/go/+/539361
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>
Reviewed-by: Roland Shoemaker <roland@golang.org>
14 months agocmd/compile/internal/types2: use ExprString instead of syntax.String
Robert Griesemer [Thu, 8 Feb 2024 23:35:22 +0000 (15:35 -0800)]
cmd/compile/internal/types2: use ExprString instead of syntax.String

This further reduces the differences between go/types and types2.

Change-Id: I1426c2f7c58e2d1123d93f68fbdda01b0cc2d46e
Reviewed-on: https://go-review.googlesource.com/c/go/+/562836
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>

14 months agocrypto/x509: remove TestPlatformVerifierLegacy tests
Roland Shoemaker [Mon, 11 Dec 2023 22:23:12 +0000 (14:23 -0800)]
crypto/x509: remove TestPlatformVerifierLegacy tests

They are no longer necessary, woohoo!

Updates #52108
Fixes #56791

Change-Id: I11a4c17162da4295309f74f2f8362bab0f506f78
Reviewed-on: https://go-review.googlesource.com/c/go/+/548976
Run-TryBot: Roland Shoemaker <roland@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Roland Shoemaker <roland@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

14 months agocrypto/x509: remove bad generate statement
Roland Shoemaker [Tue, 20 Feb 2024 16:53:57 +0000 (08:53 -0800)]
crypto/x509: remove bad generate statement

CL488855 added a broken go:generate statement, which referenced a
file which didn't exist. Remove the statement.

The generator is in the commit message for CL488855, if it is ever
actually needed.

Change-Id: I6b18d5b4f38f82b27681b9b758e9642543aa6e43
Reviewed-on: https://go-review.googlesource.com/c/go/+/565435
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
Auto-Submit: Roland Shoemaker <roland@golang.org>

14 months agocmd/compile/internal/reflectdata,reflect: merge MaxPtrmaskBytes const into internal/abi
qiulaidongfeng [Wed, 24 Jan 2024 02:54:56 +0000 (02:54 +0000)]
cmd/compile/internal/reflectdata,reflect: merge MaxPtrmaskBytes const into internal/abi

For #59670

Change-Id: I5c0a463f54208db215683f11e6454d0178edda3c
GitHub-Last-Rev: 6963f3c8fb9cf34cdc8dda7ee92a58c71ca65520
GitHub-Pull-Request: golang/go#64904
Reviewed-on: https://go-review.googlesource.com/c/go/+/553275
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
14 months agocmd/cgo/internal/test: disable issue8694 and issue9510 on ppc64x with internal linking
Paul E. Murphy [Wed, 14 Feb 2024 22:42:27 +0000 (16:42 -0600)]
cmd/cgo/internal/test: disable issue8694 and issue9510 on ppc64x with internal linking

These link in libgcc functions which require more advanced handling
of small toc relocations. The internal linker is not capable of
placing these functions to ensure they are always resolvable.

Change-Id: Idd4a0264bfbbd7016472120dc4bee84814e8c2eb
Reviewed-on: https://go-review.googlesource.com/c/go/+/564235
Run-TryBot: Paul Murphy <murp@ibm.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Lynn Boger <laboger@linux.vnet.ibm.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

14 months agoruntime/pprof: update outdated google/pprof link
hi-rustin [Mon, 19 Feb 2024 15:22:37 +0000 (15:22 +0000)]
runtime/pprof: update outdated google/pprof link

Google/pprof changed the master branch to main, so it might be better to update it to the latest.

Change-Id: Id29aca80a9a83a9c10da215180ad65816bc88936
GitHub-Last-Rev: 0023c28dc0d84a2529e24c694acfed7a363d2d0b
GitHub-Pull-Request: golang/go#65792
Reviewed-on: https://go-review.googlesource.com/c/go/+/565177
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>

14 months agotesting/fstest: return base name from mapfs FileInfo.Name
Shang Ding [Sat, 17 Feb 2024 18:21:54 +0000 (12:21 -0600)]
testing/fstest: return base name from mapfs FileInfo.Name

Change-Id: I5a68389a68875dbb2f6875de3f64f63dd7ca1af7
Reviewed-on: https://go-review.googlesource.com/c/go/+/565055
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>
Reviewed-by: Than McIntosh <thanm@google.com>
14 months agoruntime/internal/syscall: merge duplicate constants
Andy Pan [Fri, 16 Feb 2024 06:32:27 +0000 (14:32 +0800)]
runtime/internal/syscall: merge duplicate constants

Change-Id: Ifdc6e22d52317cdb90a607ac4d72437d4d6b33e8
Reviewed-on: https://go-review.googlesource.com/c/go/+/564716
Auto-Submit: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
14 months agoruntime: use eventfd as the event wait/notify mechanism for epoll
Andy Pan [Fri, 2 Feb 2024 03:22:57 +0000 (11:22 +0800)]
runtime: use eventfd as the event wait/notify mechanism for epoll

Fixes #65443

Change-Id: I9ad4689b36e87ee930d35a38322a8797896483b4
Reviewed-on: https://go-review.googlesource.com/c/go/+/560615
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Jorropo <jorropo.pgm@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
14 months agoregexp/syntax: regenerate docs with mksyntaxgo
Mauri de Souza Meneguzzo [Sun, 18 Feb 2024 12:23:20 +0000 (12:23 +0000)]
regexp/syntax: regenerate docs with mksyntaxgo

This makes the docs up-to-date by running doc/mksyntaxgo from the google/re2 repo.

Change-Id: I80358eed071e7566c85edaeb1cc5514a6d8c37a7
GitHub-Last-Rev: 0f8c8df4f213ce89fbea89e81f0ea3babd59d38f
GitHub-Pull-Request: golang/go#65249
Reviewed-on: https://go-review.googlesource.com/c/go/+/558136
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

14 months agohash/maphash: parallel run test
qiulaidongfeng [Fri, 16 Feb 2024 01:51:54 +0000 (01:51 +0000)]
hash/maphash: parallel run test

This reduces the go test hash/maphash time
by more than half.

Change-Id: If184ca99544809c86b4c1baeb45d3afede91b41a
GitHub-Last-Rev: 440c35f8b544a16cc733e3291f963f738dd59a47
GitHub-Pull-Request: golang/go#65739
Reviewed-on: https://go-review.googlesource.com/c/go/+/564576
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
14 months agonet/http: add missing call to decConnsPerHost
Julian Tibble [Wed, 14 Feb 2024 13:24:52 +0000 (13:24 +0000)]
net/http: add missing call to decConnsPerHost

A recent change to Transport.dialConnFor introduced an early return that
skipped dialing. This path did not call decConnsPerHost, which can cause
subsequent HTTP calls to hang if Transport.MaxConnsPerHost is set.

Fixes: #65705
Change-Id: I157591114b02a3a66488d3ead7f1e6dbd374a41c
Reviewed-on: https://go-review.googlesource.com/c/go/+/564036
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Damien Neil <dneil@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
14 months agonet: add KeepAliveConfig and implement SetKeepAliveConfig
Andy Pan [Tue, 14 Nov 2023 15:56:51 +0000 (23:56 +0800)]
net: add KeepAliveConfig and implement SetKeepAliveConfig

Fixes #62254
Fixes #48622

Change-Id: Ida598e7fa914c8737fdbc1c813bcd68adb5119c3
Reviewed-on: https://go-review.googlesource.com/c/go/+/542275
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
Run-TryBot: Andy Pan <panjf2000@gmail.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>

14 months agonet: prevent unintended retries upon receiving an empty answer response from the...
kkhaike [Sat, 16 Dec 2023 10:08:16 +0000 (18:08 +0800)]
net: prevent unintended retries upon receiving an empty answer response from the DNS server.

CL https://golang.org/cl/37879 migrates DNS message parsing to the golang.org/x/net/dns/dnsmessage package. However, during the modification of the "lame referral" error check introduced by CL https://golang.org/cl/22428, a condition was overlooked. This omission results in unexpected retries when a DNS server returns an empty response (not an invalid response, but one that includes an additional section).

Fixes #57697
Fixes #64783

Change-Id: I203896aa2902c305569005c1712fd2f9f13a9b6b
Reviewed-on: https://go-review.googlesource.com/c/go/+/550435
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Commit-Queue: Ian Lance Taylor <iant@golang.org>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Dexter Ouyang <kkhaike@gmail.com>
14 months agonet/netip: optimize parseIPv4 and refactor IPv6 embedded IPv4 parsing
aimuz [Sat, 18 Nov 2023 03:35:07 +0000 (03:35 +0000)]
net/netip: optimize parseIPv4 and refactor IPv6 embedded IPv4 parsing

This change refactors the parseIPv4 function to extract a new helper
function, parseIPv4Fields, which is now used by both parseIPv4 and
parseIPv6 functions. The extraction of this logic into a separate
helper function removes code duplication and improves the performance
of parsing IPv6 addresses that contain an embedded IPv4 address.

Additionally, the error handling within the IP address parsing logic
has been streamlined to provide clearer messages when encountering
incorrect formats or values in IPv4 fields.

Benchmark:

```
benchstat old.out new.out
goos: darwin
goarch: amd64
pkg: net/netip
cpu: Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
                             │    old.out    │               new.out               │
                             │    sec/op     │   sec/op     vs base                │
ParseAddr/v4-12                 22.23n ±  2%   21.86n ± 2%        ~ (p=0.127 n=10)
ParseAddr/v6-12                 69.67n ±  7%   70.31n ± 1%        ~ (p=0.128 n=10)
ParseAddr/v6_ellipsis-12        48.22n ± 17%   48.58n ± 1%        ~ (p=0.739 n=10)
ParseAddr/v6_v4-12              60.73n ± 36%   51.54n ± 1%  -15.14% (p=0.000 n=10)
ParseAddr/v6_zone-12           102.50n ± 22%   93.50n ± 0%   -8.79% (p=0.000 n=10)
ParseAddrPort/v4-12             38.07n ±  1%   36.84n ± 2%   -3.22% (p=0.000 n=10)
ParseAddrPort/v6-12             84.61n ±  1%   87.21n ± 1%   +3.07% (p=0.000 n=10)
ParseAddrPort/v6_ellipsis-12    69.65n ±  8%   64.56n ± 2%   -7.31% (p=0.023 n=10)
ParseAddrPort/v6_v4-12          71.88n ±  1%   70.61n ± 1%   -1.76% (p=0.000 n=10)
ParseAddrPort/v6_zone-12        119.0n ±  2%   118.0n ± 2%        ~ (p=0.108 n=10)
geomean                         62.38n         60.17n        -3.54%

                             │   old.out    │               new.out               │
                             │     B/op     │    B/op     vs base                 │
ParseAddr/v4-12                0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=10) ¹
ParseAddr/v6-12                0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=10) ¹
ParseAddr/v6_ellipsis-12       0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=10) ¹
ParseAddr/v6_v4-12             0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=10) ¹
ParseAddr/v6_zone-12           0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=10) ¹
ParseAddrPort/v4-12            0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=10) ¹
ParseAddrPort/v6-12            0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=10) ¹
ParseAddrPort/v6_ellipsis-12   0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=10) ¹
ParseAddrPort/v6_v4-12         0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=10) ¹
ParseAddrPort/v6_zone-12       0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=10) ¹
geomean                                   ²               +0.00%                ²
¹ all samples are equal
² summaries must be >0 to compute geomean

                             │   old.out    │               new.out               │
                             │  allocs/op   │ allocs/op   vs base                 │
ParseAddr/v4-12                0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=10) ¹
ParseAddr/v6-12                0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=10) ¹
ParseAddr/v6_ellipsis-12       0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=10) ¹
ParseAddr/v6_v4-12             0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=10) ¹
ParseAddr/v6_zone-12           0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=10) ¹
ParseAddrPort/v4-12            0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=10) ¹
ParseAddrPort/v6-12            0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=10) ¹
ParseAddrPort/v6_ellipsis-12   0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=10) ¹
ParseAddrPort/v6_v4-12         0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=10) ¹
ParseAddrPort/v6_zone-12       0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=10) ¹
geomean                                   ²               +0.00%                ²
¹ all samples are equal
² summaries must be >0 to compute geomean
```

Change-Id: I403cb76f449a0bf203a821294df25d3c9031df4c
GitHub-Last-Rev: 917f78ce4ef2a4156d0291c36047689de1764c3f
GitHub-Pull-Request: golang/go#64219
Reviewed-on: https://go-review.googlesource.com/c/go/+/543179
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Commit-Queue: Ian Lance Taylor <iant@golang.org>
Auto-Submit: Ian Lance Taylor <iant@golang.org>

14 months agohash/crc32: fix code generator to use the Go standard
Olivier Mengué [Tue, 16 Jan 2024 22:30:12 +0000 (23:30 +0100)]
hash/crc32: fix code generator to use the Go standard

Apply the Go standard for code generation (https://go.dev/s/generatedcode)
to generated crc32_table_ppc64le.s despites this is not
generated Go but Assembly.  This is to help prevent changes like CL 478976
that changed the generated output without fixing the generator.

Add gen.go to allow to launch code generation with "go generate".

Change-Id: I8671284265425826c8620dbec055519b992fa04e
Reviewed-on: https://go-review.googlesource.com/c/go/+/556335
Auto-Submit: Michael Pratt <mpratt@google.com>
Reviewed-by: Michael Pratt <mpratt@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>
Commit-Queue: Ian Lance Taylor <iant@google.com>

14 months agonet: move go/cgo resolver forcing functions to one file
Mateusz Poliwczak [Sat, 10 Feb 2024 18:52:27 +0000 (18:52 +0000)]
net: move go/cgo resolver forcing functions to one file

The forceGoDNS/forceCgoDNS functions currently return nil
or an empty func on plan9, but they don't have to, because
we already support go resolver there (Dial field required).

Change-Id: Iba6211ca0235874f39e5fcacb3932bb16768c702
GitHub-Last-Rev: 4072ad4a05366a03749e8cfcf27efb9f198aacec
GitHub-Pull-Request: golang/go#63545
Reviewed-on: https://go-review.googlesource.com/c/go/+/534938
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Commit-Queue: Ian Lance Taylor <iant@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>

14 months agostrings: make use of sizeclasses in (*Builder).Grow
Mateusz Poliwczak [Fri, 2 Feb 2024 15:54:24 +0000 (15:54 +0000)]
strings: make use of sizeclasses in (*Builder).Grow

Fixes #64833

Change-Id: Ice3f5dfab65f5525bc7a6f57ddeaabda8d64dfa3
GitHub-Last-Rev: 38f1d6c19d8ec29ae5645ce677839a301f798df3
GitHub-Pull-Request: golang/go#64835
Reviewed-on: https://go-review.googlesource.com/c/go/+/552135
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

14 months agoruntime: use a high res timer to signal io completion ports on windows
qmuntal [Tue, 25 Apr 2023 16:27:35 +0000 (18:27 +0200)]
runtime: use a high res timer to signal io completion ports on windows

GetQueuedCompletionStatusEx has a ~16ms timeout resolution. Use a
WaitCompletionPacket associated with the I/O Completion Port (IOCP)
and a high resolution timer so the IOCP is signaled on timer expiry,
therefore improving the GetQueuedCompletionStatusEx timeout resolution.

BenchmarkSleep from the time package shows an important improvement:

goos: windows
goarch: amd64
pkg: time
cpu: Intel(R) Core(TM) i7-10850H CPU @ 2.70GHz
         │   old.txt    │               new.txt               │
         │    sec/op    │   sec/op     vs base                │
Sleep-12   1258.5µ ± 5%   250.7µ ± 1%  -80.08% (p=0.000 n=20)

Fixes #44343.

Change-Id: I79fc09e34dddfc49e0e23c3d1d0603926c22a11d
Reviewed-on: https://go-review.googlesource.com/c/go/+/488675
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Run-TryBot: Quim Muntal <quimmuntal@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

14 months agomath/rand/v2: use a doc link for crypto/rand
Daniel Martí [Sun, 11 Feb 2024 21:40:26 +0000 (21:40 +0000)]
math/rand/v2: use a doc link for crypto/rand

It's easier to go look at its documentation when there's a link.

Change-Id: Iad6c1aa1a3f4b9127dc526b4db473239329780d6
Reviewed-on: https://go-review.googlesource.com/c/go/+/563255
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Than McIntosh <thanm@google.com>
14 months agoruntime: use the right number of parameters in syscall_SyscallX on Windows
qmuntal [Mon, 12 Feb 2024 11:38:37 +0000 (12:38 +0100)]
runtime: use the right number of parameters in syscall_SyscallX on Windows

The syscall_SyscallX functions currently discard the nargs parameter
when calling syscall_SyscallN. This precludes some optimizations
down the line. For example, on amd64, a syscall that takes 0 arguments
don't need to set any of the params passing registers (CX, DX, R8, and
R9).

This CL updates all syscall_SyscallX functions so they call
syscall_SyscallN with an argument slice of the right length.

While here, remove the hack in syscall_SyscallN to support less than 4
arguments, and update instead asmstdcall on amd64 to properly handle
this case.

Change-Id: I0328e14f34c2b000fde06cc6a579b09e8c32f2b9
Reviewed-on: https://go-review.googlesource.com/c/go/+/563315
TryBot-Result: Gopher Robot <gobot@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Run-TryBot: Quim Muntal <quimmuntal@gmail.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
14 months agocontext: update doc comment to link to context interface
ALX99 [Sat, 17 Feb 2024 04:43:34 +0000 (04:43 +0000)]
context: update doc comment to link to context interface

Linking to the Context interface in the WithCancel doc comment makes
it more consistent with the WithDeadline and WithTimeout doc comments.

Change-Id: Ic935c63e8262784be5f3564816402221ba2fbd63
GitHub-Last-Rev: 9c6bb607a94f6f4cd27cc3f5e39c192e088ab386
GitHub-Pull-Request: golang/go#65768
Reviewed-on: https://go-review.googlesource.com/c/go/+/564996
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

14 months agocmd/compile: remove unused code in walk.Walk
Ezzno J [Thu, 4 Jan 2024 09:49:56 +0000 (09:49 +0000)]
cmd/compile: remove unused code in walk.Walk

no errors'll be added during ir.DumpList, no need to be check again

Change-Id: I85ae2edd4377851277e9bb2a8baa28825ac3fd90
GitHub-Last-Rev: b35ca85e57d81002adad4b1ffc9506f359201b71
GitHub-Pull-Request: golang/go#64955
Reviewed-on: https://go-review.googlesource.com/c/go/+/553895
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: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
14 months agoreflect: make Value.Comparable return true for nil interface value
Jes Cok [Fri, 16 Feb 2024 21:16:29 +0000 (21:16 +0000)]
reflect: make Value.Comparable return true for nil interface value

Fixes #65718

Change-Id: I0b3edf9085f2d71f915bdf8ff9d312509b438c5f
GitHub-Last-Rev: 9fb1ca1a631c648d1f38f75b1fcb2f878048706b
GitHub-Pull-Request: golang/go#65750
Reviewed-on: https://go-review.googlesource.com/c/go/+/564795
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Commit-Queue: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

14 months agocmd/internal/obj/ppc64: cleanup optab entries after renaming
Paul E. Murphy [Wed, 15 Nov 2023 21:51:41 +0000 (15:51 -0600)]
cmd/internal/obj/ppc64: cleanup optab entries after renaming

Combine MOVW/MOVD using C_16CON as they accept any 16 bit
constant.

Remove MULLW/MULLD C_U16CON optab entry. These assemble to
the mulli opcode which only accepts a signed 16 bit constant.

Remove superfluous optab entrys for VSPLTB and VSPLTISB,
as C_S16CON accepts C_U15CON arguments.

Change-Id: Ie20dd07bcedda428fb1dd674474d7dfa67d76dc1
Reviewed-on: https://go-review.googlesource.com/c/go/+/563915
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Paul Murphy <murp@ibm.com>
Reviewed-by: Lynn Boger <laboger@linux.vnet.ibm.com>
Reviewed-by: Eli Bendersky <eliben@google.com>
14 months agointernal/abi: get rid of itab blank field
Keith Randall [Wed, 13 Dec 2023 21:45:05 +0000 (13:45 -0800)]
internal/abi: get rid of itab blank field

We don't need it anymore, as we're accessing all the field offsets
symbolically.
This won't affect 64-bit, but it makes itabs on 32-bit 4 bytes smaller.

Change-Id: I7fb937813111476fd5ab03005b248ea7bb962cf6
Reviewed-on: https://go-review.googlesource.com/c/go/+/549517
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>

14 months agocmd/compile: use symbolic offsets of fields in internal/abi.ITab
Keith Randall [Wed, 13 Dec 2023 21:20:01 +0000 (13:20 -0800)]
cmd/compile: use symbolic offsets of fields in internal/abi.ITab

After this CL, we can reorder or pad internal/abi.ITab fields at will
(keeping Fun last, and updating ITabTypeOff correctly) without
breaking anything.

Change-Id: Ib7bb5828519813e0d1aa36be5092f96fcd62b3be
Reviewed-on: https://go-review.googlesource.com/c/go/+/549516
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
14 months agoreflect: use internal/abi itab type
Keith Randall [Wed, 13 Dec 2023 20:46:39 +0000 (12:46 -0800)]
reflect: use internal/abi itab type

Change-Id: I4a40d9cda41d3601169ef0daf0f25fb1509bdcb7
Reviewed-on: https://go-review.googlesource.com/c/go/+/549458
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: David Chase <drchase@google.com>
14 months agocmd/dist,cmd/go: define assembly macros, handle GOARM value with soft/hardfloat
Cherry Mui [Fri, 9 Feb 2024 19:17:18 +0000 (14:17 -0500)]
cmd/dist,cmd/go: define assembly macros, handle GOARM value with soft/hardfloat

CL 525637 added GOARM_x assembly macros based on GOARM value. But
it did not define the macro in cmd/dist, so the macro is not set
during bootstrapping. This CL defines them.

With CL 514907, cfg.GOARM can also take a soft/hardfloat suffix,
like "7,hardfloat". Handle that case.

For #65601.

Change-Id: I60ffe7e8b623ae693d91d6e8595067a6f76565b3
Reviewed-on: https://go-review.googlesource.com/c/go/+/562995
Run-TryBot: Cherry Mui <cherryyz@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

14 months agoruntime/internal/atomic: correct GOARM=7 guard at a DMB instruction
Cherry Mui [Fri, 16 Feb 2024 15:58:56 +0000 (10:58 -0500)]
runtime/internal/atomic: correct GOARM=7 guard at a DMB instruction

CL 525637 changed to the guard of DMB instruction from the
compiled-in runtime.goarm value to GOARM_7 macro and CPU feature
detection. It missed a place where runtime.goarm is loaded to a
register and reused later. This CL corrects the condition.

Fixes #65601.

Change-Id: I2ddefd03a1eb1048dbec0254c6e234c65b054279
Reviewed-on: https://go-review.googlesource.com/c/go/+/564855
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
14 months agocmd/go: do not embed checksums when building with vendor
Sam Thanawalla [Wed, 14 Feb 2024 21:01:53 +0000 (21:01 +0000)]
cmd/go: do not embed checksums when building with vendor

Fixes #46400

Tested: Ran go test cmd/go
Change-Id: I60655129c55d40a70a13ed23937ef990f315fd73
Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest,gotip-windows-amd64-longtest
Reviewed-on: https://go-review.googlesource.com/c/go/+/564195
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Sam Thanawalla <samthanawalla@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Commit-Queue: Sam Thanawalla <samthanawalla@google.com>

14 months agocmd/go: show Sum/GoModSum when listing modules
Sam Thanawalla [Thu, 8 Feb 2024 18:32:55 +0000 (18:32 +0000)]
cmd/go: show Sum/GoModSum when listing modules

Fixes #52792

Tested: Ran go test cmd/go
Change-Id: Ib7006256f4dca9e9fbfce266c00253c69595d6ab
Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest,gotip-windows-amd64-longtest
Reviewed-on: https://go-review.googlesource.com/c/go/+/562775
Reviewed-by: Bryan Mills <bcmills@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

14 months agodatabase/sql/driver: add a new test case for type t
sivchari [Wed, 2 Aug 2023 02:55:17 +0000 (02:55 +0000)]
database/sql/driver: add a new test case for type t

Change-Id: I38bb68570f7f097a6dfeef1c75896396992d81f7
GitHub-Last-Rev: 10ba48a546956fa2a5b602680fb312638aade92d
GitHub-Pull-Request: golang/go#53706
Reviewed-on: https://go-review.googlesource.com/c/go/+/416234
Reviewed-by: Than McIntosh <thanm@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
14 months agocrypto/subtle: remove unused code
qiulaidongfeng [Fri, 16 Feb 2024 09:52:40 +0000 (09:52 +0000)]
crypto/subtle: remove unused code

Change-Id: I4e360e643d101a8f2188a2318557b0430a89d5cd
GitHub-Last-Rev: 046943ff482ff8e5665a50f62fcb63fa3bcf868e
GitHub-Pull-Request: golang/go#65747
Reviewed-on: https://go-review.googlesource.com/c/go/+/564736
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Than McIntosh <thanm@google.com>
14 months agocrypto/subtle: use min builtin function in XORBytes
qiulaidongfeng [Fri, 16 Feb 2024 10:24:55 +0000 (10:24 +0000)]
crypto/subtle: use min builtin function in XORBytes

Change-Id: Ibf57dbaaa54486823e0769714dec2e22d6c5ea9e
GitHub-Last-Rev: 31421d066833f721f3fa261ac9dc49724fffb5f8
GitHub-Pull-Request: golang/go#65748
Reviewed-on: https://go-review.googlesource.com/c/go/+/564577
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
14 months agocmd/pprof: update vendored github.com/google/pprof
Dmitri Shuralyov [Fri, 16 Feb 2024 04:59:52 +0000 (23:59 -0500)]
cmd/pprof: update vendored github.com/google/pprof

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. Done with:

go get github.com/google/pprof
go mod tidy
go mod vendor

For #36905.
Fixes #65741.

Change-Id: Ice7b085c03ff69be97929cbe47bfd91954907529
Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest
Reviewed-on: https://go-review.googlesource.com/c/go/+/564636
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
14 months agocmd/link: replace function pointers to static calls in loadelf
Cherry Mui [Thu, 15 Feb 2024 22:05:05 +0000 (17:05 -0500)]
cmd/link: replace function pointers to static calls in loadelf

When transitioning between the old object loader and the new
object loader, to support both we made loadelf to take symbol
loading functions as function pointers. Now we only have the new
object loader. Change the function pointers back to static calls.

Change-Id: Ia623a6010376a3d7c0be5eacae002144d956f28a
Reviewed-on: https://go-review.googlesource.com/c/go/+/564635
Reviewed-by: Than McIntosh <thanm@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

14 months agocmd/link: add -randlayout flag to randomize function ordering
Cherry Mui [Tue, 6 Feb 2024 23:08:34 +0000 (18:08 -0500)]
cmd/link: add -randlayout flag to randomize function ordering

Sometimes we found that benchmark results may strongly depend on
the ordering of functions laid out in the binary. This CL adds a
flag -randlayout=seed, which randomizes the function layout (in a
deterministic way), so can verify the benchmark results against
different function ordering.

Change-Id: I85f33881bbfd4ca6812fbd4bec00bf475755a09e
Reviewed-on: https://go-review.googlesource.com/c/go/+/562157
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Than McIntosh <thanm@google.com>
14 months agoruntime,cmd/link: merge pcbucketsize const into internal/abi
qiulaidongfeng [Fri, 16 Feb 2024 00:15:29 +0000 (00:15 +0000)]
runtime,cmd/link: merge pcbucketsize const into internal/abi

For #59670

Change-Id: I6343bacd3126fe6381a2e73be10f61691792824d
GitHub-Last-Rev: bbab8d1142e5749f58c17f6f668e2eb679ff69d7
GitHub-Pull-Request: golang/go#65373
Reviewed-on: https://go-review.googlesource.com/c/go/+/559475
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
14 months agocmd/compile: improve rotations for riscv64
Joel Sing [Thu, 1 Feb 2024 12:58:54 +0000 (23:58 +1100)]
cmd/compile: improve rotations for riscv64

Enable canRotate for riscv64, enable rotation intrinsics and provide
better rewrite implementations for rotations. By avoiding Lsh*x64
and Rsh*Ux64 we can produce better code, especially for 32 and 64
bit rotations. By enabling canRotate we also benefit from the generic
rotation rewrite rules.

Benchmark on a StarFive VisionFive 2:

               │   rotate.1   │              rotate.2               │
               │    sec/op    │   sec/op     vs base                │
RotateLeft-4     14.700n ± 0%   8.016n ± 0%  -45.47% (p=0.000 n=10)
RotateLeft8-4     14.70n ± 0%   10.69n ± 0%  -27.28% (p=0.000 n=10)
RotateLeft16-4    14.70n ± 0%   12.02n ± 0%  -18.23% (p=0.000 n=10)
RotateLeft32-4   13.360n ± 0%   8.016n ± 0%  -40.00% (p=0.000 n=10)
RotateLeft64-4   13.360n ± 0%   8.016n ± 0%  -40.00% (p=0.000 n=10)
geomean           14.15n        9.208n       -34.92%

Change-Id: I1a2036fdc57cf88ebb6617eb8d92e1d187e183b2
Reviewed-on: https://go-review.googlesource.com/c/go/+/560315
Reviewed-by: M Zhuo <mengzhuo1203@gmail.com>
Run-TryBot: Joel Sing <joel@sing.id.au>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Mark Ryan <markdryan@rivosinc.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: David Chase <drchase@google.com>
14 months agosyscall: rm obsoleted comment
Kir Kolyshkin [Wed, 15 Nov 2023 00:28:29 +0000 (16:28 -0800)]
syscall: rm obsoleted comment

The comment being removed is no longer true as of CL 494916.

Change-Id: I4975866c58efb5c9c41db3640564ac7233f5840f
Reviewed-on: https://go-review.googlesource.com/c/go/+/542415
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Run-TryBot: Kirill Kolyshkin <kolyshkin@gmail.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

14 months agocmd/compile: update the incorrect assignment of call site offset.
Jin Lin [Thu, 8 Feb 2024 20:52:07 +0000 (12:52 -0800)]
cmd/compile: update the incorrect assignment of call site offset.

The call site calculation in the previous version is incorrect. For
the PGO preprocess file, the compiler should directly use the call
site offset value. Additionly, this change refactors the preprocess
tool to clean up unused fields including startline, the flat and the
cum.

Change-Id: I7bffed3215d4c016d9a9e4034bfd373bf50ab43f
Reviewed-on: https://go-review.googlesource.com/c/go/+/562795
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
14 months agolog/slog: add test case for level_test.go
pgxiaolianzi [Wed, 7 Feb 2024 07:45:14 +0000 (07:45 +0000)]
log/slog: add test case for level_test.go

adds a test case for the MarshalJSON and MarshalText method of the Level type in the slog package.

Change-Id: I3f79f0b46c41252ad9d743e03e34503e19998f3e
GitHub-Last-Rev: dab00d4c206ca59fcca7ee8d97ca8cdc9475fdce
GitHub-Pull-Request: golang/go#65525
Reviewed-on: https://go-review.googlesource.com/c/go/+/561315
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
14 months agolog/slog: document atomicity guarantees and ordering limitations of handlers
Joe Tsai [Tue, 13 Feb 2024 23:34:26 +0000 (15:34 -0800)]
log/slog: document atomicity guarantees and ordering limitations of handlers

The new wording is slightly more strict than before in that
it guarantees each Write only contains exactly one Record,
while the previous wording opened up the possibility for
multiple Records in a Write call.

We also add a comment about the lack of sorting guarantees for
concurrently logged Records. That is, the obtained lock only covers
the Write call, rather than the combination of the call to time.Now,
JSON/text serialization, and also the Write call.

Change-Id: Ia65c50579215a35a1f5b2952c6954ddb60e7fe66
Reviewed-on: https://go-review.googlesource.com/c/go/+/563976
Reviewed-by: Jonathan Amsterdam <jba@google.com>
TryBot-Bypass: Jonathan Amsterdam <jba@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
14 months agonet/http: reject requests with invalid Content-Length headers
Andy Pan [Sun, 4 Feb 2024 06:50:42 +0000 (14:50 +0800)]
net/http: reject requests with invalid Content-Length headers

According to RFC 9110 and RFC 9112, invalid "Content-Length" headers
might involve request smuggling or response splitting, which could
also cause security failures. Currently, `net/http` ignores all
"Content-Length" headers when there is a "Transfer-Encoding" header and
forward the message anyway while other mainstream HTTP implementations
such as Apache Tomcat, Nginx, HAProxy, Node.js, Deno, Tornado, etc. reject
invalid Content-Length headers regardless of the presence of a
"Transfer-Encoding" header and only forward chunked-encoding messages
with either valid "Content-Length" headers or no "Content-Length" headers.

Fixes #65505

Change-Id: I73af2ee0785137e56c7546a4cce4a5c5c348dbc5
Reviewed-on: https://go-review.googlesource.com/c/go/+/561075
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
14 months agocmd/link/internal/ld: unify OS/SDK versions for macOS linking
Dmitri Shuralyov [Wed, 14 Feb 2024 16:52:22 +0000 (11:52 -0500)]
cmd/link/internal/ld: unify OS/SDK versions for macOS linking

Go 1.23 will require macOS 11 Big Sur or later, even on AMD64.
The comment here suggests the main requirement for the OS and
SDK version is to be recent enough not to break Apple signing,
and recent enough not to cause other problems.

For now, this CL simplifies the code by merging the ARM64 and
AMD64 cases into one, given 1.23 will be the first Go release
with a common minimum macOS version for both architectures so
there's no need to treat them separately here.

For #64207.

Change-Id: I821fcb9a2a316de0703833c8a75abcbaa10b17a3
Cq-Include-Trybots: luci.golang.try:gotip-darwin-amd64_11,gotip-darwin-amd64_14,gotip-darwin-arm64_11,gotip-darwin-arm64_13
Reviewed-on: https://go-review.googlesource.com/c/go/+/563857
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
14 months agodoc/go1.23: document macOS requirements
Dmitri Shuralyov [Wed, 14 Feb 2024 16:25:03 +0000 (11:25 -0500)]
doc/go1.23: document macOS requirements

For #64207.
For #65614.

Change-Id: Ia5365b4090060e0657c255341751d3e67691f836
Reviewed-on: https://go-review.googlesource.com/c/go/+/563856
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
14 months agoruntime: make netpoll events sources identifiable on Windows
qmuntal [Thu, 8 Feb 2024 07:46:24 +0000 (08:46 +0100)]
runtime: make netpoll events sources identifiable on Windows

This is another attempt at CL 558895, but without adding stale pollDescs
protection, which deviates from the original goal of the CL and adds
complexity without proper testing.

It is currently not possible to distinguish between a netpollBreak,
an internal/poll WSA operation, and an external WSA operation (as
in #58870). This can cause spurious wakeups when external WSA operations
are retrieved from the queue, as they are treated as netpollBreak
events.

This CL makes use of completion keys to identify the source of the
event.

While here, fix TestWSASocketConflict, which was not properly
exercising the "external WSA operation" case.

Change-Id: I91f746d300d32eb7fed3c8f27266fef379360d98
Reviewed-on: https://go-review.googlesource.com/c/go/+/561895
Reviewed-by: Than McIntosh <thanm@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
14 months agonet: skip TestModeSocket on older Windows versions
qmuntal [Mon, 12 Feb 2024 10:04:24 +0000 (11:04 +0100)]
net: skip TestModeSocket on older Windows versions

CL 561937 taught os.Stat about IO_REPARSE_TAG_AF_UNIX and added a
test for it, TestModeSocket. This test fails on Windows older than
10.0.17063, in which AF_UNIX support was added. Skip the test on those
versions.

Some CI builders use Windows 10.0.14393, so CL 561937 broke them,
e.g. https://build.golang.org/log/5ea4f6422779f32eccfef3a25df54283ddd4e65e.

Change-Id: I6c21a78a1454d2d88321478288c0da1b8a93e590
Reviewed-on: https://go-review.googlesource.com/c/go/+/563256
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
14 months agoruntime/cgo: mark fatalf as noreturn
Mauri de Souza Meneguzzo [Fri, 15 Dec 2023 02:02:41 +0000 (02:02 +0000)]
runtime/cgo: mark fatalf as noreturn

Fixes #64553

Change-Id: I7860cd9ba74d70a7d988538ea4df8e122f94cde6
GitHub-Last-Rev: 06164374734aef5b94566930426005ad66d0a5b6
GitHub-Pull-Request: golang/go#64727
Reviewed-on: https://go-review.googlesource.com/c/go/+/550115
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Run-TryBot: Mauri de Souza Meneguzzo <mauri870@gmail.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
14 months agointernal/asan: add new package
Mauri de Souza Meneguzzo [Wed, 7 Feb 2024 22:51:00 +0000 (22:51 +0000)]
internal/asan: add new package

The internal/asan package contains helper functions for manually
instrumenting code for the address sanitizer. It reexports the asan
routines in runtime unconditionally, making the functions a no-op if the
build flag "asan" is not present.

For #64611

Change-Id: Ie79e698aea7a6d969afd2a5f008c084c9545b1a5
GitHub-Last-Rev: e658670c146adb5a5496afe4a2425dd5291fd7ac
GitHub-Pull-Request: golang/go#64635
Reviewed-on: https://go-review.googlesource.com/c/go/+/548695
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

14 months agocmd/internal/obj/ppc64: rename and remove aliased optab classifiers
Paul E. Murphy [Tue, 14 Nov 2023 20:58:49 +0000 (14:58 -0600)]
cmd/internal/obj/ppc64: rename and remove aliased optab classifiers

Rename C_LCON, C_SCON, C_ADDCON, C_ANDCON into their aliased names
and remove them.

Change-Id: I8f67cc973f8059e65b81669d91a44500fc136b0a
Reviewed-on: https://go-review.googlesource.com/c/go/+/563097
Run-TryBot: Paul Murphy <murp@ibm.com>
Reviewed-by: Lynn Boger <laboger@linux.vnet.ibm.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: David Chase <drchase@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

14 months agonet/http: close connection if OnProxyConnectResponse returns an error
Damien Neil [Sat, 3 Feb 2024 00:19:37 +0000 (16:19 -0800)]
net/http: close connection if OnProxyConnectResponse returns an error

Fixes #64804

Change-Id: Ibe56ab8d114b8826e477b0718470d0b9fbfef9b0
Reviewed-on: https://go-review.googlesource.com/c/go/+/560856
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
14 months agonet/http: refine trailing-slash redirect logic
Jonathan Amsterdam [Fri, 9 Feb 2024 15:18:38 +0000 (10:18 -0500)]
net/http: refine trailing-slash redirect logic

Do not add a trailing slash and redirect if the path already
ends in a slash.

Also, and unrelatedly, add a test for cleanPath.

Fixes #65624.

Change-Id: Ifcf9edc929d2eb6db88132c09d2bade85c5dda3d
Reviewed-on: https://go-review.googlesource.com/c/go/+/562557
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

14 months agointernal/safefilepath: use bytealg to search for zero byte
Ian Lance Taylor [Mon, 12 Feb 2024 03:54:52 +0000 (19:54 -0800)]
internal/safefilepath: use bytealg to search for zero byte

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

14 months agotime: fix typo in ExampleParseDuration
Rob Pike [Mon, 12 Feb 2024 00:35:29 +0000 (11:35 +1100)]
time: fix typo in ExampleParseDuration

A typo without consequences, but confusing nonetheless. The last
line prints micro2 and then micro, instead of micro2 twice.
One-character fix.

Fixes #65666

Change-Id: I61d636382a2223d53eac58d6ddbcc7c15b4efc85
Reviewed-on: https://go-review.googlesource.com/c/go/+/563275
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Run-TryBot: Rob Pike <r@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>

14 months agofmt: clear width and precision when recovering formatting object from the pool
Rob Pike [Wed, 17 Jan 2024 00:19:53 +0000 (11:19 +1100)]
fmt: clear width and precision when recovering formatting object from the pool

Probably a day 1 oversight, and almost always inconsequential, but
there is evidence of occasional trouble. There is no reason not to
clear them.

I tried and failed to write a test to catch this, but the change should
be harmless and is all but certain to fix the problem.

Fixes #61913

Change-Id: I0f7bbb4ab2780d8999d3ff7a35255dc07fb5c7e1
Reviewed-on: https://go-review.googlesource.com/c/go/+/556215
Run-TryBot: Rob Pike <r@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
14 months agofmt: document how %#g handles infinities and NaNs
Rob Pike [Sun, 21 Jan 2024 06:20:02 +0000 (17:20 +1100)]
fmt: document how %#g handles infinities and NaNs

The %#g format prints a "Go-syntax representation", but there is
no such thing for IEEE754 infinities and NaNs, so just document
what happens, which is that it prints +Inf, -Inf, or NaN.  We could
show something like math.Inf(1) and math.Nan(), but that doesn't
sit right, and anyway for NaNs you can't even recover the original
value. Simpler and more honest to give up.

Fixes #51486

Change-Id: I8d4e8186f5d7acc3e0e7b51d0b322142908ea0a2
Reviewed-on: https://go-review.googlesource.com/c/go/+/557235
Run-TryBot: Rob Pike <r@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
14 months agoruntime/cgo: add note about default stack bounds
Michael Pratt [Mon, 12 Feb 2024 19:32:22 +0000 (14:32 -0500)]
runtime/cgo: add note about default stack bounds

The default case in x_cgo_getstackbound does not actually get the stack bound of
the current thread, but estimates the bound based on the default stack size. Add
a comment noting this.

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

14 months agoruntime: skip failing traceback test on Android
Alan Donovan [Mon, 12 Feb 2024 15:34:54 +0000 (10:34 -0500)]
runtime: skip failing traceback test on Android

See e.g. https://build.golang.org/log/1e6bd28cf75679c66479025c1a0d9082734cf33e

Change-Id: Ic13bc0a40d04afe693d1de07973e2540dadacb23
Reviewed-on: https://go-review.googlesource.com/c/go/+/563415
Reviewed-by: Than McIntosh <thanm@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

14 months agointernal/xcoff: change zeroReaderAt to nobitsSectionReader for .bss with all 0s
Jes Cok [Sat, 10 Feb 2024 01:25:05 +0000 (01:25 +0000)]
internal/xcoff: change zeroReaderAt to nobitsSectionReader for .bss with all 0s

Fixes #63337

Change-Id: I239315047e6e4325e2f471108fd764f8dbb7d5b2
GitHub-Last-Rev: cacdf0a279451ab97e6e6ce3fe0d3a025f5ce3aa
GitHub-Pull-Request: golang/go#64952
Reviewed-on: https://go-review.googlesource.com/c/go/+/553616
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>
Reviewed-by: Than McIntosh <thanm@google.com>
14 months agoreflect: optimize TypeFor for non-interface types
Joe Tsai [Sat, 13 Jan 2024 02:13:14 +0000 (18:13 -0800)]
reflect: optimize TypeFor for non-interface types

The reflect.Type.Elem method is somewhat slow,
which is unfortunate since the reflect.TypeOf((*T)(nil)).Elem()
trick is only needed if T is an interface.

Optimize for concrete types by doing the faster reflect.TypeOf(v)
call first and only falling back on the Elem method if needed.

Performance:

name              old time/op  new time/op  delta
TypeForString-24  9.10ns ± 1%  1.78ns ± 2%  -80.49%  (p=0.000 n=10+10)
TypeForError-24   9.55ns ± 1%  9.78ns ± 1%   +2.39%  (p=0.000 n=10+9)

Updates #60088

Change-Id: I2ae76988c9a3dbcbae10d2c19b55db3c8d4559bf
Reviewed-on: https://go-review.googlesource.com/c/go/+/555597
Auto-Submit: Joseph Tsai <joetsai@digital-static.net>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Run-TryBot: Joseph Tsai <joetsai@digital-static.net>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Mauri de Souza Meneguzzo <mauri870@gmail.com>
14 months agonet/http: remove superfluous newline on redirects
codesoap [Thu, 8 Feb 2024 22:18:27 +0000 (22:18 +0000)]
net/http: remove superfluous newline on redirects

Change-Id: I30d3ae9d540f9cc85ea5a6875ee8884d3e646d6f
GitHub-Last-Rev: 29cabdcb3a8746ef51953617f4ec47deac3608da
GitHub-Pull-Request: golang/go#65623
Reviewed-on: https://go-review.googlesource.com/c/go/+/562356
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
TryBot-Bypass: Dmitri Shuralyov <dmitshur@golang.org>

14 months agoos: add os.ModeSocket support to os.Stat on windows
qmuntal [Wed, 7 Feb 2024 16:40:24 +0000 (17:40 +0100)]
os: add os.ModeSocket support to os.Stat on windows

Unix sockets are identified by the IO_REPARSE_TAG_AF_UNIX reparse tag.

Teach fileStat.Mode() to recognize this tag and set the os.ModeSocket
bit in such case.

Note that there is a bug starting in Windows 19H1 until 20H1 that
makes the IO_REPARSE_TAG_AF_UNIX tag not being set for unix sockets.
This CL doesn't provide a workaround for this bug.

Fixes #33357.

Change-Id: Iea8f24b20672c8d4b03f55ef298d128431dc3fac
Reviewed-on: https://go-review.googlesource.com/c/go/+/561937
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
14 months agoruntime/cgo: ignore -Watomic-alignment in gcc_libinit.c
Mauri de Souza Meneguzzo [Fri, 9 Feb 2024 11:47:26 +0000 (11:47 +0000)]
runtime/cgo: ignore -Watomic-alignment in gcc_libinit.c

When cross-compiling a cgo program with CC=clang for Linux/ARMv5,
atomic warnings cause build errors, as cgo uses -Werror.

These warnings seem to be harmless and come from the usage of
__atomic_load_n, which is emulated due to the lack of atomic
instructions in armv5.

Fixes #65290

Change-Id: Ie72efb77468f06888f81f15850401dc8ce2c78f9
GitHub-Last-Rev: fbad847b962f6b4599cd843018e79f4b55be097e
GitHub-Pull-Request: golang/go#65588
Reviewed-on: https://go-review.googlesource.com/c/go/+/562348
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>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
14 months agoio/fs: set ErrInvalid for FS.Open from SubFS when it fails ValidPath
Andy Pan [Thu, 1 Feb 2024 03:28:44 +0000 (11:28 +0800)]
io/fs: set ErrInvalid for FS.Open from SubFS when it fails ValidPath

Fixes #65419

Change-Id: I8f9f82ab0387d8bb39aaca4f9e60e36ee15c587d
Reviewed-on: https://go-review.googlesource.com/c/go/+/560137
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
14 months agonet: skip BenchmarkSendFile on Windows
Andy Pan [Thu, 8 Feb 2024 02:15:53 +0000 (10:15 +0800)]
net: skip BenchmarkSendFile on Windows

Follow up CL 543276

Change-Id: Ie02cf8a489a069bb0a3be1d8636e30d0658329c5
Reviewed-on: https://go-review.googlesource.com/c/go/+/562595
Reviewed-by: Bryan Mills <bcmills@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>

14 months agoruntime: call traceAdvance before exiting
Nicolas Hillegeer [Thu, 8 Feb 2024 16:56:33 +0000 (08:56 -0800)]
runtime: call traceAdvance before exiting

This ensures the trace buffers are as up-to-date as possible right
before crashing. It increases the chance of finding the culprit for the
crash when looking at core dumps, e.g. if slowness is the cause for the
crash (monitor kills process).

Fixes #65319.

Change-Id: Iaf5551911b3b3b01ba65cb8749cf62a411e02d9c
Reviewed-on: https://go-review.googlesource.com/c/go/+/562616
Auto-Submit: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
14 months agonet: don't retry truncated TCP responses
Antonio Ojea [Fri, 22 Dec 2023 18:15:34 +0000 (18:15 +0000)]
net: don't retry truncated TCP responses

UDP messages may be truncated:

https://www.rfc-editor.org/rfc/rfc1035#section-4.2.1

> Messages carried by UDP are restricted to 512 bytes (not counting
> the IP or UDP headers). Longer messages are truncated and the TC
> bit is set in the header.

However, TCP also have a size limitation of 65535 bytes

https://www.rfc-editor.org/rfc/rfc1035#section-4.2.2

> The message is prefixed with a two byte length field which gives
the message length, excluding the two byte length field.

These limitations makes that the maximum possible number of A records
per RRSet is ~ 4090.

There are environments like Kubernetes that may have larger number of
records (5000+) that does not fit in a single message. In this cases,
the DNS server sets the Truncated bit on the message to indicate that
it could not send the full answer despite is using TCP.

We should only retry when the TC bit is set and the connection is UDP,
otherwise, we'll never being able to get an answer and the client will
receive an errNoAnswerFromDNSServer, that is a different behavior than
the existing in the glibc resolver, that returns all the existing
addresses in the TCP truncated response.

Fixes #64896

Signed-off-by: Antonio Ojea <aojea@google.com>
Change-Id: I1bc2c85f67668765fa60b5c0378c9e1e1756dff2
Reviewed-on: https://go-review.googlesource.com/c/go/+/552418
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Gudger <ian@iangudger.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Mateusz Poliwczak <mpoliwczak34@gmail.com>
Reviewed-by: Mauri de Souza Meneguzzo <mauri870@gmail.com>
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

14 months agocmd/internal/obj/ppc64: add new constant optab classifications
Paul E. Murphy [Tue, 14 Nov 2023 20:45:21 +0000 (14:45 -0600)]
cmd/internal/obj/ppc64: add new constant optab classifications

Make C_S32CON, C_U32CON, and C_32CON distinct classifiers to allow
more specific matching of 32 bit constants. C_U31CON is added to
support C_S32CON.

Likewise, add C_16CON which is the union of C_S16CON and C_U16CON
classification. This wil allow simplifying MOVD/MOVW optab entries
in a future patch.

Change-Id: I193acc0ded8f3edd91d306e39c3e7e55a9811e04
Reviewed-on: https://go-review.googlesource.com/c/go/+/562346
Reviewed-by: Lynn Boger <laboger@linux.vnet.ibm.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Run-TryBot: Paul Murphy <murp@ibm.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

14 months agointernal/trace: run children in race mode during race testing
Michael Pratt [Fri, 9 Feb 2024 19:06:39 +0000 (14:06 -0500)]
internal/trace: run children in race mode during race testing

This would have caught #65607.

On my machine:

internal/trace/v2:               ~13s
internal/trace/v2: -short:        ~4s
internal/trace/v2: -race -short: ~20s
internal/trace/v2: -race:        ~46s

For #65607.

Change-Id: I03a555ebaf8c761c98a82b6d35fa16d7a99aa9e3
Reviewed-on: https://go-review.googlesource.com/c/go/+/562998
Auto-Submit: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
14 months agointernal/trace: fix race condition in gc-stress
Michael Pratt [Fri, 9 Feb 2024 19:16:11 +0000 (14:16 -0500)]
internal/trace: fix race condition in gc-stress

Multiple goroutines all writing to the same sink triggers the race detector,
rightfully so.

Change-Id: Ia64836d0d88c0f587a6cb96ed747f656a3c1804a
Reviewed-on: https://go-review.googlesource.com/c/go/+/562997
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
14 months agoruntime: don't call traceReadCPU on the system stack
Michael Pratt [Fri, 9 Feb 2024 18:49:21 +0000 (13:49 -0500)]
runtime: don't call traceReadCPU on the system stack

traceReadCPU calls profBuf.read, which does a raceacquire. g0 does not
have a race context, so this crashes when running on the system stack.

We could borrow a race context, but it is simpler to just move
traceReadCPU off of the system stack.

Fixes #65607.

Change-Id: I335155b96d683aebb92b2f4e1eea063dd139f2d5
Reviewed-on: https://go-review.googlesource.com/c/go/+/562996
Auto-Submit: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
14 months agocmd/compile: fail noder.LookupFunc gracefully if function generic
Michael Pratt [Thu, 8 Feb 2024 18:07:33 +0000 (13:07 -0500)]
cmd/compile: fail noder.LookupFunc gracefully if function generic

PGO uses noder.LookupFunc to look for devirtualization targets in
export data.  LookupFunc does not support type-parameterized
functions, and will currently fail the build when attempting to lookup
a type-parameterized function because objIdx is passed the wrong
number of type arguments.

This doesn't usually come up, as a PGO profile will report a generic
function with a symbol name like Func[.go.shape.foo]. In export data,
this is just Func, so when we do LookupFunc("Func[.go.shape.foo]")
lookup simply fails because the name doesn't exist.

However, if Func is not generic when the profile is collected, but the
source has since changed to make Func generic, then LookupFunc("Func")
will find the object successfully, only to fail the build because we
failed to provide type arguments.

Handle this with a objIdxMayFail, which allows graceful failure if the
object requires type arguments.

Bumping the language version to 1.21 in pgo_devirtualize_test.go is
required for type inference of the uses of mult.MultFn in
cmd/compile/internal/test/testdata/pgo/devirtualize/devirt_test.go.

Fixes #65615.

Change-Id: I84d9344840b851182f5321b8f7a29a591221b29f
Reviewed-on: https://go-review.googlesource.com/c/go/+/562737
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

14 months agocmd/cgo/internal/testsanitizers: disable location checking for clang
Michael Anthony Knyszek [Thu, 8 Feb 2024 15:59:07 +0000 (15:59 +0000)]
cmd/cgo/internal/testsanitizers: disable location checking for clang

Pending a resolution to #65606, this CL marks clang's ASAN runtime as
unable to symbolize stack traces to unblock the LUCI clang builder.

For #65606.
Fixes #65469.

Change-Id: I649773085aff30e5703e7f7ac2c72a0430a015c2
Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-clang15
Reviewed-on: https://go-review.googlesource.com/c/go/+/562675
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

14 months agocmd/compile: separate inline cost analysis from applying inlining
Matthew Dempsky [Wed, 7 Feb 2024 18:23:53 +0000 (10:23 -0800)]
cmd/compile: separate inline cost analysis from applying inlining

This CL separates the pass that computes inlinability from the pass
that performs inlinability. In particular, the latter can now happen
in any flat order, rather than bottom-up order. This also allows
inlining of calls exposed by devirtualization.

Change-Id: I389c0665fdc8288a6e25129a6744bfb1ace1eff7
Reviewed-on: https://go-review.googlesource.com/c/go/+/562319
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
14 months agocmd/trace/v2,internal/trace: use correct frame for identifying goroutines
Nick Ripley [Wed, 7 Feb 2024 16:43:05 +0000 (11:43 -0500)]
cmd/trace/v2,internal/trace: use correct frame for identifying goroutines

To determine the identity of a goroutine for displaying in the trace UI,
we should use the root frame from a call stack. This will be the
starting function for the goroutine and is the same for each call stack
from a given goroutine. The new tracer no longer includes starting PCs
for goroutines which existed at the start of tracing, so we can't use a
PC for grouping together goroutines any more. Instead, we just use the
name of the entry function for grouping.

Fixes #65574

Change-Id: I5324653316f1acf0ab90c30680f181060ea45dd7
Reviewed-on: https://go-review.googlesource.com/c/go/+/562455
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
14 months agocontext: improve valueCtx.String
Joe Tsai [Sat, 13 Jan 2024 00:28:56 +0000 (16:28 -0800)]
context: improve valueCtx.String

Check for stringer on the key itself.
This is useful for locally defined context key types,
where there may be multiple instances of that type.
For example, see http.contextKey,
which can now be called after this change.

For the value itself, print the type at least
instead of just resorting to "<not stringer>".

Change-Id: I588ef1df34e90fb9ebd83cb180fea495e1fedaa8
Reviewed-on: https://go-review.googlesource.com/c/go/+/555697
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Run-TryBot: Joseph Tsai <joetsai@digital-static.net>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Joseph Tsai <joetsai@digital-static.net>
TryBot-Result: Gopher Robot <gobot@golang.org>

14 months agotime: fix FuzzFormatRFC3339 nano comparison
Jorropo [Mon, 5 Feb 2024 00:22:58 +0000 (01:22 +0100)]
time: fix FuzzFormatRFC3339 nano comparison

Change-Id: I13ed84b99459d5844abb6e932cc4b8e0bd3ae9f5
Reviewed-on: https://go-review.googlesource.com/c/go/+/561215
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>
Reviewed-by: David Chase <drchase@google.com>
14 months agosort: use math/rand/v2 in tests and benchmarks
Tobias Klauser [Tue, 23 Jan 2024 16:36:06 +0000 (17:36 +0100)]
sort: use math/rand/v2 in tests and benchmarks

This allows to drop the use of deprecated rand.Seed in benchmarks.

Fixes #61142

Change-Id: I628848c0d4a500dc9a361930c393e47c3361a95c
Reviewed-on: https://go-review.googlesource.com/c/go/+/551155
Reviewed-by: Eli Bendersky <eliben@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

14 months agoruntime: traceback: include pc=0x%x for inline frames
Alan Donovan [Mon, 5 Feb 2024 21:38:41 +0000 (16:38 -0500)]
runtime: traceback: include pc=0x%x for inline frames

Crash monitoring tools may parse the PC values and feed them
to CallersFrames, which does not run the inline unwinder, since
Callers already did so. So, the GOTRACEBACK=system output
must also include PC values even for inlined frames.
(The actual values are just marker NOP instructions,
but that isn't important.)

This CL also includes a test that the PC values can be
parsed out of the crash report and fed to CallersFrames
to yield a sensible result. (The logic is a distillation
of the x/telemetry crashmonitor.)

The previously printed PCs were in fact slightly wrong
for frames containing inlined calls: instead of the
virtual CALL instruction (a NOP) to the first
inlined call, it would display the PC of the
CALL in the innermost inlined function.

Change-Id: I64a06771fc191ba16c1383b8139b714f4f299703
Reviewed-on: https://go-review.googlesource.com/c/go/+/561635
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
14 months agocmd/compile: accept -lang=go1 as -lang=go1.0
Matthew Dempsky [Thu, 8 Feb 2024 01:25:48 +0000 (17:25 -0800)]
cmd/compile: accept -lang=go1 as -lang=go1.0

Fixes #65528.

Change-Id: I55fef8cf7be4654c7242462d45f12999e0c91c02
Reviewed-on: https://go-review.googlesource.com/c/go/+/562322
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Bryan Mills <bcmills@google.com>