Russ Cox [Wed, 14 Feb 2024 03:31:33 +0000 (22:31 -0500)]
runtime: delete clearDeletedTimers
adjusttimers already contains the same logic. Use it instead.
This avoids having two copies of the code and is faster.
adjusttimers was formerly O(n log n) but is now O(n).
clearDeletedTimers was formerly O(n² log n) and is now gone!
[This is one CL in a refactoring stack making very small changes
in each step, so that any subtle bugs that we miss can be more
easily pinpointed to a small change.]
Change-Id: I32bf24817a589033dc304b359f8df10ea21f48fc
Reviewed-on: https://go-review.googlesource.com/c/go/+/564116 Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Russ Cox [Wed, 14 Feb 2024 16:56:50 +0000 (11:56 -0500)]
runtime: simplify, speed up adjusttimers
The current adjusttimers does an O(n) loop and then queues
a bunch of reinsertions, each of which is O(log n), for a worst
case of O(n log n) time plus an allocation of n elements.
Reestablishing the heap invariant from an arbitrarily ordered
slice can be done in O(n) time, so it is both simpler and faster
to avoid the allocated temporary queue and just re-init the
heap if we have damaged it. The cost of doing so is no worse
than the O(n) loop we already did.
This change also avoids holding multiple timers locked (status
set to timerMoving) at any given moment, as well as holding
individual timers locked for unbounded amounts of time,
as opposed to fixed-size critical sections.
[This is one CL in a refactoring stack making very small changes
in each step, so that any subtle bugs that we miss can be more
easily pinpointed to a small change.]
Change-Id: If966c1d1e66db797f4b19e7b1abbc06ab651764d
Reviewed-on: https://go-review.googlesource.com/c/go/+/564115 Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Jes Cok [Tue, 27 Feb 2024 22:39:35 +0000 (22:39 +0000)]
reflect: add Overflow methods to Type
This CL adds new methods synonymous with the method of the same name
in reflect.Value to reflect.Type: OverflowComplex, OverflowFloat, OverflowInt, OverflowUint.
Fixes #60427
Change-Id: I7a0bb35629e59a7429820f13fcd3a6f120194bc6
GitHub-Last-Rev: 26c11bcffe0f418e7d5c37e14587e738d5d939d6
GitHub-Pull-Request: golang/go#65955
Reviewed-on: https://go-review.googlesource.com/c/go/+/567296
Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
qiulaidongfeng [Wed, 14 Feb 2024 01:51:47 +0000 (01:51 +0000)]
cmd/dist: let the three runtime -quick tests run simultaneously
For #65164
Change-Id: Ied19cebd113ef91c34f613cafbeb92a335d6420d
GitHub-Last-Rev: 8118be6e30ffc4edcd88b8a1d5ee3105e2c760de
GitHub-Pull-Request: golang/go#65444
Reviewed-on: https://go-review.googlesource.com/c/go/+/560597
Commit-Queue: Ian Lance Taylor <iant@golang.org> Reviewed-by: 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> Reviewed-by: Than McIntosh <thanm@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
zuojunwei.1024 [Tue, 27 Feb 2024 11:14:00 +0000 (19:14 +0800)]
cmd/compile: mark pointer to noalg type as noalg
When the compiler writes PtrToThis field of noalg type, it generates
its pointer type. Mark them as noalg to prevent put them in typelinks.
Fixes #65957
Change-Id: Icbc3b18bc866f9138c7648e42dd500a80326f72b
Reviewed-on: https://go-review.googlesource.com/c/go/+/567335 Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Auto-Submit: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Keith Randall <khr@google.com>
Robert Griesemer [Tue, 27 Feb 2024 22:04:00 +0000 (14:04 -0800)]
go/types, types2: move Checker.langCompat from version.go to expr.go (cleanup)
This makes version.go holding core version checking code only.
No functional changes.
Change-Id: Ia88a48166cad2698765697dd7a8625b56ecc2226
Reviewed-on: https://go-review.googlesource.com/c/go/+/567536 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>
Auto-Submit: Robert Griesemer <gri@google.com>
Robert Griesemer [Tue, 27 Feb 2024 17:21:44 +0000 (09:21 -0800)]
go/types, types2: consistently use singular when reporting version errors
Change-Id: I39af932b789cd18dc4bfc84f9667b1c32c9825f4
Reviewed-on: https://go-review.googlesource.com/c/go/+/567476 Reviewed-by: Robert Findley <rfindley@google.com> Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Robert Griesemer [Tue, 27 Feb 2024 00:45:28 +0000 (16:45 -0800)]
go/types, types2: initial support for parameterized type aliases
Permit type parameters on type alias declarations depending on
Go language version.
Implement various version checks such that at most one version
error is reported per type alias declaration.
Add tparams field to Alias type node.
Missing:
- instantiation of alias types
- API additions (requires proposal)
For #46477.
Change-Id: Ica658292bd096d3bceb513027d3353501a6c58e4
Reviewed-on: https://go-review.googlesource.com/c/go/+/566856
Auto-Submit: Robert Griesemer <gri@google.com> Reviewed-by: Robert Griesemer <gri@google.com> Reviewed-by: Robert Findley <rfindley@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Robert Griesemer [Fri, 23 Feb 2024 22:40:37 +0000 (14:40 -0800)]
go/types, types2: separate formatting from error handling functions
This change moves formatting-specific functionality into a new file
format.go and rearranges the code in the errors.go files to be in
the same order for go/types and types2, making them more similar.
No functionality change. This is a pure code reordering.
Change-Id: Ibd818792397be146ad510a6c7308c85d3bb65956
Reviewed-on: https://go-review.googlesource.com/c/go/+/566555
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Robert Griesemer <gri@google.com> Reviewed-by: Robert Findley <rfindley@google.com> Reviewed-by: Robert Griesemer <gri@google.com>
Robert Griesemer [Wed, 21 Feb 2024 23:08:21 +0000 (15:08 -0800)]
go/types: generate initorder.go from types2 source
This CL reduces the amount of code that needs to be maintained
manually by about 320 LOC.
Change-Id: Ib797e86dd4abd3a9fe614787103f0e5cebd5e4ae
Reviewed-on: https://go-review.googlesource.com/c/go/+/565838 Reviewed-by: Robert Griesemer <gri@google.com> Reviewed-by: Robert Findley <rfindley@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Robert Griesemer [Wed, 21 Feb 2024 23:33:28 +0000 (15:33 -0800)]
go/types: generate mono.go from types2 source
This CL reduces the amount of code that needs to be maintained
manually by about 340 LOC.
Change-Id: If7b96c30e5a2f1ff28ebf4ca2f3ac3f73d6a8865
Reviewed-on: https://go-review.googlesource.com/c/go/+/565839 Reviewed-by: Robert Griesemer <gri@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 Findley <rfindley@google.com>
Robert Griesemer [Fri, 23 Feb 2024 20:43:51 +0000 (12:43 -0800)]
go/types, types2: call error handler for each sub-error as needed
Factor out calling or typechecker error handler from error_.report.
In error_.report, decide if the typechecker error handler needs to
be called once or multiple times.
This change enables the use of sub-errors for types2 and go/types,
with the error handler taking care of deciding how many "separate"
errors are reported via the API.
Use new error reporting in go/types mono and initorder computation;
with the above adjustments, these changes should now pass gopls tests.
Also: adjust some format strings to avoid vet errors.
Change-Id: If05a7044399b4783c596c69a8158619f83c21c70
Reviewed-on: https://go-review.googlesource.com/c/go/+/566537
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>
Damien Neil [Mon, 26 Feb 2024 21:45:42 +0000 (13:45 -0800)]
net/http/httputil: avoid ReverseProxy data race on 1xx response and error
ReverseProxy uses a httptrace.ClientTrace.Got1xxResponse trace hook
to capture 1xx response headers for proxying. This hook can be called
asynchrnously after RoundTrip returns. (This should only happen when
RoundTrip has failed for some reason.) Add synchronization so we don't
attempt to modifying the ResponseWriter headers map from the hook
after another goroutine has begun making use of it.
Fixes #65123
Change-Id: I8b7ecb1a140f7ba7e37b9d27b8a20bca41a118b1
Reviewed-on: https://go-review.googlesource.com/c/go/+/567216
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Jonathan Amsterdam <jba@google.com>
Auto-Submit: Damien Neil <dneil@google.com>
Deleplace [Thu, 22 Feb 2024 22:44:31 +0000 (23:44 +0100)]
slices: Delete clears the tail when j == len(s)
Fixes #65669
Change-Id: Ifd2011dd604fef399e4352b804fc2f6a9e74096e
Reviewed-on: https://go-review.googlesource.com/c/go/+/566237 Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Keith Randall <khr@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@golang.org>
Cuong Manh Le [Wed, 21 Feb 2024 11:50:11 +0000 (18:50 +0700)]
cmd/compile: fix early deadcode with label statement
CL 517775 moved early deadcode into unified writer. with new way to
handle dead code with label statement involved: any statements after
terminating statement will be considered dead until next label
statement.
However, this is not safe, because code after label statement may still
refer to dead statements between terminating and label statement.
It's only safe to remove statements after terminating *and* label one.
Fixes #65593
Change-Id: Idb630165240931fad50789304a9e4535f51f56e2
Reviewed-on: https://go-review.googlesource.com/c/go/+/565596
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Keith Randall <khr@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Nick Ripley [Mon, 5 Feb 2024 19:20:10 +0000 (14:20 -0500)]
runtime: don't clobber saved frame pointer during arm64 racecall
During calls to the race detector on arm64, we switch to the g0 stack if
we aren't already on it. If we are already on the g0 stack, the race
detector library code can then create a stack frame using the stack
pointer coming from Go code. The race detector library can go on to
write values to the top of its stack frame. But the Go ABI for arm64
saves the caller's frame pointer in the word below the current stack
frame. So, the saved frame pointer on the stack can be clobbered by the
race detector. Decrement the stack pointer to account for where the
frame pointer is saved, like we do for asmcgocall.
Change-Id: I66e5e4a671c3befc10776bac6869810ecf71790d
Reviewed-on: https://go-review.googlesource.com/c/go/+/561515
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Keith Randall <khr@google.com> Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Michael Knyszek <mknyszek@google.com>
Michael Pratt [Mon, 22 Jan 2024 22:50:44 +0000 (17:50 -0500)]
runtime: disable use of runnext on wasm
When readying a goroutine, the scheduler typically places the readied
goroutine in pp.runnext, which will typically be the next goroutine to
run in the schedule.
In order to prevent a set of ping-pong goroutines from simply switching
back and forth via runnext and starving the rest of the run queue, a
goroutine scheduled via runnext shares a time slice (pp.schedtick) with
the previous goroutine.
sysmon detects "long-running goroutines", which really means Ps using
the same pp.schedtick for too long, and preempts them to allow the rest
of the run queue to run. Thus this avoids starvation via runnext.
However, wasm has no threads, and thus no sysmon. Without sysmon to
preempt, the possibility for starvation returns. Avoid this by disabling
runnext entirely on wasm. This means that readied goroutines always go
on the end of the run queue and thus cannot starve via runnext.
Note that this CL doesn't do anything about single long-running
goroutines. Without sysmon to preempt them, a single goroutine that
fails to yield will starve the run queue indefinitely.
For #65178.
Change-Id: I10859d088776125a2af8c9cd862b6e071da628b5
Cq-Include-Trybots: luci.golang.try:gotip-js-wasm,gotip-wasip1-wasm_wasmtime,gotip-wasip1-wasm_wazero
Reviewed-on: https://go-review.googlesource.com/c/go/+/559798
Auto-Submit: Bryan Mills <bcmills@google.com> Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
kkhaike [Wed, 21 Feb 2024 13:40:02 +0000 (21:40 +0800)]
net: Correct the code snippet erroneously rolled back in CL550435
In CL https://golang.org/cl/550435, a segment that had already been reviewed and modified was rolled back due to an erroneous operation. Here, submit a correct code snippet.
Change-Id: I46adfad110d532aec5f557c350fe6dccbc583968
Reviewed-on: https://go-review.googlesource.com/c/go/+/565628
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Damien Neil <dneil@google.com> Reviewed-by: qiulaidongfeng <2645477756@qq.com> Reviewed-by: Carlos Amedee <carlos@golang.org> Reviewed-by: Mateusz Poliwczak <mpoliwczak34@gmail.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Commit-Queue: Ian Lance Taylor <iant@golang.org>
Mauri de Souza Meneguzzo [Wed, 10 Jan 2024 13:33:40 +0000 (13:33 +0000)]
net/http: prevent redirect loop in serveFile if "/" is a normal file
When FileServer(Dir("file")) is used where "file" is a normal file and
not a directory, the server enters a redirect loop.
The usage of a file inplace of a directory path is not documented in
http.Dir and it could be considered undefined behavior.
This CL updates serveFile to check if we are trying to traverse a normal
file instead of a directory and return an error, preventing the redirect
loop.
Matteo Vaccari [Thu, 22 Feb 2024 11:36:38 +0000 (11:36 +0000)]
net/http/pprof: avoid panic with user-defined "GET /" route
With the new routing style in go 1.22, declaring
http.Handle("GET /", h)
generates a conflict with route "/debug/pprof/" and the others declared in
the net/http/pprof package. You get an error such as:
panic: pattern "GET /" (registered at .../pprof.go:94): GET / matches
fewer methods than /debug/pprof/, but has a more general path pattern
This patch prevents that error. Adding GET is correct because no other
method makes sense with the /debug/pprof routes. However, a tool using any
method other than GET will break.
We preserve the traditional behaviour when GODEBUG=httpmuxgo121=1 is
specified.
Updates #65723
Change-Id: I49c21f5f3e802ad7538062d824354b2e4d8a800e
GitHub-Last-Rev: 35e4012663f454fee8f00a321c43592ce4754feb
GitHub-Pull-Request: golang/go#65791
Reviewed-on: https://go-review.googlesource.com/c/go/+/565176
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Jonathan Amsterdam <jba@google.com> Reviewed-by: Carlos Amedee <carlos@golang.org>
Robert Griesemer [Mon, 26 Feb 2024 21:26:39 +0000 (13:26 -0800)]
go/types: added test case for Checker.CheckExpr
For #65898.
Change-Id: I495e53060ac56b88a551ccd9901f25bbce97c714
Reviewed-on: https://go-review.googlesource.com/c/go/+/567215 Reviewed-by: Alan Donovan <adonovan@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>
Auto-Submit: Robert Griesemer <gri@google.com>
qmuntal [Fri, 23 Feb 2024 13:01:34 +0000 (14:01 +0100)]
os: avoid GetFileInformationByHandleEx call when stat'ing files on Windows
os.Stat and os.Lstat on Windows use GetFileInformationByHandleEx to
retrieve file information for reparse points and files that
GetFileAttributesEx does not handle.
However, GetFileInformationByHandleEx is only necessary for
reparse points, so we can avoid the call for regular files.
With this change we can drop the FAT hack that was added in CL 154377,
as files won't have the FILE_ATTRIBUTE_REPARSE_POINT attribute set
on that file system.
Change-Id: Id18639067a6c3fa1bb2c6706d5b79358c224fe37
Reviewed-on: https://go-review.googlesource.com/c/go/+/566397 Reviewed-by: Carlos Amedee <carlos@golang.org> Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Bryan Mills <bcmills@google.com>
guoguangwu [Mon, 26 Feb 2024 09:32:48 +0000 (09:32 +0000)]
reflect: fix typo in comment
Change-Id: Ia8e666b128622391d72e42449c01c4e10f3c9e1e
GitHub-Last-Rev: c74cf13b70772a965a14630108544a89690d1383
GitHub-Pull-Request: golang/go#65938
Reviewed-on: https://go-review.googlesource.com/c/go/+/566855 Reviewed-by: Carlos Amedee <carlos@golang.org> Reviewed-by: qiulaidongfeng <2645477756@qq.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>
guoguangwu [Sun, 25 Feb 2024 12:59:23 +0000 (12:59 +0000)]
archive/tar: check returned error before use hdr
Change-Id: I8c28dac73427e37d58d970b00d8f0f1413bede2e
GitHub-Last-Rev: a11a8036028ecf6f811b1470becc924b77a2c734
GitHub-Pull-Request: golang/go#65932
Reviewed-on: https://go-review.googlesource.com/c/go/+/566695
Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Carlos Amedee <carlos@golang.org> Reviewed-by: Joseph Tsai <joetsai@digital-static.net> Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
guoguangwu [Tue, 20 Feb 2024 06:20:13 +0000 (06:20 +0000)]
html/template: replace bytes.Compare call with bytes.Equal
Change-Id: I1bd3fdf0ceb9a83dbcc07f55b81489eb2c82c9ba
GitHub-Last-Rev: 05d49d7fb921e59529f7105a93b4b7fba51ab525
GitHub-Pull-Request: golang/go#65418
Reviewed-on: https://go-review.googlesource.com/c/go/+/560115
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Carlos Amedee <carlos@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com>
guoguangwu [Fri, 23 Feb 2024 01:07:08 +0000 (01:07 +0000)]
encoding/xml: remove unnecessary fmt.Sprintf call
Change-Id: Iba6014340d8b697a3a26b35e8d5a702ccf332e10
GitHub-Last-Rev: ef60463c7b98c2bdabe6d04e0f86947b7f395765
GitHub-Pull-Request: golang/go#65872
Reviewed-on: https://go-review.googlesource.com/c/go/+/565841 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> Reviewed-by: Carlos Amedee <carlos@golang.org>
aimuz [Wed, 21 Feb 2024 02:15:40 +0000 (02:15 +0000)]
database/sql: wrap errors with %w in driverArgsConnLocked
Use fmt.Errorf %w verb to wrap errors in driverArgsConnLocked,
which allows for easier unwrapping and checking of error types.
Add tests in sql_test.go to ensure that Stmt.Exec and Stmt.Query
correctly wrap underlying Valuer errors, adhering to the new change.
Fixes #64707.
Change-Id: Id9f80e265735d0849ee7abba63e58e4c26e658ad
GitHub-Last-Rev: 0df367e0fb5b213513d4e0ab7f5a87984798f96d
GitHub-Pull-Request: golang/go#64728
Reviewed-on: https://go-review.googlesource.com/c/go/+/550116 Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Carlos Amedee <carlos@golang.org> Reviewed-by: Mauri de Souza Meneguzzo <mauri870@gmail.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Roland Shoemaker [Thu, 15 Feb 2024 01:18:36 +0000 (17:18 -0800)]
html/template: escape additional tokens in MarshalJSON errors
Escape "</script" and "<!--" in errors returned from MarshalJSON errors
when attempting to marshal types in script blocks. This prevents any
user controlled content from prematurely terminating the script block.
Fixes #65697
Change-Id: Icf0e26c54ea7d9c1deed0bff11b6506c99ddef1b
Reviewed-on: https://go-review.googlesource.com/c/go/+/564196
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Damien Neil <dneil@google.com>
Bryan C. Mills [Wed, 31 Jan 2024 16:43:38 +0000 (11:43 -0500)]
net/http: reject client-side retries in server timeout tests
This breaks an unbounded client-side retry loop if the server's
timeout happens to fire during its final read of the TLS handshake.
The retry loop was observed on wasm platforms at CL 557437.
I was also able to reproduce chains of dozens of retries on my
linux/amd64 workstation by adjusting some timeouts and adding a couple
of sleeps, as in this patch:
https://gist.github.com/bcmills/d0a0a57e5f64eebc24e8211d8ea502b3
However, on linux/amd64 on my workstation the test always eventually
breaks out of the retry loop due to timing jitter.
I couldn't find a retry-specific hook in the http.Client,
http.Transport, or tls.Config structs, so I have instead abused the
Transport.Proxy hook for this purpose. Separately, we may want to
consider adding a retry-specific hook, or changing the net/http
implementation to avoid transparently retrying in this case.
Fixes #65410.
Updates #65178.
Change-Id: I0e43c039615fe815f0a4ba99a8813c48b1fdc7e6
Reviewed-on: https://go-review.googlesource.com/c/go/+/559835 Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Bryan Mills <bcmills@google.com> Reviewed-by: Michael Pratt <mpratt@google.com>
guoguangwu [Sun, 25 Feb 2024 10:15:17 +0000 (10:15 +0000)]
cmd/gofmt: remove impossible err!=nil conditional
Change-Id: Ife63c766cefc14d2f6bdd3c706f913b1b6f99949
GitHub-Last-Rev: 04e23349e68a3ce12b7d33c0fd3ad8c7ffbd8aaa
GitHub-Pull-Request: golang/go#65929
Reviewed-on: https://go-review.googlesource.com/c/go/+/566099 Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Robert Griesemer <gri@google.com> Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Tobias Klauser [Thu, 22 Feb 2024 21:03:50 +0000 (22:03 +0100)]
net: use bytealg.IndexByte in cgoLookupAddrPTR
Change-Id: I76f4dc1e8bda98936c1198cb45ce8141ca88845b
Reviewed-on: https://go-review.googlesource.com/c/go/+/566235
Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Carlos Amedee <carlos@golang.org>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
guoguangwu [Thu, 22 Feb 2024 01:32:06 +0000 (01:32 +0000)]
crypto/tls: fix typo in comment
Change-Id: I77371ef99797e2b53f1292c9d6a4eb157f116f88
GitHub-Last-Rev: 7ce7d014c0c46b320f9e4b742ae9360d1b5cf4dc
GitHub-Pull-Request: golang/go#65836
Reviewed-on: https://go-review.googlesource.com/c/go/+/565440 Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: qiulaidongfeng <2645477756@qq.com>
Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Carlos Amedee <carlos@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
guoguangwu [Tue, 20 Feb 2024 01:57:37 +0000 (01:57 +0000)]
crypto/ecdsa: fix typo
Change-Id: I32580ffb31ffad05a7c8d3aa0c491aff9f55ea6a
GitHub-Last-Rev: 67516eaa18923f0f59a69e82b74ecba74af387d4
GitHub-Pull-Request: golang/go#65565
Reviewed-on: https://go-review.googlesource.com/c/go/+/562316
Auto-Submit: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Carlos Amedee <carlos@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com>
cui fliter [Fri, 3 Nov 2023 11:08:59 +0000 (19:08 +0800)]
os: add available godoc link
Change-Id: I430c9a7c4936d7a8c8c787aa63de9a796d20fdf3
Reviewed-on: https://go-review.googlesource.com/c/go/+/539597 Reviewed-by: Carlos Amedee <carlos@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: shuang cui <imcusg@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Ian Lance Taylor <iant@google.com>
cui fliter [Sat, 4 Nov 2023 07:21:26 +0000 (15:21 +0800)]
syscall: add available godoc link
Change-Id: I0fcb79f471cdb8b464924d9b04c675f120861f67
Reviewed-on: https://go-review.googlesource.com/c/go/+/539835 Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: shuang cui <imcusg@gmail.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Carlos Amedee <carlos@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
cui fliter [Sat, 4 Nov 2023 08:14:29 +0000 (16:14 +0800)]
text: add available godoc link
Change-Id: Idbc110cfc4fd6bbbc8b79807ac14abf7b30e0e65
Reviewed-on: https://go-review.googlesource.com/c/go/+/539855
Run-TryBot: shuang cui <imcusg@gmail.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> Reviewed-by: qiulaidongfeng <2645477756@qq.com>
TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Carlos Amedee <carlos@golang.org>
cui fliter [Fri, 3 Nov 2023 11:41:55 +0000 (19:41 +0800)]
regexp: add available godoc link
Signed-off-by: cui fliter <imcusg@gmail.com>
Change-Id: I85339293d4cfb691125f991ec7162e9be186efdc
Reviewed-on: https://go-review.googlesource.com/c/go/+/539599 Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
cui fliter [Fri, 3 Nov 2023 13:49:19 +0000 (21:49 +0800)]
sync: add available godoc link
Change-Id: I9bc5fd29b0eec8ceadcfee2116de5e7524ef92c2
Reviewed-on: https://go-review.googlesource.com/c/go/+/539617
Auto-Submit: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Pratt <mpratt@google.com>
Run-TryBot: shuang cui <imcusg@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com>
Andy Pan [Sat, 24 Feb 2024 00:01:51 +0000 (08:01 +0800)]
doc/next: add the missing slashes ahead of net#Dialer and net#ListenConfig
Change-Id: I216189f181ee73d16602c5cc86eb4d6b439a142b
Reviewed-on: https://go-review.googlesource.com/c/go/+/566595 Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Commit-Queue: Damien Neil <dneil@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Damien Neil <dneil@google.com>
guoguangwu [Wed, 21 Feb 2024 02:23:29 +0000 (02:23 +0000)]
crypto/x509: fix typo
Change-Id: I0911c59280e4a208a3deee1f70b47adc60fb734b
GitHub-Last-Rev: 12e95ade68c2f2dd8f87126eae9f3a75841ec8bc
GitHub-Pull-Request: golang/go#65833
Reviewed-on: https://go-review.googlesource.com/c/go/+/565439 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>
Auto-Submit: Michael Pratt <mpratt@google.com>
aimuz [Tue, 20 Feb 2024 02:58:00 +0000 (02:58 +0000)]
net/netip: introduce parsePrefixError for better error handling
Refactor ParsePrefix to return a parsePrefixError containing the input
string and a detailed message on failure, improving error context and
maintaining consistent error formatting within the netip package.
Change-Id: I8d9fb2f833b0f96f43a14622e66e225b54440410
GitHub-Last-Rev: e17bec3afa4efd6c52463bb93e8f694b42c0c2b7
GitHub-Pull-Request: golang/go#65798
Reviewed-on: https://go-review.googlesource.com/c/go/+/565275
Auto-Submit: Michael Pratt <mpratt@google.com> Reviewed-by: Michael Pratt <mpratt@google.com> Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Mateusz Poliwczak [Tue, 20 Feb 2024 17:15:43 +0000 (17:15 +0000)]
net: don't force cgo resolver for .local subdomain queries
The cgo resolver sends DNS queries for .local subdomain
lookups, just as we do in the go resolver.
We don't need to fallback to the cgo resolver for this
domains when nsswitch.conf uses only file and dns modules.
This has a benefit that we select a consistent resolver,
that is only based on the system configuration, regardless
of the queried domain.
Updates #63978
Change-Id: I9166103adb94d7ab52992925f413f361130e7c52
GitHub-Last-Rev: e2bc5874cb5c9165e3cc058e9effe36d0ce68cd6
GitHub-Pull-Request: golang/go#63986
Reviewed-on: https://go-review.googlesource.com/c/go/+/540555
Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Pratt <mpratt@google.com>
Tobias Klauser [Tue, 20 Feb 2024 16:10:16 +0000 (17:10 +0100)]
time: use bytealg.IndexByte in byteString
Change-Id: I0d42bca7c6ee63c05a0ca09c165f2f591edf7c34
Reviewed-on: https://go-review.googlesource.com/c/go/+/565356
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: Michael Pratt <mpratt@google.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Alessandro Arzilli [Thu, 8 Feb 2024 11:06:00 +0000 (12:06 +0100)]
cmd/compile/internal/dwarfgen: refactor putvar and putAbstractVar
Currently, changing putvar or putAbstractVar involves:
1. changing the abbrevs array to add new abbrevs or modify existing ones
2. changing the DW_ABRV_XXX const block to add the new abbrevs, this const
block must match the changes to the abbrevs array
3. change the code at the start of putvar and putAbstractVar that selects
the abbrev to use
4. change the body of putvar/putAbstractVar to emit the right attributes in
the right sequence
Each change must agree with all other, this is error prone and if an mistake
is made there is no compile time or runtime check detecting it. Erroneous
code will simply produce unreadable debug sections.
This commit adds a mechanism to automatically generate code for abbrev
selection as well as the abbrev definitions based on static examination of
the body of putvar and putAbstractVar.
TestPutVarAbbrevGenerator is responsible for checking that the generated
code is kept updated and will regenerated it by passing the '-generate'
option to it.
Change-Id: I7edf37b5a47fd9aceef931ddf2c701e66a7b38b2
Reviewed-on: https://go-review.googlesource.com/c/go/+/563815 Reviewed-by: Michael Pratt <mpratt@google.com> Reviewed-by: Than McIntosh <thanm@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
apocelipes [Mon, 26 Feb 2024 04:24:44 +0000 (04:24 +0000)]
sync: simplify the code with atomic.Pointer
Change-Id: I79797be6b385c9927d68350334d7f7387007085f
GitHub-Last-Rev: 3daa3b144f55f527d183d4ff35475ca4af3ee143
GitHub-Pull-Request: golang/go#65937
Reviewed-on: https://go-review.googlesource.com/c/go/+/566815
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Commit-Queue: Ian Lance Taylor <iant@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com>
Damien Neil [Sat, 30 Sep 2023 17:38:01 +0000 (10:38 -0700)]
path/filepath: add Localize
Add the Localize function, which takes an io/fs slash-separated path
and returns an operating system path.
Localize returns an error if the path cannot be represented on
the current platform.
Replace internal/safefile.FromFS with Localize,
which serves the same purpose as this function.
The internal/safefile package remains separate from path/filepath
to avoid a dependency cycle with the os package.
Fixes #57151
Change-Id: I75c88047ddea17808276761da07bf79172c4f6fc
Reviewed-on: https://go-review.googlesource.com/c/go/+/531677
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Ian Lance Taylor <iant@google.com>
Matteo Vaccari [Thu, 22 Feb 2024 16:11:20 +0000 (16:11 +0000)]
expvar: avoid conflict with user-defined "GET /" route.
With the new routing style in go 1.22, declaring
http.Handle("GET /", h)
generates a conflict with route "/debug/vars" declared in the expvar
package. You get an error such as:
panic: pattern "GET /" (registered at ...) conflicts with pattern
"/debug/vars" (registered at ...expvar.go:384): GET / matches fewer
methods than /debug/vars, but has a more general path pattern
This patch prevents that error. Adding GET is correct because no other
method makes sense with /debug/vars.
We preserve the traditional behaviour when GODEBUG=httpmuxgo121=1 is
specified.
Fixes #65723
Change-Id: Id2b963ebad41a1ebdcceb73baf3436d59aac73a0
GitHub-Last-Rev: 9c2b9f74a7c8a3c756e9948814231b8f4e60b216
GitHub-Pull-Request: golang/go#65745
Reviewed-on: https://go-review.googlesource.com/c/go/+/564735 Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Jonathan Amsterdam <jba@google.com>
guoguangwu [Fri, 23 Feb 2024 08:57:43 +0000 (08:57 +0000)]
runtime/coverage: remove refs to deprecated io/ioutil
Change-Id: I66965e6a61cf1726db06670978a4654b84f3fd72
GitHub-Last-Rev: 90023e48435029c94a316413b30e46c9ce0019d5
GitHub-Pull-Request: golang/go#65900
Reviewed-on: https://go-review.googlesource.com/c/go/+/566356
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>
qmuntal [Fri, 23 Feb 2024 12:38:27 +0000 (13:38 +0100)]
path/filepath: support multiple TestAbs runs on Windows
TestAbs modifies the absTests global variable on Windows, which makes
the test to fail if it is run more than once, i.e. executing
"go test -run ^TestAbs$ -count 2 path/filepath".
This CL fixes the issue by clipping the absTests slices before
appending more elements to it.
Change-Id: I8f1144b2f10b8fa1b847e6639c0bda7baafc2dac
Reviewed-on: https://go-review.googlesource.com/c/go/+/566396 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>
rogeryk [Tue, 28 Nov 2023 12:41:03 +0000 (20:41 +0800)]
text/template: add "else with" action
Add "else with" action will reduce the template complexity in some use cases(#57646).
This action will be added:
{{with pipeline}} T1 {{else with pipeline}} T0 {{end}}.
Fixes #57646
Change-Id: I90ed546ab671805f753343b00bd3c9d1a1d5581d
Reviewed-on: https://go-review.googlesource.com/c/go/+/545376
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> Reviewed-by: Rob Pike <r@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com>
Max 👨🏽💻 Coplan [Fri, 22 Dec 2023 19:38:29 +0000 (11:38 -0800)]
net/http: make FileServer look good on mobile
Currently when viewing directories on a phone, the text is small and
often hard to tap correctly. This commit adds the viewport property to
the page to make it look correct on phones. This commit also makes the
page behave in Standards Mode instead of Quirks Mode which does not
effect the behavior of this page but makes me feel good inside ☺️
Change-Id: I4babcf79085e85fba57453b7a235e4750a269a42
Reviewed-on: https://go-review.googlesource.com/c/go/+/552595
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Commit-Queue: Ian Lance Taylor <iant@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Damien Neil <dneil@google.com> Reviewed-by: Max Coplan <mchcopl@gmail.com>
Ian Lance Taylor [Fri, 23 Feb 2024 20:18:20 +0000 (12:18 -0800)]
net: skip TestReadLine if /etc/services does not exist
Fixes #65905
Change-Id: I42326d3b743e80d5226ea374eca5c9edaef4dd4d
Reviewed-on: https://go-review.googlesource.com/c/go/+/566535
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> Reviewed-by: Damien Neil <dneil@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Andy Pan [Fri, 16 Feb 2024 05:53:05 +0000 (13:53 +0800)]
path/filepath: delete the deprecated joinNonEmpty and isUNC
Change-Id: I4ce88b2e8e8d24afb63ca7246ce0c418fcb02c9e
Reviewed-on: https://go-review.googlesource.com/c/go/+/564715 Reviewed-by: Damien Neil <dneil@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Robert Griesemer [Fri, 23 Feb 2024 17:55:31 +0000 (09:55 -0800)]
go/types: generate errors_test.go from types2 source
This CL reduces the amount of code that needs to be maintained
manually by about 50 LOC.
Change-Id: I022688d6db58bf58e7844487582725a23ca820be
Reviewed-on: https://go-review.googlesource.com/c/go/+/566515 Reviewed-by: Robert Griesemer <gri@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 Findley <rfindley@google.com>
Robert Griesemer [Thu, 22 Feb 2024 21:03:52 +0000 (13:03 -0800)]
go/types, types2: make error handling more similar
This change will make error handling between go/types and types2
more similar which will in turn allow more go/types files to be
generated from types2 sources.
Specifically:
- add Checker.newError to create error_ objects
- s/error_.errorf/error_.addf/
- remove error_.String (use error_.msg instead)
- replace Checker.report with error_.report
- make error_.report as similar as currently possible
- adjust dependencies
The new code consistently uses newError/addf/report
to report all errors.
Change-Id: Ibd6fd743a4f7746b4aa6b93fe768814dad9ee9c0
Reviewed-on: https://go-review.googlesource.com/c/go/+/566096 Reviewed-by: Robert Griesemer <gri@google.com> 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>
Andy Pan [Fri, 23 Feb 2024 04:09:04 +0000 (12:09 +0800)]
os: avoid writing within the tree during testing CopyFS
Change-Id: I1d3e7c100ddfbd2ea9a7bb9e8efae89893c8365a
Reviewed-on: https://go-review.googlesource.com/c/go/+/566335
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Commit-Queue: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Run-TryBot: Andy Pan <panjf2000@gmail.com>
Andy Pan [Thu, 19 Oct 2023 07:55:56 +0000 (15:55 +0800)]
internal/poll: revise the determination about [handled] and improve the code readability for SendFile
There were a bit too many conditional branches in the old code,
resulting in a poor readability. It could be more concise by reducing
and consolidating some of the conditions.
Furthermore, how we've determined whether or not the data transimission
was handled by sendfile(2) seems inappropriate, because it marked the
operation as unhandled whenever any non-retryable error occurs from
calling sendfile(2), it doesn't look like a right approach, at least
this is an inconsistent behavior with what we've done in Splice.
Related to #64044
Change-Id: Ieb65e0879a8841654d0e64a1263a4e43179df1ba
Reviewed-on: https://go-review.googlesource.com/c/go/+/537275
TryBot-Result: Gopher Robot <gobot@golang.org>
Commit-Queue: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Andy Pan <panjf2000@gmail.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org> Reviewed-by: Damien Neil <dneil@google.com> Reviewed-by: Bryan Mills <bcmills@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Andy Pan [Sat, 27 Jan 2024 04:52:56 +0000 (12:52 +0800)]
os: implement CopyFS
Fixes #62484
Change-Id: I5d8950dedf86af48f42a641940b34e62aa2cddcb
Reviewed-on: https://go-review.googlesource.com/c/go/+/558995
Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Axel Wagner [Wed, 14 Feb 2024 08:38:46 +0000 (09:38 +0100)]
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>
Nicolas Hillegeer [Thu, 22 Feb 2024 21:50:47 +0000 (13:50 -0800)]
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>
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.
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>
Robert Griesemer [Wed, 21 Feb 2024 22:57:02 +0000 (14:57 -0800)]
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>
Robert Griesemer [Wed, 21 Feb 2024 21:51:28 +0000 (13:51 -0800)]
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>
Michael Pratt [Wed, 31 Jan 2024 19:10:56 +0000 (14:10 -0500)]
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>
Alex Bozhenko [Wed, 7 Feb 2024 15:19:06 +0000 (15:19 +0000)]
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.
guoguangwu [Thu, 22 Feb 2024 01:25:52 +0000 (01:25 +0000)]
go/doc: fix typo in comment
Change-Id: Idcfd649b8b8c8b47f5622702969bf2d43aa57354
GitHub-Last-Rev: cd38bee1917377a5057d6dd7c911c55e79c59eae
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>
Kir Kolyshkin [Thu, 16 Nov 2023 09:42:39 +0000 (01:42 -0800)]
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>
Robert Griesemer [Wed, 21 Feb 2024 20:54:10 +0000 (12:54 -0800)]
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>
Kir Kolyshkin [Wed, 13 Sep 2023 08:07:10 +0000 (01:07 -0700)]
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>
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>
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>
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>
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>
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>
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>
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>
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'.