Commit Graph

59183 Commits

Author SHA1 Message Date
Axel Wagner
8a0fbd75a5 encoding/xml: reject XML declaration after start of document
The XML specification requires an XML declaration, if present, to only
appear at the very beginning of the document, not even preceded by
whitespace. The parser currently accepts it at any part of the input.

Rejecting whitespace at the beginning of the file might break too many
users. This change instead only rejects an XML declaration preceded by
a non-whitespace token *and* allows the Encoder to emit whitespace
before an XML declaration. This means that a token stream produced by
the Decoder can be passed to the Encoder without error, while we still
don't emit clearly invalid XML.

This might break programs depending on Decoder allowing arbitrary XML
before the XML declaration.

Fixes #65691.

Change-Id: Ib1d4b3116aee63f40fd377f90595780b4befd1ee
Reviewed-on: https://go-review.googlesource.com/c/go/+/564035
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>
2024-02-22 22:50:20 +00:00
Nicolas Hillegeer
d892cb496a internal/trace/v2: make readBatch param more permissive
This function is copied to x/exp/trace. In https://go.dev/cl/566255 a
change is made where the source is a bytes.Reader instead of a
bufio.Reader from one of the two callers. Change the prototype here
instead of diverging the implementations.

Change-Id: I594224663996eadbc8c388442d68ac5706c52c8e
Reviewed-on: https://go-review.googlesource.com/c/go/+/566236
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>
2024-02-22 22:21:26 +00:00
Robert Griesemer
db57e5a040 go/types, types2: remove unreachable func (minor cleanup)
In some places we can't use unreachable() because it does
not terminate control flow and we need to resort to panic.
Be consistent and just use panic("unreachable") everywhere.
This also opens the door to reporting more specific panic
messages.

Mechanical change: s/unreachable()/panic("unreachable")/

Minor cleanup for better consistency.

Change-Id: I6b52af7c21dcfaa1ca19839d14040552db5d4cb4
Reviewed-on: https://go-review.googlesource.com/c/go/+/566135
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Findley <rfindley@google.com>
2024-02-22 19:32:17 +00:00
Robert Griesemer
f278f756bd go/types: : generate operand.go from types2 source
This CL reduces the amount of code that needs to be maintained
manually by about 400 LOC.

Change-Id: I03f77c8067aebfdb2a1cce6827ded733ff55e1cc
Reviewed-on: https://go-review.googlesource.com/c/go/+/565837
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>
2024-02-22 16:40:18 +00:00
Robert Griesemer
55bb3d1c10 go/types: : generate assignments.go from types2 source
This CL reduces the amount of code that needs to be maintained
manually by about 600 LOC.

Change-Id: I7107c8050075281bf6840a9f5234d70e09734ce6
Reviewed-on: https://go-review.googlesource.com/c/go/+/565836
Auto-Submit: Robert Griesemer <gri@google.com>
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>
2024-02-22 16:40:15 +00:00
Michael Pratt
638b9023e3 runtime: be careful about crash FD changes during panic
There are two separate cases here:

The base case is simple: a concurrent call to SetCrashOutput while
panicking will switch the crash FD, which could cause the first half of
writes to go to the old FD, and the second half to the new FD. This
isn't a correctness problem, but would be annoying to see in practice.
Since it is easy to check for, I simply drop any changes if panicking is
already in progress.

The second case is more important: SetCrashOutput will close the old FD
after the new FD is swapped, but writeErrData has no locking around use
of the fd, so SetCrashOutput could close the FD out from under
writeErrData, causing lost writes. We handle this similarly, by not
allowing SetCrashOutput to close the old FD if a panic is in progress,
but we have to be more careful about synchronization between
writeErrData and setCrashFD to ensure that writeErrData can't observe
the old FD while setCrashFD allows close.

For #42888.

Change-Id: I7270b2cc5ea58a15ba40145b7a96d557acdfe842
Reviewed-on: https://go-review.googlesource.com/c/go/+/559801
Reviewed-by: Alan Donovan <adonovan@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-02-22 15:37:30 +00:00
Alex Bozhenko
7fd62ba821 cmd/fix: support go versions with patch release
Support go version with patch release(e.g. 1.21.0)
and release candidates(e.g. 1.21rc1)
when parsing the go version in the fix command
by using new "go/version" package.

Fixes #62584

Change-Id: I0ec16137c7a396c68039d374c770c4021fb54b4e
GitHub-Last-Rev: 76bced5c48
GitHub-Pull-Request: golang/go#62586
Reviewed-on: https://go-review.googlesource.com/c/go/+/527342
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Russ Cox <rsc@golang.org>
Auto-Submit: Bryan Mills <bcmills@google.com>
Reviewed-by: Alex Bozhenko <alexbozhenko@gmail.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
2024-02-22 05:31:47 +00:00
guoguangwu
5d4e8f5162 go/doc: fix typo in comment
Change-Id: Idcfd649b8b8c8b47f5622702969bf2d43aa57354
GitHub-Last-Rev: cd38bee191
GitHub-Pull-Request: golang/go#65835
Reviewed-on: https://go-review.googlesource.com/c/go/+/565516
TryBot-Bypass: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: qiulaidongfeng <2645477756@qq.com>
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>
Commit-Queue: Ian Lance Taylor <iant@google.com>
2024-02-22 01:57:32 +00:00
Constantin Konstantinidis
507d1b22f4 cmd: remove support for GOROOT_FINAL
Fixes #62047

Change-Id: If7811c1eb9073fb09b7006076998f8b2e1810bfb
Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest,gotip-windows-amd64-longtest
Reviewed-on: https://go-review.googlesource.com/c/go/+/539975
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2024-02-21 22:16:54 +00:00
Andy Pan
05c0579621 runtime: migrate internal/syscall to internal/runtime
For #65355

Change-Id: I5fefe30dcb520159de565e61dafc74a740fc8730
Reviewed-on: https://go-review.googlesource.com/c/go/+/559715
Reviewed-by: 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>
2024-02-21 21:28:32 +00:00
Kir Kolyshkin
cdf3249d74 os: make FindProcess use pidfd on Linux
Amend FindProcess to use pidfdFind, and make it return ErrProcessDone
if pidfdFind is used and the process is not found.

Since this is a change in API, introduce GODEBUG osfinderr=0 setting
to disable the feature.

Change-Id: I724c6f622f0c99f21a70b864cf7cf2b8836869ee
Reviewed-on: https://go-review.googlesource.com/c/go/+/542699
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
2024-02-21 21:27:03 +00:00
Robert Griesemer
ccb6077d11 go/types, types2: handle Alias types in substitution
Fixes #65854.
For #65778. // for x/tools/cmd/gotype

Change-Id: I67d4644b28e831926fc6c233098aa1755c57162f
Reviewed-on: https://go-review.googlesource.com/c/go/+/565835
Auto-Submit: Robert Griesemer <gri@google.com>
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>
2024-02-21 21:26:51 +00:00
Kir Kolyshkin
750738b5d1 os: make use of pidfd on linux
Use Process.handle field to store pidfd, and make use of it. Only use
pidfd functionality if all the needed syscalls are available.

1. StartProcess: obtain the pidfd from the kernel, if available,
   using the functionality added by CL 520266. Note we could not modify
   syscall.StartProcess to return pidfd directly because it is a public
   API and its callers do not expect it, so we have to use ensurePidfd
   and getPidfd.

2. (*Process).Kill: use pidfdSendSignal, if the syscall is available
   and pidfd is known. This is slightly more complicated than it should
   be, since the syscall can be blocked by e.g. seccomp security policy,
   therefore the need for a function to check if it's actually working,
   and a soft fallback to kill. Perhaps this precaution is not really
   needed.

3. (*Process).Wait: use pidfdWait, if available, otherwise fall back to
   using waitid/wait4. This is also more complicated than expected due
   to struct siginfo_t idiosyncrasy.

NOTE pidfdSendSignal and pidfdWait are used without a race workaround
(blockUntilWaitable and sigMu, added by CL 23967) because with pidfd,
PID recycle issue doesn't exist (IOW, pidfd, unlike PID, is guaranteed
to refer to one particular process) and thus the race doesn't exist
either.

For #62654.
Updates #13987.

Change-Id: I22ebcc7142b16a3a94c422d2f32504d1a80e8a8f
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/528438
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-02-21 21:26:00 +00:00
Kir Kolyshkin
4cd743e27e os: use atomic.Uintptr for Process.handle
Suggested-by: Michael Knyszek <mknyszek@google.com>
Change-Id: I116731b6c3738aae8ff1d3be227f8f51fa3320c7
Reviewed-on: https://go-review.googlesource.com/c/go/+/544795
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Kirill Kolyshkin <kolyshkin@gmail.com>
Reviewed-by: qiulaidongfeng <2645477756@qq.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2024-02-21 21:23:31 +00:00
Michael Pratt
b27d02c07b runtime/debug: clarify SetCrashOutput dup behavior
SetCrashOutput dup's the input file for safety, but I don't think that
the docs are very clear about what the caller can/should do with f. "it
does not close the previous file" is particularly confusing, as it does
close the previous FD (but not the previous passed os.File).

Expand and attempt to clarify the explanation, borrowing wording from
net.FileConn, which also dup's the input os.File.

For #42888.

Change-Id: I1c96d2dce7899e335d8f1cd464d2d9b31aeb4e5e
Reviewed-on: https://go-review.googlesource.com/c/go/+/559800
Reviewed-by: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-02-21 20:35:26 +00:00
Alexander Yastrebov
806aeb1e76 cmd/go: fail fast across packages
Fixes #33038

Change-Id: I0b70c450be1c1cc59ddc1f3fddad227deccc7e14
GitHub-Last-Rev: 302ebd648a
GitHub-Pull-Request: golang/go#62714
Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest-race,gotip-windows-amd64-race,gotip-windows-amd64-longtest
Reviewed-on: https://go-review.googlesource.com/c/go/+/529198
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
2024-02-21 19:25:24 +00:00
Mateusz Poliwczak
c07b9b0036 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: 4189b9faf0
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>
2024-02-21 18:47:20 +00:00
qiulaidongfeng
cd17032721 cmd/go: remove unused var BuildToolchainLinker and BuildToolchainCompiler
Change-Id: I4bb855f6ada5c550a46f69313a2f47631bf657ca
GitHub-Last-Rev: 2af07f9d7b
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>
2024-02-21 17:22:59 +00:00
Robert Griesemer
6c979d2522 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>
2024-02-21 17:12:11 +00:00
Robert Griesemer
cc276a768f 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>
2024-02-21 17:12:09 +00:00
Robert Griesemer
3374dad1d9 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>
2024-02-21 17:07:59 +00:00
Robert Griesemer
81609c454b 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>
2024-02-21 17:07:56 +00:00
Michael Matloob
808c8fb815 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>
2024-02-21 16:58:04 +00:00
Michael Matloob
3f60da7944 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>
2024-02-21 16:56:35 +00:00
Meng Zhuo
3580c212c2 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>
2024-02-21 14:34:57 +00:00
Andy Pan
d4112310a4 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>
2024-02-21 00:55:03 +00:00
Mauri de Souza Meneguzzo
1a8ee033f8 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: 20dea110c8
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>
2024-02-20 22:55:07 +00:00
Cherry Mui
2908352980 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>
2024-02-20 22:40:04 +00:00
Cuong Manh Le
5428cc4f14 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>
2024-02-20 22:29:14 +00:00
Than McIntosh
53708d86b0 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>
2024-02-20 21:31:54 +00:00
Michael Pratt
de65aa41d8 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>
2024-02-20 21:02:04 +00:00
Mauri de Souza Meneguzzo
e1e466f80c 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: 0a644bd6f1
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>
2024-02-20 20:50:21 +00:00
Joel Sing
4ce008d7d3 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>
2024-02-20 20:44:14 +00:00
Mateusz Poliwczak
5a41204504 net: mention the cgo thread limit in package docs
Updates #63978

Change-Id: I39a5c812b4f604baf4ca5ffcff52b8dc17d4990d
GitHub-Last-Rev: 4ab6e262f4
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>
2024-02-20 19:02:17 +00:00
Robert Griesemer
67361bf868 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>
2024-02-20 18:06:31 +00:00
Roland Shoemaker
c1828fbcbf 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>
2024-02-20 17:57:28 +00:00
Roland Shoemaker
027853627d 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>
2024-02-20 17:18:29 +00:00
qiulaidongfeng
ff4e45fbc2 cmd/compile/internal/reflectdata,reflect: merge MaxPtrmaskBytes const into internal/abi
For #59670

Change-Id: I5c0a463f54208db215683f11e6454d0178edda3c
GitHub-Last-Rev: 6963f3c8fb
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>
2024-02-20 16:10:05 +00:00
Paul E. Murphy
af3f94ce64 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>
2024-02-20 15:35:35 +00:00
hi-rustin
6a36e55d4a 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: 0023c28dc0
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>
2024-02-20 14:59:57 +00:00
Shang Ding
ff0b46cfbb 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>
2024-02-20 14:59:55 +00:00
Andy Pan
a3c35430fc 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>
2024-02-20 14:59:53 +00:00
Andy Pan
d068c2cb62 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>
2024-02-20 14:59:49 +00:00
Mauri de Souza Meneguzzo
c4d55ab912 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: 0f8c8df4f2
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>
2024-02-20 14:57:37 +00:00
qiulaidongfeng
0a04641871 hash/maphash: parallel run test
This reduces the go test hash/maphash time
by more than half.

Change-Id: If184ca99544809c86b4c1baeb45d3afede91b41a
GitHub-Last-Rev: 440c35f8b5
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>
2024-02-20 14:56:36 +00:00
Julian Tibble
098a87fb19 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>
2024-02-20 14:56:00 +00:00
Andy Pan
d42cd452dc 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>
2024-02-20 06:04:31 +00:00
kkhaike
aaf8e844ed 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>
2024-02-19 20:51:15 +00:00
aimuz
e5f4c68c44 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: 917f78ce4e
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>
2024-02-19 20:51:11 +00:00
Olivier Mengué
0882ca7a73 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>
2024-02-19 20:44:20 +00:00