1
0
mirror of https://github.com/golang/go synced 2024-11-15 07:40:47 -07:00
Commit Graph

60068 Commits

Author SHA1 Message Date
Zxilly
f6653e6b0b cmd/go/internal/modget: warn -d is a no-op
Updates #43684

Change-Id: I4aa340b1b819374159b5b6b99c14e3f70bfa1bb0
GitHub-Last-Rev: c380648b9a
GitHub-Pull-Request: golang/go#66362
Reviewed-on: https://go-review.googlesource.com/c/go/+/572176
Reviewed-by: Michael Matloob <matloob@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Sam Thanawalla <samthanawalla@google.com>
2024-05-20 19:40:06 +00:00
Tobias Klauser
569a0ef4c7 syscall: use internal/byteorder in plan9 directory marshaling helpers
Change-Id: I277565ddb348e6a7cca18015d3d80abf0575b5a5
Reviewed-on: https://go-review.googlesource.com/c/go/+/585716
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2024-05-20 19:32:38 +00:00
aimuz
d51fc260e4 internal/fmtsort: use cmp.Compare for value comparisons
Refactor compare function to use cmp.Compare for various types.
Remove redundant floatCompare and isNaN functions.

Change-Id: I146a7af9158538499d07daee930aad8cf89b7e8f
GitHub-Last-Rev: d98365c044
GitHub-Pull-Request: golang/go#67454
Reviewed-on: https://go-review.googlesource.com/c/go/+/586239
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>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2024-05-20 19:31:45 +00:00
Lorenz Bauer
447ad32a1d encoding/binary: speed up Size
Size() is currently not called from the fast path, since the package
handles the buffer sizing for Read and Write internally. This will change
when adding Append() because callers can use Size to avoid allocations when
writing into bytes.Buffer via AvailableBuffer for example.

Add a fast path for simple types and extend the existing struct size cache
to arrays of structs.

Change-Id: I3af16a2b6c9e2dbe6166a2f8c96bcd2e936719e2
Reviewed-on: https://go-review.googlesource.com/c/go/+/584358
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Austin Clements <austin@google.com>
2024-05-20 19:16:18 +00:00
Lorenz Bauer
04bf36e973 encoding/binary: add Append, Encode and Decode
Add a function which appends the binary representation of a value to the end of a slice.
This allows users to encode values with zero allocations. Also add Encode and Decode
functions which mimic unicode/utf8.

goos: darwin
goarch: arm64
pkg: encoding/binary
cpu: Apple M1 Pro
                            │   base.txt    │             append.txt              │
                            │    sec/op     │    sec/op     vs base               │
ReadSlice1000Int32s-10         2.690µ ±  0%    2.532µ ± 3%   -5.86% (p=0.002 n=6)
ReadStruct-10                  205.8n ±  0%    201.4n ± 1%   -2.14% (p=0.002 n=6)
WriteStruct-10                 159.1n ±  0%    153.5n ± 0%   -3.55% (p=0.002 n=6)
WriteSlice1000Structs-10       129.8µ ±  0%    124.2µ ± 0%   -4.34% (p=0.002 n=6)
ReadSlice1000Structs-10        161.7µ ±  0%    160.3µ ± 0%   -0.89% (p=0.002 n=6)
ReadInts-10                    156.8n ±  0%    161.6n ± 0%   +3.09% (p=0.002 n=6)
WriteInts-10                   134.5n ±  0%    139.5n ± 2%   +3.72% (p=0.002 n=6)
WriteSlice1000Int32s-10        2.691µ ± 16%    2.551µ ± 4%   -5.20% (p=0.002 n=6)
PutUint16-10                  0.6448n ±  4%   0.6212n ± 1%        ~ (p=0.093 n=6)
AppendUint16-10                1.414n ±  0%    1.424n ± 1%        ~ (p=0.115 n=6)
PutUint32-10                  0.6210n ±  0%   0.6211n ± 0%        ~ (p=0.833 n=6)
AppendUint32-10                1.414n ±  0%    1.426n ± 1%   +0.85% (p=0.017 n=6)
PutUint64-10                  0.6210n ±  0%   0.6394n ± 1%   +2.95% (p=0.002 n=6)
AppendUint64-10                1.414n ±  0%    1.427n ± 2%        ~ (p=0.052 n=6)
LittleEndianPutUint16-10      0.6239n ±  0%   0.6271n ± 1%        ~ (p=0.063 n=6)
LittleEndianAppendUint16-10    1.421n ±  0%    1.432n ± 1%   +0.81% (p=0.002 n=6)
LittleEndianPutUint32-10      0.6240n ±  0%   0.6240n ± 0%        ~ (p=0.766 n=6)
LittleEndianAppendUint32-10    1.422n ±  1%    1.425n ± 0%        ~ (p=0.673 n=6)
LittleEndianPutUint64-10      0.6242n ±  0%   0.6238n ± 0%   -0.08% (p=0.030 n=6)
LittleEndianAppendUint64-10    1.420n ±  0%    1.449n ± 1%   +2.04% (p=0.002 n=6)
ReadFloats-10                  39.36n ±  0%    42.54n ± 1%   +8.08% (p=0.002 n=6)
WriteFloats-10                 33.65n ±  0%    35.27n ± 1%   +4.80% (p=0.002 n=6)
ReadSlice1000Float32s-10       2.656µ ±  0%    2.526µ ± 1%   -4.91% (p=0.002 n=6)
WriteSlice1000Float32s-10      2.765µ ±  0%    2.857µ ± 3%   +3.31% (p=0.002 n=6)
ReadSlice1000Uint8s-10         129.1n ±  1%    130.4n ± 1%        ~ (p=0.126 n=6)
WriteSlice1000Uint8s-10       144.90n ±  3%    18.67n ± 2%  -87.12% (p=0.002 n=6)
PutUvarint32-10                12.11n ±  0%    12.12n ± 0%        ~ (p=0.675 n=6)
PutUvarint64-10                30.82n ±  0%    30.79n ± 1%        ~ (p=0.658 n=6)
AppendStruct-10                                107.8n ± 0%
AppendSlice1000Structs-10                      119.0µ ± 0%
AppendInts-10                                  55.29n ± 0%
AppendSlice1000Int32s-10                       2.211µ ± 1%
geomean                        33.07n          48.18n        -7.03%

Fixes #60023

Change-Id: Ife3f217b11d5f3eaa5a53fe8a7e877552f751f94
Reviewed-on: https://go-review.googlesource.com/c/go/+/579157
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Austin Clements <austin@google.com>
Reviewed-by: Ingo Oeser <nightlyone@googlemail.com>
Reviewed-by: Austin Clements <austin@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-05-20 18:58:26 +00:00
Michael Matloob
a55edb7b55 cmd/go: add telemetry for a predefined set of GOROOT values
For #58894

Change-Id: Ia30a3a1a9c7b611f55701956c08caa967634cd5a
Reviewed-on: https://go-review.googlesource.com/c/go/+/586138
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Sam Thanawalla <samthanawalla@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
2024-05-20 18:46:51 +00:00
Michael Matloob
80964338a5 cmd/dist: set GOPROXY=off when GOPATH is set to be in GOROOT
Avoid downloading modules into a modcache in the GOROOT directory. That
creates read only files in GOROOT, which is undesirable.

Fixes #67463

Change-Id: I6d10c605be5eba967648d823ee8fc915716b4b5b
Reviewed-on: https://go-review.googlesource.com/c/go/+/586078
Reviewed-by: Robert Findley <rfindley@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-05-20 18:34:40 +00:00
Jes Cok
fd54936ea5 doc: simplify links for release notes
Change-Id: If9e3c5a58726ae3628d2e835d71f1a4708594c11
Reviewed-on: https://go-review.googlesource.com/c/go/+/586575
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
2024-05-20 18:34:13 +00:00
Jayanth Krishnamurthy
f726c8d0fd ppc64x: code cleanup in assembly files
Replacing Branch Conditional (BC) with its extended mnemonic form of  BDNZ and BDZ.
- BC 16, 0, target can be replaced by BDNZ target
- BC 18, 0, target can be replaced by BDZ target

Change-Id: I1259e207f2a40d0b72780d5421f7449ddc006dc5
Cq-Include-Trybots: luci.golang.try:gotip-linux-ppc64_power10,gotip-linux-ppc64_power8,gotip-linux-ppc64le_power8,gotip-linux-ppc64le_power9,gotip-linux-ppc64le_power10
Reviewed-on: https://go-review.googlesource.com/c/go/+/585077
Reviewed-by: Carlos Amedee <carlos@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Lynn Boger <laboger@linux.vnet.ibm.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2024-05-20 18:05:32 +00:00
aimuz
2b0f2f8169 maps: add All, Keys, Values, Insert, Collect
Fixed #61900.

Change-Id: Ic5962dc92b3102e7448635bef541414a2eaf415e
GitHub-Last-Rev: 3c6f74d617
GitHub-Pull-Request: golang/go#67521
Reviewed-on: https://go-review.googlesource.com/c/go/+/586716
Auto-Submit: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Commit-Queue: Ian Lance Taylor <iant@google.com>
Reviewed-by: Russ Cox <rsc@golang.org>
Auto-Submit: Russ Cox <rsc@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2024-05-20 16:01:35 +00:00
Ian Lance Taylor
4edb367bac cmd/cgo: don't force rewritten code onto a single line
Doing that appears to have been a mistake in CL 142883.

Fixes #67517

Change-Id: Iec6b897984a2e27ec596fc3c4c8129e9620afab1
Reviewed-on: https://go-review.googlesource.com/c/go/+/586676
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: Russ Cox <rsc@golang.org>
2024-05-20 15:50:06 +00:00
Ian Lance Taylor
7ffa8d0a5b cmd/go: accept -mcmodel and -mlarge-data-threshold compiler flags
For #67475

Change-Id: Ia90952eb7c19764306205928ead50bff22857378
Reviewed-on: https://go-review.googlesource.com/c/go/+/586675
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
2024-05-20 15:47:34 +00:00
guoguangwu
834f9710c3 cmd/internal/telemetry: fix typo in comments
Change-Id: I5595206674170351691b1d9869356db654f20ebb
GitHub-Last-Rev: bc0d4d13f6
GitHub-Pull-Request: golang/go#67464
Reviewed-on: https://go-review.googlesource.com/c/go/+/586159
Reviewed-by: qiu laidongfeng2 <2645477756@qq.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-05-20 15:47:30 +00:00
Cherry Mui
9a9dd72d5c cmd/link: add runtime.text.N symbols to macho symbol table in dynlink mode
In dynamic linking mode (e.g. when using plugins) on darwin, the
marker symbols runtime.text and runtime.etext are added to Textp
in an early stage, so when adding symbols to the symbol table we
don't need to explicitly add them. However, when splitting text
sections, the runtime.text.N marker symbols for the addtional
sections are not added to Textp. So we do need to add them
explicitly to the symbol table.

Fixes #66993.

Change-Id: Ic718d03cd71fc0bfb931cff82640b1f4c53b89be
Reviewed-on: https://go-review.googlesource.com/c/go/+/586555
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Than McIntosh <thanm@google.com>
2024-05-20 15:32:53 +00:00
apocelipes
e3d87d1932 hash: use more internal/byteorder functions to simplify the code
A follow-up for the CL 585015.

Change-Id: I412f33f1d75abe1446cb3fd742d44d3cb4350380
GitHub-Last-Rev: 554ace757c
GitHub-Pull-Request: golang/go#67476
Reviewed-on: https://go-review.googlesource.com/c/go/+/586240
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>
Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Commit-Queue: Ian Lance Taylor <iant@google.com>
2024-05-18 22:36:41 +00:00
Michael Mitchell
e7bf9959fd runtime: remove unused code in (*pallocBits).findLargeN
Change-Id: I9611edb9663a9c32bb23d26b9b22b79a54a97498
Reviewed-on: https://go-review.googlesource.com/c/go/+/586196
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
2024-05-18 15:13:43 +00:00
aimuz
1667dbd7be net: use stringslite package for string operations
- Replace manual string suffix removal with stringslite.TrimSuffix in conf.go
- Use stringslite.Cut for string splitting in ParseCIDR function in ip.go
- Add stringslite import in ip.go

This change simplifies string operations and improves code readability.

Change-Id: I02c238d0bc91e95789d8060e6ef4c7d4f6e3f0d9
GitHub-Last-Rev: aef5dc5011
GitHub-Pull-Request: golang/go#67461
Reviewed-on: https://go-review.googlesource.com/c/go/+/586157
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@golang.org>
Commit-Queue: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
2024-05-18 03:13:26 +00:00
Paul E. Murphy
105ac94486 cmd/asm: on PPC64, fix assembling of FCMPO opcode
The assembler should pack 3 argument usage of FCMPO similar
to other CMP-like opcodes.

Fixes #67359

Change-Id: Icfb42a67d741431a70dd880806857b4c38f42d62
Reviewed-on: https://go-review.googlesource.com/c/go/+/585640
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Lynn Boger <laboger@linux.vnet.ibm.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2024-05-17 21:53:50 +00:00
Austin Clements
b4376b8513 runtime: skip coro cgo test on platforms without cgo
Change-Id: Ibbe82a3ae2a67fb8f2b831130123dc74bc4dc9dc
Reviewed-on: https://go-review.googlesource.com/c/go/+/586535
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-05-17 21:36:37 +00:00
Austin Clements
6ec291f495 internal/runtime/atomic: fix missing linknames
CL 544455, which added atomic And/Or APIs, raced with CL 585556, which
enabled stricter linkname checking. This caused linkname-related
failures on ARM and MIPS. Fix this by adding the necessary linknames.

We fix one other linkname that got overlooked in CL 585556.

Updates #61395.

Change-Id: I454f0767ce28188e550a61bc39b7e398239bc10e
Reviewed-on: https://go-review.googlesource.com/c/go/+/586516
Reviewed-by: Mauri de Souza Meneguzzo <mauri870@gmail.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Austin Clements <austin@google.com>
2024-05-17 20:08:37 +00:00
Michael Anthony Knyszek
dfe781e1eb runtime: fix coro interactions with thread-locked goroutines
This change fixes problems with thread-locked goroutines using
newcoro/coroswitch/etc. Currently, the coro paths do not consider
thread-locked goroutines at all and can quickly result in broken
scheduler state or lost/leaked goroutines.

One possible fix to these issues is to fall back on goroutine+channel
semantics, but that turns out to be fairly complicated to implement and
results in significant performance cliffs. More complex thread-lock
state donation tricks also result in some fairly complicated state
tracking that doesn't seem worth it given the use-cases of iter.Pull
(and even then, there will be performance cliffs).

This change implements a much simpler, but more restrictive semantics.
In particular, thread-lock state is tied to the coro at the first call
to newcoro (i.e. iter.Pull). From then on, the invariant is that if the
coro has any thread-lock state *or* a goroutine calling into coroswitch
has any thread-lock state, that the full gamut of thread-lock state must
remain the same as it was when newcoro was called (the full gamut
meaning internal and external lock counts as well as the identity of the
thread that was locked to).

This semantics allows the common cases to be always fast, but comes with
a non-orthogonality caveat. Specifically, when iter.Pull is used in
conjunction with thread-locked goroutines, complex cases (passing next
between goroutines or passing yield between goroutines) are likely to
fail. Simple cases, where any number of iter.Pull iterators are used in
a straightforward way (nested, in series, etc.) from the same
goroutine, will work and will be guaranteed to be fast regardless of
thread-lock state.

This is a compromise for the near-term and we may consider lifting the
restrictions imposed by this CL in the future.

Fixes #65889.
Fixes #65946.

Change-Id: I3fb5791e36a61f5ded50226a229a79d28739b24e
Reviewed-on: https://go-review.googlesource.com/c/go/+/583675
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Austin Clements <austin@google.com>
2024-05-17 19:46:10 +00:00
Carlos Amedee
5890b023a5 internal/trace: move v2 tracer into trace directory
This change moves the v2 tracer into the trace directory.

Updates #67367

Change-Id: I3657b4227002cb00fdf29c797434800ea796715e
Reviewed-on: https://go-review.googlesource.com/c/go/+/584538
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-05-17 18:48:18 +00:00
Mauri de Souza Meneguzzo
192d65e46b sync/atomic: public And/Or ops and race instrumentation
This CL implements the new sync/atomic AND and OR apis as well as their race
counterparts.

Fixes #61395

Change-Id: I294eefe4b3ac27bc4ed237edcbfa88a8c646d86f
GitHub-Last-Rev: f174297007
GitHub-Pull-Request: golang/go#64331
Reviewed-on: https://go-review.googlesource.com/c/go/+/544455
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
Auto-Submit: Austin Clements <austin@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
2024-05-17 18:37:29 +00:00
Carlos Amedee
664088b898 internal/trace: remove remnanats of v1 tracer
This change removes unused parts of the v1 tracer in preperation of
the move of the v2 tracer into the trace package.

Updates #67367

Change-Id: I3e53a8afdef72dc90c2d5b514380d1077d284bc7
Reviewed-on: https://go-review.googlesource.com/c/go/+/584537
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-05-17 18:31:04 +00:00
Michael Matloob
e95f6af008 cmd/go/internal/envcmd: remove duplicate env value set
CL 586095 wasn't needed because setting the GODEBUG value was just moved
lower in CL 563137. Now we set it twice. Remove the second set so that
it's only set once.

Change-Id: I4a830977833b007e996d0ccaec705a1da4631e6c
Reviewed-on: https://go-review.googlesource.com/c/go/+/586477
Reviewed-by: Sam Thanawalla <samthanawalla@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-05-17 18:28:42 +00:00
Carlos Amedee
01ad44bc08 cmd/trace: collapse v2 directory into trace
This change removes the old trace code and replaces it with the new tracer.
It does the following:
- Moves the contents of the v2 directory into the parent trace directory.
- Combines the old tracer main file with the new main file.
- Replaces any existing files with the corresponding v2 files.
- Removes any unused files.

Updates #67367

Change-Id: I2237920e13588258a2442b639d562cf7f8a8e944
Reviewed-on: https://go-review.googlesource.com/c/go/+/584536
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2024-05-17 17:15:58 +00:00
Cherry Mui
003683f41d cmd/link: enable checklinkname by default
Fixes #67401.

Change-Id: Ia8e091c77414cd1281cadc524215ef89ba9184b2
Reviewed-on: https://go-review.googlesource.com/c/go/+/585556
Reviewed-by: Russ Cox <rsc@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Mauri de Souza Meneguzzo <mauri870@gmail.com>
2024-05-17 16:59:50 +00:00
Cherry Mui
41aab30bd2 all: add push linknames to allow legacy pull linknames
CL 585358 adds restrictions to disallow pull-only linknames
(currently off by default). Currently, there are quite some pull-
only linknames in user code in the wild. In order not to break
those, we add push linknames to allow them to be pulled. This CL
includes linknames found in a large code corpus (thanks Matthew
Dempsky and Michael Pratt for the analysis!), that are not
currently linknamed.

Updates #67401.

Change-Id: I32f5fc0c7a6abbd7a11359a025cfa2bf458fe767
Reviewed-on: https://go-review.googlesource.com/c/go/+/586137
Reviewed-by: Russ Cox <rsc@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-05-17 16:48:00 +00:00
Robert Griesemer
f73dd8173a go/types: re-enable suppressed gcimporter tests
Port CL 577616 from types2 to go/types allows us
to re-enable these tests.

Fixes #66859.
Fixes #67436.
Updates #50259.
Updates #65294.

Change-Id: I573e51cf16546ac1c115beac5322b51dd998c881
Reviewed-on: https://go-review.googlesource.com/c/go/+/586236
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
2024-05-17 16:22:59 +00:00
Damien Neil
a61729b880 net/http: return correct error when reading from a canceled request body
CL 546676 inadvertently changed the error returned when reading
from the body of a canceled request. Fix it.

Rework various request cancelation tests to exercise all three ways
of canceling a request.

Fixes #67439

Change-Id: I14ecaf8bff9452eca4a05df923d57d768127a90c
Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest,gotip-linux-amd64-longtest-race
Reviewed-on: https://go-review.googlesource.com/c/go/+/586315
Auto-Submit: Damien Neil <dneil@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-05-17 15:58:58 +00:00
Jes Cok
2c635b68fd runtime: make use of stringslite.{HasPrefix, HasSuffix}
Change-Id: I7461a892e1591e3bad876f0a718a99e6de2c4659
Reviewed-on: https://go-review.googlesource.com/c/go/+/585435
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2024-05-17 15:41:45 +00:00
Paul E. Murphy
d11e417285 cmd/compile/internal/ssa: cleanup ANDCCconst rewrite rules on PPC64
Avoid creating duplicate usages of ANDCCconst. This is preparation for
a patch to reintroduce ANDconst to simplify the lower pass while
treating ANDCCconst like other *CC* ssa opcodes.

Also, move many of the similar rules wich retarget ANDCCconst users
to the flag result to a common rule for all compares against zero.

Change-Id: Ida86efe17ff413cb82c349d8ef69d2899361f4c0
Reviewed-on: https://go-review.googlesource.com/c/go/+/585400
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Lynn Boger <laboger@linux.vnet.ibm.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2024-05-17 15:28:00 +00:00
Kir Kolyshkin
2f6426834c 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. Add/use pidfdWorks, which checks that all needed pidfd-related
   functionality works.

2. os.StartProcess: obtain the pidfd from the kernel, if possible, 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.

3. (*Process).Kill: use pidfdSendSignal, if available and the pidfd is
   known. Otherwise, fall back to the old implementation.

4. (*Process).Wait: use pidfdWait, if available, otherwise fall back to
   using waitid/wait4. This is 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.

Rework of CL 528438 (reverted in CL 566477 because of #65857).

For #62654.
Updates #13987.

Change-Id: If5ef8920bd8619dc428b6282ffe4fb8c258ca224
Reviewed-on: https://go-review.googlesource.com/c/go/+/570036
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Kirill Kolyshkin <kolyshkin@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Cherry Mui <cherryyz@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
2024-05-17 01:23:00 +00:00
qiulaidongfeng
69105d79ef cmd/go: unexport loadImport
Complete a TODO.

Change-Id: I39869df4d95a5a5f6019e281719b942fbf4ba7db
GitHub-Last-Rev: c664b5332e
GitHub-Pull-Request: golang/go#67091
Reviewed-on: https://go-review.googlesource.com/c/go/+/581939
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2024-05-17 00:11:59 +00:00
Jorropo
1b8117b34a cmd/compile: fix indentation level in generic.rules
Change-Id: I60a9abe72f786e18a59339df271c5521d2d1cda2
Reviewed-on: https://go-review.googlesource.com/c/go/+/555155
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Mauri de Souza Meneguzzo <mauri870@gmail.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2024-05-16 22:21:05 +00:00
Mauri de Souza Meneguzzo
c89318667f runtime: cleanup crashstack code
This patch removes redundant guards for the crash stack feature, as all
supported Go architectures now have a crash stack implementation.

Change-Id: I7ffb61c57955778d687073418130b2aaab0ff183
GitHub-Last-Rev: 6ff56d6420
GitHub-Pull-Request: golang/go#67202
Reviewed-on: https://go-review.googlesource.com/c/go/+/583416
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Run-TryBot: Mauri de Souza Meneguzzo <mauri870@gmail.com>
2024-05-16 21:49:14 +00:00
Michael Matloob
036e93ba76 cmd/go: add go telemetry command and GOTELEMETRY, GOTELEMETRYDIR
Add the go telemetry command to support setting and viewing the
telemetry mode. Also add the non-settable GOTELEMETRY and GOTELEMETRYDIR
variables to go env, which contain the mode and telemetry dir.

For #67111

Change-Id: Id7e89cefe30acfe3d865fa467315fe7cda975de9
Reviewed-on: https://go-review.googlesource.com/c/go/+/584535
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Sam Thanawalla <samthanawalla@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-05-16 20:16:39 +00:00
Robert Griesemer
26ed0528c7 go/types, types2: report error for floating-point iteration variable
While at it, slightly improve documentation and code.
Also, add additional test cases for #66561.

Updates #66561.
Fixes #67027.

Change-Id: I682b0e9227e065d6bbd199871c2e1ecff13edc66
Reviewed-on: https://go-review.googlesource.com/c/go/+/580937
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>
2024-05-16 18:56:00 +00:00
Chen.Zhidong
a523152ea1 net/http: add Pattern field in Request to return matched pattern info
Fixes #66405

Change-Id: Icd80944b6ca081aa7addd4fb85d2b3c29b6c9542
GitHub-Last-Rev: c6e32742c4
GitHub-Pull-Request: golang/go#66618
Reviewed-on: https://go-review.googlesource.com/c/go/+/574997
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-05-16 18:42:34 +00:00
Jonathan Amsterdam
06b4578160 doc/README.md: give example of package-less symbol link
Change-Id: I84d7b6aae7319cc62628a2b5ee752a0680377a15
Reviewed-on: https://go-review.googlesource.com/c/go/+/586135
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2024-05-16 18:37:47 +00:00
Mike Beaumont
78e50d0fa0 crypto/tls: don't call tlsrsakex.IncNonDefault with FIPS
We haven't called tlsrsakex.Value() yet at this point if we're using
FIPS, like if CipherSuites != nil. This adds needFIPS as a gate next to
CipherSuites != nil. FIPS specifies suites that would be skipped if
tlsarsakex were set.

Fixes #65991

Change-Id: I8070d8f43f27c04067490af8cc7ec5e787f2b9bd
Reviewed-on: https://go-review.googlesource.com/c/go/+/582315
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Bypass: Filippo Valsorda <filippo@golang.org>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2024-05-16 17:33:18 +00:00
Yoann Congal
18104621ce crypto/x509: fix certificate request creation with RSA-PSS
In case of a RSA-PSS algorithm, the hashFunc of CreateCertificateRequest
is embedded in a rsa.PSSOptions struct. Given to key.Sign(), this will
generate a proper RSA-PSS signature.

Pasted from the RSA-PSS handling code in CreateCertificate().

Fixes #45990
Fixes #65074

Change-Id: I8475afa79d8add107f092cc2871d38300e7b3903
GitHub-Last-Rev: 63fb0214c3
GitHub-Pull-Request: golang/go#55153
Reviewed-on: https://go-review.googlesource.com/c/go/+/431916
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
TryBot-Bypass: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Alex Scheel <alex.scheel@hashicorp.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2024-05-16 17:32:30 +00:00
Tobias Klauser
6ed31e3c3e net: fix typo in ctrlCtxFn parameter name
context.Context parameters are commonly named ctx, not cxt.

Change-Id: Icaadbcd38b054694959e5e8a058552a3e54be6d4
Reviewed-on: https://go-review.googlesource.com/c/go/+/586016
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
2024-05-16 16:54:32 +00:00
apocelipes
2b42ed6483 crypto: use byteorder to simplify consumeUint32 and consumeUint64
A follow-up for the recent CL 585017.

Change-Id: I9faaff7fdf62fc931fc7f64dbe238de277280730
GitHub-Last-Rev: 468d60c396
GitHub-Pull-Request: golang/go#67425
Reviewed-on: https://go-review.googlesource.com/c/go/+/586035
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-05-16 16:50:58 +00:00
Jonathan Amsterdam
4c1cc1c97f doc/next/64910.md: reword release note
Change-Id: I41a01dd2bcaf5716703946bad42830d4e8095c11
Reviewed-on: https://go-review.googlesource.com/c/go/+/586136
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-05-16 16:44:13 +00:00
Rob Findley
6a05055780 go/ast: fix bug handling the result of yield in Preorder
Once yield returns false, ast.Preorder must not call yield on any more
nodes. Even after the function passed to ast.Inspect returns false, it
may be invoked again with a non-nil node. Therefore, we must explicitly
truncate the inspection.

For #66339

Change-Id: I2b01e4e96a2d7aca785467c15ab59da13208c161
Reviewed-on: https://go-review.googlesource.com/c/go/+/585520
Reviewed-by: Alan Donovan <adonovan@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-05-16 16:34:10 +00:00
Jonathan Amsterdam
db7bb2742c log/slog: handle times with undefined UnixNanos
slog tries to represent a time.Time without allocations, which involves
storing its UnixNanos value. But UnixNanos is undefined for some valid
times. Provide a fallback representation for those times by storing them
in the `any` field of `Value`.

Fixes #65902.

Change-Id: I736c739a92f77d7b1122ea0831524acdd2c4703f
Reviewed-on: https://go-review.googlesource.com/c/go/+/585519
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
2024-05-16 16:12:08 +00:00
Damien Neil
505000b2d3 net/http: simplify HTTP/1 request cancelation
HTTP requests have three separate user cancelation signals:

	Transport.CancelRequest
	Request.Cancel
	Request.Context()

In addition, a request can be canceled due to errors.

The Transport keeps a map of all in-flight requests,
with an associated func to run if CancelRequest is
called. Confusingly, this func is *not* run if
Request.Cancel is closed or the request context expires.

The map of in-flight requests is also used to communicate
between roundTrip and readLoop. In particular, if readLoop
reads a response immediately followed by an EOF, it may
send racing signals to roundTrip: The connection has
closed, but also there is a response available.
This race is resolved by readLoop communicating through
the request map that this request has successfully
completed.

This CL refactors all of this.

In-flight requests now have a context which is canceled
when any of the above cancelation events occurs.

The map of requests to cancel funcs remains, but is
used strictly for implementing Transport.CancelRequest.
It is not used to communicate information about the
state of a request.

Change-Id: Ie157edc0ce35f719866a0a2cb0e70514fd119ff8
Reviewed-on: https://go-review.googlesource.com/c/go/+/546676
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2024-05-16 15:57:17 +00:00
Damien Neil
33d725e575 archive/zip: treat truncated EOCDR comment as an error
When scanning for an end of central directory record,
treat an EOCDR signature with a record containing a truncated
comment as an error. Previously, we would skip over the invalid
record and look for another one. Other implementations do not
do this (they either consider this a hard error, or just ignore
the truncated comment). This parser misalignment allowed
presenting entirely different archive contents to Go programs
and other zip decoders.

Fixes #66869

Change-Id: I94e5cb028534bb5704588b8af27f1e22ea49c7c6
Reviewed-on: https://go-review.googlesource.com/c/go/+/585397
Reviewed-by: Joseph Tsai <joetsai@digital-static.net>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-05-16 15:56:19 +00:00
Jes Cok
2b3d98f2ba doc: make symbol links simpler for relnotes
Change-Id: Ie8ff3d1d1398618b9a229aa3cb1ef2deaa58c3d6
Reviewed-on: https://go-review.googlesource.com/c/go/+/586056
Reviewed-by: Jonathan Amsterdam <jba@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
2024-05-16 15:53:51 +00:00