1
0
mirror of https://github.com/golang/go synced 2024-11-22 20:50:05 -07:00
Commit Graph

59227 Commits

Author SHA1 Message Date
Ezzno J
86a32d6d9c cmd/compile: remove unused code in walk.Walk
no errors'll be added during ir.DumpList, no need to be check again

Change-Id: I85ae2edd4377851277e9bb2a8baa28825ac3fd90
GitHub-Last-Rev: b35ca85e57
GitHub-Pull-Request: golang/go#64955
Reviewed-on: https://go-review.googlesource.com/c/go/+/553895
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
2024-02-17 06:03:15 +00:00
Jes Cok
e41fabd688 reflect: make Value.Comparable return true for nil interface value
Fixes #65718

Change-Id: I0b3edf9085f2d71f915bdf8ff9d312509b438c5f
GitHub-Last-Rev: 9fb1ca1a63
GitHub-Pull-Request: golang/go#65750
Reviewed-on: https://go-review.googlesource.com/c/go/+/564795
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Commit-Queue: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-02-17 00:13:07 +00:00
Paul E. Murphy
1c9c9c8412 cmd/internal/obj/ppc64: cleanup optab entries after renaming
Combine MOVW/MOVD using C_16CON as they accept any 16 bit
constant.

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

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

Change-Id: Ie20dd07bcedda428fb1dd674474d7dfa67d76dc1
Reviewed-on: https://go-review.googlesource.com/c/go/+/563915
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Paul Murphy <murp@ibm.com>
Reviewed-by: Lynn Boger <laboger@linux.vnet.ibm.com>
Reviewed-by: Eli Bendersky <eliben@google.com>
2024-02-16 22:02:23 +00:00
Keith Randall
cdd0ddaf45 internal/abi: get rid of itab blank field
We don't need it anymore, as we're accessing all the field offsets
symbolically.
This won't affect 64-bit, but it makes itabs on 32-bit 4 bytes smaller.

Change-Id: I7fb937813111476fd5ab03005b248ea7bb962cf6
Reviewed-on: https://go-review.googlesource.com/c/go/+/549517
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-02-16 20:25:09 +00:00
Keith Randall
b138b19d2f cmd/compile: use symbolic offsets of fields in internal/abi.ITab
After this CL, we can reorder or pad internal/abi.ITab fields at will
(keeping Fun last, and updating ITabTypeOff correctly) without
breaking anything.

Change-Id: Ib7bb5828519813e0d1aa36be5092f96fcd62b3be
Reviewed-on: https://go-review.googlesource.com/c/go/+/549516
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
2024-02-16 20:25:04 +00:00
Keith Randall
f2db96cd6c reflect: use internal/abi itab type
Change-Id: I4a40d9cda41d3601169ef0daf0f25fb1509bdcb7
Reviewed-on: https://go-review.googlesource.com/c/go/+/549458
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: David Chase <drchase@google.com>
2024-02-16 20:24:57 +00:00
Cherry Mui
e4ebd13f7a cmd/dist,cmd/go: define assembly macros, handle GOARM value with soft/hardfloat
CL 525637 added GOARM_x assembly macros based on GOARM value. But
it did not define the macro in cmd/dist, so the macro is not set
during bootstrapping. This CL defines them.

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

For #65601.

Change-Id: I60ffe7e8b623ae693d91d6e8595067a6f76565b3
Reviewed-on: https://go-review.googlesource.com/c/go/+/562995
Run-TryBot: Cherry Mui <cherryyz@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2024-02-16 18:14:03 +00:00
Cherry Mui
a0226c5680 runtime/internal/atomic: correct GOARM=7 guard at a DMB instruction
CL 525637 changed to the guard of DMB instruction from the
compiled-in runtime.goarm value to GOARM_7 macro and CPU feature
detection. It missed a place where runtime.goarm is loaded to a
register and reused later. This CL corrects the condition.

Fixes #65601.

Change-Id: I2ddefd03a1eb1048dbec0254c6e234c65b054279
Reviewed-on: https://go-review.googlesource.com/c/go/+/564855
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
2024-02-16 18:13:42 +00:00
Sam Thanawalla
720eadead2 cmd/go: do not embed checksums when building with vendor
Fixes #46400

Tested: Ran go test cmd/go
Change-Id: I60655129c55d40a70a13ed23937ef990f315fd73
Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest,gotip-windows-amd64-longtest
Reviewed-on: https://go-review.googlesource.com/c/go/+/564195
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Sam Thanawalla <samthanawalla@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Commit-Queue: Sam Thanawalla <samthanawalla@google.com>
2024-02-16 17:19:18 +00:00
Sam Thanawalla
b2a169be6f cmd/go: show Sum/GoModSum when listing modules
Fixes #52792

Tested: Ran go test cmd/go
Change-Id: Ib7006256f4dca9e9fbfce266c00253c69595d6ab
Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest,gotip-windows-amd64-longtest
Reviewed-on: https://go-review.googlesource.com/c/go/+/562775
Reviewed-by: Bryan Mills <bcmills@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-02-16 16:56:39 +00:00
sivchari
7f799f33b6 database/sql/driver: add a new test case for type t
Change-Id: I38bb68570f7f097a6dfeef1c75896396992d81f7
GitHub-Last-Rev: 10ba48a546
GitHub-Pull-Request: golang/go#53706
Reviewed-on: https://go-review.googlesource.com/c/go/+/416234
Reviewed-by: Than McIntosh <thanm@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2024-02-16 16:53:24 +00:00
qiulaidongfeng
74abbdfe62 crypto/subtle: remove unused code
Change-Id: I4e360e643d101a8f2188a2318557b0430a89d5cd
GitHub-Last-Rev: 046943ff48
GitHub-Pull-Request: golang/go#65747
Reviewed-on: https://go-review.googlesource.com/c/go/+/564736
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Than McIntosh <thanm@google.com>
2024-02-16 15:51:19 +00:00
qiulaidongfeng
6e5080470c crypto/subtle: use min builtin function in XORBytes
Change-Id: Ibf57dbaaa54486823e0769714dec2e22d6c5ea9e
GitHub-Last-Rev: 31421d0668
GitHub-Pull-Request: golang/go#65748
Reviewed-on: https://go-review.googlesource.com/c/go/+/564577
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
2024-02-16 15:50:40 +00:00
Dmitri Shuralyov
63dd79c07b cmd/pprof: update vendored github.com/google/pprof
Pull in the latest published version of github.com/google/pprof
as part of the continuous process of keeping Go's dependencies
up to date. Done with:

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

For #36905.
Fixes #65741.

Change-Id: Ice7b085c03ff69be97929cbe47bfd91954907529
Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest
Reviewed-on: https://go-review.googlesource.com/c/go/+/564636
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2024-02-16 15:19:53 +00:00
Cherry Mui
3b51581261 cmd/link: replace function pointers to static calls in loadelf
When transitioning between the old object loader and the new
object loader, to support both we made loadelf to take symbol
loading functions as function pointers. Now we only have the new
object loader. Change the function pointers back to static calls.

Change-Id: Ia623a6010376a3d7c0be5eacae002144d956f28a
Reviewed-on: https://go-review.googlesource.com/c/go/+/564635
Reviewed-by: Than McIntosh <thanm@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-02-16 15:12:12 +00:00
Cherry Mui
5258d4ed60 cmd/link: add -randlayout flag to randomize function ordering
Sometimes we found that benchmark results may strongly depend on
the ordering of functions laid out in the binary. This CL adds a
flag -randlayout=seed, which randomizes the function layout (in a
deterministic way), so can verify the benchmark results against
different function ordering.

Change-Id: I85f33881bbfd4ca6812fbd4bec00bf475755a09e
Reviewed-on: https://go-review.googlesource.com/c/go/+/562157
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Than McIntosh <thanm@google.com>
2024-02-16 14:59:05 +00:00
qiulaidongfeng
284e553035 runtime,cmd/link: merge pcbucketsize const into internal/abi
For #59670

Change-Id: I6343bacd3126fe6381a2e73be10f61691792824d
GitHub-Last-Rev: bbab8d1142
GitHub-Pull-Request: golang/go#65373
Reviewed-on: https://go-review.googlesource.com/c/go/+/559475
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2024-02-16 14:25:22 +00:00
Joel Sing
daa58db486 cmd/compile: improve rotations for riscv64
Enable canRotate for riscv64, enable rotation intrinsics and provide
better rewrite implementations for rotations. By avoiding Lsh*x64
and Rsh*Ux64 we can produce better code, especially for 32 and 64
bit rotations. By enabling canRotate we also benefit from the generic
rotation rewrite rules.

Benchmark on a StarFive VisionFive 2:

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

Change-Id: I1a2036fdc57cf88ebb6617eb8d92e1d187e183b2
Reviewed-on: https://go-review.googlesource.com/c/go/+/560315
Reviewed-by: M Zhuo <mengzhuo1203@gmail.com>
Run-TryBot: Joel Sing <joel@sing.id.au>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Mark Ryan <markdryan@rivosinc.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: David Chase <drchase@google.com>
2024-02-16 11:59:07 +00:00
Kir Kolyshkin
b634f6fdcb syscall: rm obsoleted comment
The comment being removed is no longer true as of CL 494916.

Change-Id: I4975866c58efb5c9c41db3640564ac7233f5840f
Reviewed-on: https://go-review.googlesource.com/c/go/+/542415
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Run-TryBot: Kirill Kolyshkin <kolyshkin@gmail.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2024-02-15 21:35:49 +00:00
Jin Lin
185f31bf30 cmd/compile: update the incorrect assignment of call site offset.
The call site calculation in the previous version is incorrect. For
the PGO preprocess file, the compiler should directly use the call
site offset value. Additionly, this change refactors the preprocess
tool to clean up unused fields including startline, the flat and the
cum.

Change-Id: I7bffed3215d4c016d9a9e4034bfd373bf50ab43f
Reviewed-on: https://go-review.googlesource.com/c/go/+/562795
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
2024-02-15 21:30:35 +00:00
pgxiaolianzi
b6ca586181 log/slog: add test case for level_test.go
adds a test case for the MarshalJSON and MarshalText method of the Level type in the slog package.

Change-Id: I3f79f0b46c41252ad9d743e03e34503e19998f3e
GitHub-Last-Rev: dab00d4c20
GitHub-Pull-Request: golang/go#65525
Reviewed-on: https://go-review.googlesource.com/c/go/+/561315
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
2024-02-15 14:41:24 +00:00
Joe Tsai
cfe7f21dd5 log/slog: document atomicity guarantees and ordering limitations of handlers
The new wording is slightly more strict than before in that
it guarantees each Write only contains exactly one Record,
while the previous wording opened up the possibility for
multiple Records in a Write call.

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

Change-Id: Ia65c50579215a35a1f5b2952c6954ddb60e7fe66
Reviewed-on: https://go-review.googlesource.com/c/go/+/563976
Reviewed-by: Jonathan Amsterdam <jba@google.com>
TryBot-Bypass: Jonathan Amsterdam <jba@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
2024-02-15 14:35:48 +00:00
Andy Pan
48d899dcdb net/http: reject requests with invalid Content-Length headers
According to RFC 9110 and RFC 9112, invalid "Content-Length" headers
might involve request smuggling or response splitting, which could
also cause security failures. Currently, `net/http` ignores all
"Content-Length" headers when there is a "Transfer-Encoding" header and
forward the message anyway while other mainstream HTTP implementations
such as Apache Tomcat, Nginx, HAProxy, Node.js, Deno, Tornado, etc. reject
invalid Content-Length headers regardless of the presence of a
"Transfer-Encoding" header and only forward chunked-encoding messages
with either valid "Content-Length" headers or no "Content-Length" headers.

Fixes #65505

Change-Id: I73af2ee0785137e56c7546a4cce4a5c5c348dbc5
Reviewed-on: https://go-review.googlesource.com/c/go/+/561075
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
2024-02-14 22:23:32 +00:00
Dmitri Shuralyov
d90a57ffe8 cmd/link/internal/ld: unify OS/SDK versions for macOS linking
Go 1.23 will require macOS 11 Big Sur or later, even on AMD64.
The comment here suggests the main requirement for the OS and
SDK version is to be recent enough not to break Apple signing,
and recent enough not to cause other problems.

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

For #64207.

Change-Id: I821fcb9a2a316de0703833c8a75abcbaa10b17a3
Cq-Include-Trybots: luci.golang.try:gotip-darwin-amd64_11,gotip-darwin-amd64_14,gotip-darwin-arm64_11,gotip-darwin-arm64_13
Reviewed-on: https://go-review.googlesource.com/c/go/+/563857
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2024-02-14 20:25:19 +00:00
Dmitri Shuralyov
b19164d5b4 doc/go1.23: document macOS requirements
For #64207.
For #65614.

Change-Id: Ia5365b4090060e0657c255341751d3e67691f836
Reviewed-on: https://go-review.googlesource.com/c/go/+/563856
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
2024-02-14 18:18:25 +00:00
qmuntal
1de46564a7 runtime: make netpoll events sources identifiable on Windows
This is another attempt at CL 558895, but without adding stale pollDescs
protection, which deviates from the original goal of the CL and adds
complexity without proper testing.

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

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

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

Change-Id: I91f746d300d32eb7fed3c8f27266fef379360d98
Reviewed-on: https://go-review.googlesource.com/c/go/+/561895
Reviewed-by: Than McIntosh <thanm@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2024-02-14 08:33:36 +00:00
qmuntal
69d6c7b8ee net: skip TestModeSocket on older Windows versions
CL 561937 taught os.Stat about IO_REPARSE_TAG_AF_UNIX and added a
test for it, TestModeSocket. This test fails on Windows older than
10.0.17063, in which AF_UNIX support was added. Skip the test on those
versions.

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

Change-Id: I6c21a78a1454d2d88321478288c0da1b8a93e590
Reviewed-on: https://go-review.googlesource.com/c/go/+/563256
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
2024-02-14 06:40:17 +00:00
Mauri de Souza Meneguzzo
0286a0822b runtime/cgo: mark fatalf as noreturn
Fixes #64553

Change-Id: I7860cd9ba74d70a7d988538ea4df8e122f94cde6
GitHub-Last-Rev: 0616437473
GitHub-Pull-Request: golang/go#64727
Reviewed-on: https://go-review.googlesource.com/c/go/+/550115
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Run-TryBot: Mauri de Souza Meneguzzo <mauri870@gmail.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2024-02-13 20:50:04 +00:00
Mauri de Souza Meneguzzo
db99b9b17c internal/asan: add new package
The internal/asan package contains helper functions for manually
instrumenting code for the address sanitizer. It reexports the asan
routines in runtime unconditionally, making the functions a no-op if the
build flag "asan" is not present.

For #64611

Change-Id: Ie79e698aea7a6d969afd2a5f008c084c9545b1a5
GitHub-Last-Rev: e658670c14
GitHub-Pull-Request: golang/go#64635
Reviewed-on: https://go-review.googlesource.com/c/go/+/548695
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-02-13 20:39:58 +00:00
Paul E. Murphy
1b541502c2 cmd/internal/obj/ppc64: rename and remove aliased optab classifiers
Rename C_LCON, C_SCON, C_ADDCON, C_ANDCON into their aliased names
and remove them.

Change-Id: I8f67cc973f8059e65b81669d91a44500fc136b0a
Reviewed-on: https://go-review.googlesource.com/c/go/+/563097
Run-TryBot: Paul Murphy <murp@ibm.com>
Reviewed-by: Lynn Boger <laboger@linux.vnet.ibm.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: David Chase <drchase@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2024-02-13 19:28:26 +00:00
Damien Neil
62cebb2e91 net/http: close connection if OnProxyConnectResponse returns an error
Fixes #64804

Change-Id: Ibe56ab8d114b8826e477b0718470d0b9fbfef9b0
Reviewed-on: https://go-review.googlesource.com/c/go/+/560856
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
2024-02-13 18:54:50 +00:00
Jonathan Amsterdam
e17e5308fd net/http: refine trailing-slash redirect logic
Do not add a trailing slash and redirect if the path already
ends in a slash.

Also, and unrelatedly, add a test for cleanPath.

Fixes #65624.

Change-Id: Ifcf9edc929d2eb6db88132c09d2bade85c5dda3d
Reviewed-on: https://go-review.googlesource.com/c/go/+/562557
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-02-13 13:54:22 +00:00
Ian Lance Taylor
2a59041420 internal/safefilepath: use bytealg to search for zero byte
Change-Id: I20e72d421d89095c460495001969291b99cdf59e
Reviewed-on: https://go-review.googlesource.com/c/go/+/563139
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
2024-02-13 05:02:46 +00:00
Rob Pike
0336d5eb43 time: fix typo in ExampleParseDuration
A typo without consequences, but confusing nonetheless. The last
line prints micro2 and then micro, instead of micro2 twice.
One-character fix.

Fixes #65666

Change-Id: I61d636382a2223d53eac58d6ddbcc7c15b4efc85
Reviewed-on: https://go-review.googlesource.com/c/go/+/563275
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Run-TryBot: Rob Pike <r@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
2024-02-13 01:05:00 +00:00
Rob Pike
718dc025e7 fmt: clear width and precision when recovering formatting object from the pool
Probably a day 1 oversight, and almost always inconsequential, but
there is evidence of occasional trouble. There is no reason not to
clear them.

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

Fixes #61913

Change-Id: I0f7bbb4ab2780d8999d3ff7a35255dc07fb5c7e1
Reviewed-on: https://go-review.googlesource.com/c/go/+/556215
Run-TryBot: Rob Pike <r@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
2024-02-13 01:04:48 +00:00
Rob Pike
36fb6160ae fmt: document how %#g handles infinities and NaNs
The %#g format prints a "Go-syntax representation", but there is
no such thing for IEEE754 infinities and NaNs, so just document
what happens, which is that it prints +Inf, -Inf, or NaN.  We could
show something like math.Inf(1) and math.Nan(), but that doesn't
sit right, and anyway for NaNs you can't even recover the original
value. Simpler and more honest to give up.

Fixes #51486

Change-Id: I8d4e8186f5d7acc3e0e7b51d0b322142908ea0a2
Reviewed-on: https://go-review.googlesource.com/c/go/+/557235
Run-TryBot: Rob Pike <r@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2024-02-13 01:04:30 +00:00
Michael Pratt
e45c262fe5 runtime/cgo: add note about default stack bounds
The default case in x_cgo_getstackbound does not actually get the stack bound of
the current thread, but estimates the bound based on the default stack size. Add
a comment noting this.

Change-Id: I7d886461f0bbc795834bed37b554417cf3837a2d
Reviewed-on: https://go-review.googlesource.com/c/go/+/563376
Auto-Submit: Michael Pratt <mpratt@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-02-12 22:38:23 +00:00
Alan Donovan
4619121d84 runtime: skip failing traceback test on Android
See e.g. https://build.golang.org/log/1e6bd28cf75679c66479025c1a0d9082734cf33e

Change-Id: Ic13bc0a40d04afe693d1de07973e2540dadacb23
Reviewed-on: https://go-review.googlesource.com/c/go/+/563415
Reviewed-by: Than McIntosh <thanm@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-02-12 18:37:32 +00:00
Jes Cok
9cc0f9cba2 internal/xcoff: change zeroReaderAt to nobitsSectionReader for .bss with all 0s
Fixes #63337

Change-Id: I239315047e6e4325e2f471108fd764f8dbb7d5b2
GitHub-Last-Rev: cacdf0a279
GitHub-Pull-Request: golang/go#64952
Reviewed-on: https://go-review.googlesource.com/c/go/+/553616
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
2024-02-12 14:42:29 +00:00
Joe Tsai
2413629aa8 reflect: optimize TypeFor for non-interface types
The reflect.Type.Elem method is somewhat slow,
which is unfortunate since the reflect.TypeOf((*T)(nil)).Elem()
trick is only needed if T is an interface.

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

Performance:

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

Updates #60088

Change-Id: I2ae76988c9a3dbcbae10d2c19b55db3c8d4559bf
Reviewed-on: https://go-review.googlesource.com/c/go/+/555597
Auto-Submit: Joseph Tsai <joetsai@digital-static.net>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Run-TryBot: Joseph Tsai <joetsai@digital-static.net>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Mauri de Souza Meneguzzo <mauri870@gmail.com>
2024-02-12 14:38:07 +00:00
codesoap
2b58355ef6 net/http: remove superfluous newline on redirects
Change-Id: I30d3ae9d540f9cc85ea5a6875ee8884d3e646d6f
GitHub-Last-Rev: 29cabdcb3a
GitHub-Pull-Request: golang/go#65623
Reviewed-on: https://go-review.googlesource.com/c/go/+/562356
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
TryBot-Bypass: Dmitri Shuralyov <dmitshur@golang.org>
2024-02-12 14:35:18 +00:00
qmuntal
628b1015b9 os: add os.ModeSocket support to os.Stat on windows
Unix sockets are identified by the IO_REPARSE_TAG_AF_UNIX reparse tag.

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

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

Fixes #33357.

Change-Id: Iea8f24b20672c8d4b03f55ef298d128431dc3fac
Reviewed-on: https://go-review.googlesource.com/c/go/+/561937
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
2024-02-12 07:15:06 +00:00
Mauri de Souza Meneguzzo
4a7f3ac8eb runtime/cgo: ignore -Watomic-alignment in gcc_libinit.c
When cross-compiling a cgo program with CC=clang for Linux/ARMv5,
atomic warnings cause build errors, as cgo uses -Werror.

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

Fixes #65290

Change-Id: Ie72efb77468f06888f81f15850401dc8ce2c78f9
GitHub-Last-Rev: fbad847b96
GitHub-Pull-Request: golang/go#65588
Reviewed-on: https://go-review.googlesource.com/c/go/+/562348
Auto-Submit: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2024-02-10 02:14:22 +00:00
Andy Pan
bf821f65cf io/fs: set ErrInvalid for FS.Open from SubFS when it fails ValidPath
Fixes #65419

Change-Id: I8f9f82ab0387d8bb39aaca4f9e60e36ee15c587d
Reviewed-on: https://go-review.googlesource.com/c/go/+/560137
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2024-02-10 02:10:17 +00:00
Andy Pan
a18789041c net: skip BenchmarkSendFile on Windows
Follow up CL 543276

Change-Id: Ie02cf8a489a069bb0a3be1d8636e30d0658329c5
Reviewed-on: https://go-review.googlesource.com/c/go/+/562595
Reviewed-by: Bryan Mills <bcmills@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
2024-02-10 02:03:41 +00:00
Nicolas Hillegeer
20f4b6d8f9 runtime: call traceAdvance before exiting
This ensures the trace buffers are as up-to-date as possible right
before crashing. It increases the chance of finding the culprit for the
crash when looking at core dumps, e.g. if slowness is the cause for the
crash (monitor kills process).

Fixes #65319.

Change-Id: Iaf5551911b3b3b01ba65cb8749cf62a411e02d9c
Reviewed-on: https://go-review.googlesource.com/c/go/+/562616
Auto-Submit: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2024-02-10 00:14:50 +00:00
Antonio Ojea
2dfc5eae2e net: don't retry truncated TCP responses
UDP messages may be truncated:

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

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

However, TCP also have a size limitation of 65535 bytes

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

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

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

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

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

Fixes #64896

Signed-off-by: Antonio Ojea <aojea@google.com>
Change-Id: I1bc2c85f67668765fa60b5c0378c9e1e1756dff2
Reviewed-on: https://go-review.googlesource.com/c/go/+/552418
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Gudger <ian@iangudger.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Mateusz Poliwczak <mpoliwczak34@gmail.com>
Reviewed-by: Mauri de Souza Meneguzzo <mauri870@gmail.com>
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-02-09 22:40:39 +00:00
Paul E. Murphy
69f1290fcb cmd/internal/obj/ppc64: add new constant optab classifications
Make C_S32CON, C_U32CON, and C_32CON distinct classifiers to allow
more specific matching of 32 bit constants. C_U31CON is added to
support C_S32CON.

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

Change-Id: I193acc0ded8f3edd91d306e39c3e7e55a9811e04
Reviewed-on: https://go-review.googlesource.com/c/go/+/562346
Reviewed-by: Lynn Boger <laboger@linux.vnet.ibm.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Run-TryBot: Paul Murphy <murp@ibm.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2024-02-09 22:14:57 +00:00
Michael Pratt
644bc4a3e7 internal/trace: run children in race mode during race testing
This would have caught #65607.

On my machine:

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

For #65607.

Change-Id: I03a555ebaf8c761c98a82b6d35fa16d7a99aa9e3
Reviewed-on: https://go-review.googlesource.com/c/go/+/562998
Auto-Submit: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2024-02-09 20:17:00 +00:00
Michael Pratt
09c62a86a9 internal/trace: fix race condition in gc-stress
Multiple goroutines all writing to the same sink triggers the race detector,
rightfully so.

Change-Id: Ia64836d0d88c0f587a6cb96ed747f656a3c1804a
Reviewed-on: https://go-review.googlesource.com/c/go/+/562997
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2024-02-09 20:10:45 +00:00