]> Cypherpunks repositories - gostls13.git/log
gostls13.git
13 months agoruntime: update timers.len with Store instead of Add
Russ Cox [Fri, 16 Feb 2024 23:42:08 +0000 (18:42 -0500)]
runtime: update timers.len with Store instead of Add

Writes to timers.len are protected by the timers.lock.
There is no need to use an Add instead of a Store,
and the code is clearer (and perhaps slightly faster)
using the Store.

Change-Id: Icc6caef1b7405adec55c9b55b999b71de7d97484
Reviewed-on: https://go-review.googlesource.com/c/go/+/564976
Auto-Submit: Russ Cox <rsc@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

13 months agoruntime: rename timers fields for clarity
Russ Cox [Fri, 16 Feb 2024 23:38:51 +0000 (18:38 -0500)]
runtime: rename timers fields for clarity

These names were copied over from the p field names,
but now that they are part of the timers type they can use
shorter names that make the relationship clearer.

timer0When -> minWhen
timerModifiedEarliest -> minNextWhen

This code change is only the renaming.

Change-Id: I1c0adc0b3a1289d35639619d5c945585b2d81a9f
Reviewed-on: https://go-review.googlesource.com/c/go/+/564975
Auto-Submit: Russ Cox <rsc@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Austin Clements <austin@google.com>
13 months agoruntime: fix EvFrequency event value on Windows in the new tracer
Michael Anthony Knyszek [Wed, 28 Feb 2024 22:24:48 +0000 (22:24 +0000)]
runtime: fix EvFrequency event value on Windows in the new tracer

The value produced for the EvFrequency event on Windows is missing the
fact that the cputicks clock gets divided. This results in durations
that are consistently wrong by the same factor (about 256).

Fixes #65997.

Change-Id: I930cbfce3499d435c20699f41c11e3227d84f911
Reviewed-on: https://go-review.googlesource.com/c/go/+/567937
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
13 months agoruntime: clean up dead P trace state when disabling tracing too
Michael Anthony Knyszek [Mon, 26 Feb 2024 20:36:29 +0000 (20:36 +0000)]
runtime: clean up dead P trace state when disabling tracing too

Right now, we're careful to clean up dead P state when we advance to
future trace generations. If we don't, then if that P comes back to
life, we might end up using its old stale trace state.

Unfortunately, we never handled this in the case when tracing stops,
only when advancing to new generations. As a result, stopping a trace,
starting it again, and then bringing a P back to life in the following
generation meant that the dead P could be using stale state.

Fixes #65318.

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

13 months agointernal/trace/v2: clean up the ordering interface
Michael Anthony Knyszek [Tue, 20 Feb 2024 20:58:18 +0000 (20:58 +0000)]
internal/trace/v2: clean up the ordering interface

This change cleans up the ordering interface in several ways.

First, it resolves a TODO about using a proper queue of events for extra
events produced while performing ordering. This will be necessary for a
follow-up change to handle coroutine switch events.

Next, it simplifies the ordering.advance method's signature by not
returning a schedCtx. Instead, ordering.advance will take responsibility
for constructing the final Event instead of the caller, and places it on
its own internal queue (in addition to any other Events generated). The
caller is then responsible for taking events off of the queue with a new
method Next.

Finally, hand-in-hand with the signature change, the implementation of
ordering.advance no longer forces each switch case to return but instead
has them converge past the switch. This has two effects. One is that we
eliminate the deferred call to update the M state. Using a defer here is
technically incorrect, because we might end up changing the M state even
if we don't advance the event! We got lucky here that curCtx == newCtx
in all such cases, but there may have been a subtle bug lurking here.

Unfortunately because of the queue's semantics however, we can't
actually avoid pushing into the queue at every possible successful exit
out of the switch. Hopefully this can become less error-prone in the
future by splitting up the switch into a dispatch of different
functions, instead of everything living in one giant function. This
cleanup will happen in a follow-up change.

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

13 months agoruntime: make checking if tracing is enabled non-atomic
Michael Anthony Knyszek [Thu, 8 Feb 2024 17:16:49 +0000 (17:16 +0000)]
runtime: make checking if tracing is enabled non-atomic

Tracing is currently broken when using iter.Pull from the rangefunc
experiment partly because the "tracing is off" fast path in traceAcquire
was deemed too expensive to check (an atomic load) during the coroutine
switch.

This change adds trace.enabled, a non-atomic indicator of whether
tracing is enabled. It doubles trace.gen, which is the source of truth
on whether tracing is enabled. The semantics around trace.enabled are
subtle.

When tracing is enabled, we need to be careful to make sure that if gen
!= 0, goroutines enter the tracer on traceAcquire. This is enforced by
making sure trace.enabled is published atomically with trace.gen. The
STW takes care of synchronization with most Ms, but there's still sysmon
and goroutines exiting syscalls. We need to synchronize with those
explicitly anyway, which luckily takes care of trace.enabled as well.

When tracing is disabled, it's always OK for trace.enabled to be stale,
since traceAcquire will always double-check gen before proceeding.

For #61897.

Change-Id: I47c2a530fb5339c15e419312fbb1e22d782cd453
Reviewed-on: https://go-review.googlesource.com/c/go/+/565935
Auto-Submit: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
13 months agotime: gracefully handle ts.zombies underflow
Russ Cox [Thu, 7 Mar 2024 18:51:04 +0000 (13:51 -0500)]
time: gracefully handle ts.zombies underflow

The current implementation sets t.ts before adding t to ts;
that can cause inconsistencies with temporarily negative
ts.zombies values. Handle them gracefully, since we only
care about detecting very positive values.

Pending CL 564977 removes the race that sets t.ts early,
and then CL 569996 builds on top of that to make the count precise.
This CL just gets examples like the new test working sooner.

Change-Id: Ibe1aecc2554f83436f761f48e4050bd962982e4f
Reviewed-on: https://go-review.googlesource.com/c/go/+/569995
Reviewed-by: Austin Clements <austin@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

13 months agonet/http: close res.Body
guoguangwu [Fri, 8 Mar 2024 02:25:30 +0000 (02:25 +0000)]
net/http: close res.Body

Change-Id: I0f9faf2a946ebebf9ae30f065f20ec6028c65c22
GitHub-Last-Rev: d957ce10202896f2da4262340cd73fb4faa75836
GitHub-Pull-Request: golang/go#66181
Reviewed-on: https://go-review.googlesource.com/c/go/+/569976
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
13 months agoRevert "encoding/xml: reject XML declaration after start of document"
Russ Cox [Fri, 8 Mar 2024 18:25:14 +0000 (18:25 +0000)]
Revert "encoding/xml: reject XML declaration after start of document"

This reverts commit 8a0fbd75a54c27ff2ae624ac2775bf752cdbceb4.

Reason for revert: Breaking real-world tests inside Google,
which means it probably breaks real-world tests outside Google.

One instance I have seen is a <!-- --> comment (often a copyright notice) before the procinst.

Another test checks that a canonicalizer can handle a test input that simply has procinsts mid-XML.

XML is full of contradictions, XML implementations more so. If we are going to start being picky, that probably needs to be controlled by a GODEBUG (and a proposal).

For #65691 (will reopen manually).

Change-Id: Ib52d0944b1478e71744a2a35b271fdf7e1c972ca
Reviewed-on: https://go-review.googlesource.com/c/go/+/570175
Reviewed-by: Than McIntosh <thanm@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Russ Cox <rsc@golang.org>

13 months agonet/url: consider an empty base Path as equivalent to / in JoinPath
Damien Neil [Tue, 21 Feb 2023 19:24:56 +0000 (11:24 -0800)]
net/url: consider an empty base Path as equivalent to / in JoinPath

A Path that starts with / is absolute.
A Path that starts with any other character is relative.

The meaning of a Path of "" is not defined,
but RequestURI converts a "" Path to "/"
and an empty Path may represent a URL with just
a hostname and no trailing / such as "http://localhost".

Handle empty paths in the base URL of JoinPath consistently with
RequestURI, so that joining to an empty base produces an absolute
path rather than a relative one.

u, _ := url.Parse("http://localhost")
u = u.JoinPath("x")
fmt.Println(u.Path) // "/x", not "x"

Fixes #58605

Change-Id: Iacced9c173b0aa693800dd01caf774f3f9a66d56
Reviewed-on: https://go-review.googlesource.com/c/go/+/469935
Reviewed-by: Jonathan Amsterdam <jba@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

13 months agoruntime: use built-in clear to simplify code
apocelipes [Fri, 8 Mar 2024 10:12:41 +0000 (10:12 +0000)]
runtime: use built-in clear to simplify code

Change-Id: Icb6d9ca996b4119d8636d9f7f6a56e510d74d059
GitHub-Last-Rev: 08178e8ff798f4a51860573788c9347a0fb6bc40
GitHub-Pull-Request: golang/go#66188
Reviewed-on: https://go-review.googlesource.com/c/go/+/569979
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: qiulaidongfeng <2645477756@qq.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
13 months agounicode/utf8: update doc for RuneLen
Jes Cok [Thu, 7 Mar 2024 23:34:10 +0000 (07:34 +0800)]
unicode/utf8: update doc for RuneLen

As CL 569755 did, for consistency, this CL slightly improves
the documentation for RuneLen.

Change-Id: Ic9776648baf2809af36cd16a94d1313938bb0e52
Reviewed-on: https://go-review.googlesource.com/c/go/+/569816
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Commit-Queue: Ian Lance Taylor <iant@google.com>

13 months agocmd/compile: fix copying SSA-able variables optimization
Cuong Manh Le [Thu, 7 Mar 2024 07:49:30 +0000 (14:49 +0700)]
cmd/compile: fix copying SSA-able variables optimization

CL 541715 added an optimization to copy SSA-able variables.

When handling m[k] = append(m[k], ...) case, it uses ir.SameSafeExpr to
check that m[k] expressions are the same, then doing type assertion to
convert the map index to ir.IndexExpr node. However, this assertion is
not safe for m[k] expression in append(m[k], ...), since it may be
wrapped by ir.OCONVNOP node.

Fixing this by un-wrapping any ir.OCONVNOP before doing type assertion.

Fixes #66096

Change-Id: I9ff7165ab97bc7f88d0e9b7b31604da19a8ca206
Reviewed-on: https://go-review.googlesource.com/c/go/+/569716
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
13 months agonet/http: remove persistConn reference from wantConn
Alexander Yastrebov [Thu, 7 Mar 2024 10:28:46 +0000 (10:28 +0000)]
net/http: remove persistConn reference from wantConn

Transport getConn creates wantConn w, tries to obtain idle connection for it
based on the w.key and, when there is no idle connection, puts wantConn into
idleConnWait wantConnQueue.

Then getConn dials connection for w in a goroutine and blocks.
After dial succeeds getConn unblocks and returns connection to the caller.

At this point w is stored in the idleConnWait and will not be evicted
until another wantConn with the same w.key is requested or alive
connection returned into the idle pool which may not happen e.g. if
server closes the connection.

The problem is that even after tryDeliver succeeds w references
persistConn wrapper that allocates bufio.Reader and bufio.Writer and
prevents them from being garbage collected.

To fix the problem this change removes persistConn and error references
from wantConn and delivers them via channel to getConn.

This way wantConn could be kept in wantConnQueues arbitrary long.

Fixes #43966
Fixes #50798

Change-Id: I77942552f7db04c225fb40d770b3101a8cfe655d
GitHub-Last-Rev: 027a0833f98b23ddadb3ec7ee4f2e62653bc7705
GitHub-Pull-Request: golang/go#62227
Reviewed-on: https://go-review.googlesource.com/c/go/+/522095
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Damien Neil <dneil@google.com>

13 months agoarchive/tar: use built-in clear to simplify code
apocelipes [Thu, 7 Mar 2024 12:35:33 +0000 (12:35 +0000)]
archive/tar: use built-in clear to simplify code

Change-Id: I0e55dd68d92c39aba511b55368bf50d929d75f86
GitHub-Last-Rev: 17430140783db8bf3354304c8f28d6826186c6cb
GitHub-Pull-Request: golang/go#66158
Reviewed-on: https://go-review.googlesource.com/c/go/+/569696
Reviewed-by: Michael Knyszek <mknyszek@google.com>
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>
13 months agoos: use goarch.BigEndian
Tobias Klauser [Tue, 5 Mar 2024 09:54:22 +0000 (10:54 +0100)]
os: use goarch.BigEndian

Change-Id: I83c23ae0933f6abe4c07144f69c3d9c18aece6e8
Reviewed-on: https://go-review.googlesource.com/c/go/+/569175
Auto-Submit: Ian Lance Taylor <iant@google.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.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 Knyszek <mknyszek@google.com>
13 months agosyscall: use goarch.BigEndian
Tobias Klauser [Tue, 5 Mar 2024 09:56:01 +0000 (10:56 +0100)]
syscall: use goarch.BigEndian

Change-Id: I99e5f6fab900b0bf301f78460c618c01b231f62b
Reviewed-on: https://go-review.googlesource.com/c/go/+/568956
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
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>

13 months agocmd/go: always include action mode in trace name
Michael Pratt [Wed, 28 Feb 2024 20:25:40 +0000 (15:25 -0500)]
cmd/go: always include action mode in trace name

For actions with no package, the title "Executing action" is extremely
vague. Add the action mode so that there is some differentiation.

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

13 months agonet/http: set Cache-Control header only if presents on error
Cuong Manh Le [Thu, 7 Mar 2024 16:57:41 +0000 (23:57 +0700)]
net/http: set Cache-Control header only if presents on error

CL 544019 changes http.Error to remove misleading response headers.
However, it also adds new "Cache-Control" header unconditionally, which
may breaks existing clients out there, who do not expect to see the
this header in the response like test in golang.org/x/net/http2.

To keep thing backward compatible, http.Error should only add
Cache-Control header if it has been presented.

Updates #50905

Change-Id: I989e9f999a30ec170df4fb28905f50aed0267dad
Reviewed-on: https://go-review.googlesource.com/c/go/+/569815
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
13 months agoall: remove redundant string conversions when formatting []byte with %s
cui fliter [Thu, 7 Mar 2024 03:16:17 +0000 (11:16 +0800)]
all: remove redundant string conversions when formatting []byte with %s

Change-Id: I1285ee047fd465f48028186ae04d4de60cc9969e
Reviewed-on: https://go-review.googlesource.com/c/go/+/569715
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: shuang cui <imcusg@gmail.com>
Reviewed-by: Damien Neil <dneil@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

13 months agosort: fix typo in sort_test.go
Alex Driuk [Wed, 6 Mar 2024 14:56:14 +0000 (15:56 +0100)]
sort: fix typo in sort_test.go

Change-Id: Ibc1344b678d5f7c730b924c697717305c90c26e9
Reviewed-on: https://go-review.googlesource.com/c/go/+/569537
Commit-Queue: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
13 months agointernal/poll: change Fsync to fallback to syscall.Fsync on darwin
Mauri de Souza Meneguzzo [Thu, 7 Mar 2024 14:37:15 +0000 (14:37 +0000)]
internal/poll: change Fsync to fallback to syscall.Fsync on darwin

In certain scenarios, such as network mounts, calling Fsync results in
ENOTSUP in OSX. This issue was introduced in CL 130676 since
syscall.FSync was not properly flushing contents to disk, and it was
replaced with fcntl(fd, F_FULLSYNC). Most SMB servers, like Windows
Server and Samba don't support F_FULLSYNC.

To avoid such issues fallback to syscall.Fsync if fcntl returns ENOTSUP.

Fixes #64215

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

13 months agounicode/utf16: add func RuneLen
Jes Cok [Thu, 7 Mar 2024 13:36:47 +0000 (21:36 +0800)]
unicode/utf16: add func RuneLen

This CL adds func RuneLen, while here, also uses RuneLen to simplify
code in Encode.

Fixes #44940

Change-Id: Ifd3b537f69880dfd32a69a6733d8d3c2b5d4ecba
Reviewed-on: https://go-review.googlesource.com/c/go/+/569755
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Commit-Queue: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>

13 months agocmd/link: replace bytes.Compare call with bytes.Equal
guoguangwu [Thu, 7 Mar 2024 01:57:07 +0000 (01:57 +0000)]
cmd/link: replace bytes.Compare call with bytes.Equal

Change-Id: Icc254cad3c861fd2b33228aa4d19424ce57a1b55
GitHub-Last-Rev: f557a696e4a5c632c49c7cd20745eeb771708f81
GitHub-Pull-Request: golang/go#66153
Reviewed-on: https://go-review.googlesource.com/c/go/+/569695
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Mauri de Souza Meneguzzo <mauri870@gmail.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

13 months agocmd/trace: fix typo in comment
guoguangwu [Thu, 7 Mar 2024 01:38:48 +0000 (01:38 +0000)]
cmd/trace: fix typo in comment

Change-Id: I6ac2863e2af8c23588d35bf142f607e241f98405
GitHub-Last-Rev: 445cf7b29e859cdc52164d9781415cebea7b7795
GitHub-Pull-Request: golang/go#66152
Reviewed-on: https://go-review.googlesource.com/c/go/+/569675
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

13 months agocmd/go: fix typo in comment
guoguangwu [Thu, 7 Mar 2024 09:19:51 +0000 (09:19 +0000)]
cmd/go: fix typo in comment

Change-Id: I211442f2bbdab29820126a350cbdb0886a10d6e5
GitHub-Last-Rev: 0347054a55713f9dabee38f63900b56025a39c60
GitHub-Pull-Request: golang/go#66160
Reviewed-on: https://go-review.googlesource.com/c/go/+/569697
Commit-Queue: 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 Matloob <matloob@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: qiulaidongfeng <2645477756@qq.com>
13 months agocmd/go: test that each script test increments at least one counter
Michael Matloob [Thu, 29 Feb 2024 22:34:59 +0000 (17:34 -0500)]
cmd/go: test that each script test increments at least one counter

Add code that will set a scriptGoInvoked bit for the testing.TB when
it invokes the go command. If the go command was invoked, make sure
that at least one counter was incremented.

Also add the counters cmd/go/gomodcache-entry-relative,
cmd/go/gopath-entry-relative, and cmd/go/invalid-toolchain-in-file so
we can increment counters when a test errors out before the flag
subcommand counters are processed. This enforces the invariant that at
least one counter is incremented by every test that invokes the go
command.

Add the counter cmd/go/exec-go-toolchain for when a toolchain switch
happens.

Add cmd/go/subcommand:help for invoking help without arguments and
cmd/go/help-unknown-topic for when an unknown command is provided
to help.

Change-Id: Id90f2bbe4c7e89b846da00ec1ed9595ece2b269c
Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest
Reviewed-on: https://go-review.googlesource.com/c/go/+/568259
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

13 months agonet: consolidate the existing Windows version checks
Andy Pan [Wed, 21 Feb 2024 04:39:31 +0000 (12:39 +0800)]
net: consolidate the existing Windows version checks

Change-Id: I9c0ad69bd61923e9e272f157dc380a9120f08423
Reviewed-on: https://go-review.googlesource.com/c/go/+/565595
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>
13 months agonet: support TCP_KEEPIDLE, TCP_KEEPINTVL and TCP_KEEPCNT on newer Windows
Andy Pan [Tue, 20 Feb 2024 18:30:42 +0000 (02:30 +0800)]
net: support TCP_KEEPIDLE, TCP_KEEPINTVL and TCP_KEEPCNT on newer Windows

Follows up CL 542275

Fixes #65817

Change-Id: I0b77c23f15d595d58492dfa20839a08e8670448b
Reviewed-on: https://go-review.googlesource.com/c/go/+/565495
Reviewed-by: Quim Muntal <quimmuntal@gmail.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
13 months agocmd/compile,cmd/internal/obj: provide rotation pseudo-instructions for riscv64
Joel Sing [Thu, 8 Feb 2024 02:54:10 +0000 (13:54 +1100)]
cmd/compile,cmd/internal/obj: provide rotation pseudo-instructions for riscv64

Provide and use rotation pseudo-instructions for riscv64. The RISC-V bitmanip
extension adds support for hardware rotation instructions in the form of ROL,
ROLW, ROR, RORI, RORIW and RORW. These are easily implemented in the assembler
as pseudo-instructions for CPUs that do not support the bitmanip extension.

This approach provides a number of advantages, including reducing the rewrite
rules needed in the compiler, simplifying codegen tests and most importantly,
allowing these instructions to be used in assembly (for example, riscv64
optimised versions of SHA-256 and SHA-512). When bitmanip support is added,
these instruction sequences can simply be replaced with a single instruction
if permitted by the GORISCV64 profile.

Change-Id: Ia23402e1a82f211ac760690deb063386056ae1fa
Reviewed-on: https://go-review.googlesource.com/c/go/+/565015
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: M Zhuo <mengzhuo1203@gmail.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Run-TryBot: Joel Sing <joel@sing.id.au>

13 months agocmd: update telemetry to d5a85b2
Michael Matloob [Wed, 6 Mar 2024 17:39:23 +0000 (12:39 -0500)]
cmd: update telemetry to d5a85b2

commands run:
go get golang.org/x/telemetry@d5a85b2
go mod tidy
go mod vendor

Fixes #66099

Change-Id: Ia9215855f1472fa885792d5b23a986f29759af18
Reviewed-on: https://go-review.googlesource.com/c/go/+/569421
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Auto-Submit: Michael Matloob <matloob@golang.org>

13 months agocmd: update to golang.org/x/sys@v0.18.0
Michael Matloob [Wed, 6 Mar 2024 17:36:58 +0000 (12:36 -0500)]
cmd: update to golang.org/x/sys@v0.18.0

This is a requirement of x/telemetry so update it before updating
telemetry.

Commands run (in both std and cmd):
go get golang.org/x/sys@v0.18.0
go mod tidy
go mod vendor

For #66099

Change-Id: I636f0c0be89c05b9213c461b1a2eb2a4afb8a84b
Reviewed-on: https://go-review.googlesource.com/c/go/+/569420
Reviewed-by: Bryan Mills <bcmills@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Michael Matloob <matloob@golang.org>

13 months agonet/ip: proper ipv6 address parsing
Marin Petrunic [Wed, 1 Feb 2023 15:58:43 +0000 (15:58 +0000)]
net/ip: proper ipv6 address parsing

Fixes #57760

Change-Id: Ic3698a18e1c80833b07e0e06bc7328d9714794c6
GitHub-Last-Rev: d185467491e2bfc9fb68e48b1193581bebd7d77f
GitHub-Pull-Request: golang/go#57761
Reviewed-on: https://go-review.googlesource.com/c/go/+/461605
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: Damien Neil <dneil@google.com>

13 months agointernal/fuzz: remove useless code
guoguangwu [Fri, 23 Feb 2024 02:44:04 +0000 (02:44 +0000)]
internal/fuzz: remove useless code

Change-Id: I4534a116ef421379b2356bbe80760adae8cdd95f
GitHub-Last-Rev: a3fab3f1fa84111f3f3af7cf9f98e964f2423c73
GitHub-Pull-Request: golang/go#65892
Reviewed-on: https://go-review.googlesource.com/c/go/+/566315
Run-TryBot: Tim King <taking@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Tim King <taking@google.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
13 months agonet/http: add ResponseController http2 request without body read deadline test
Alexander Yastrebov [Wed, 22 Nov 2023 09:21:27 +0000 (09:21 +0000)]
net/http: add ResponseController http2 request without body read deadline test

Requires CL 464936

For #58237

Change-Id: I007b61f0f216d759f8e5327d77affbd9e8f8ff23
GitHub-Last-Rev: 30a10909b03bb0e8e4cd370a6f5ca386cd4ebc39
GitHub-Pull-Request: golang/go#58282
Reviewed-on: https://go-review.googlesource.com/c/go/+/465035
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
13 months agointernal/syscall/windows/registry: append .dll when loading kernel32
qmuntal [Wed, 6 Mar 2024 13:43:13 +0000 (14:43 +0100)]
internal/syscall/windows/registry: append .dll when loading kernel32

Win32 LoadLibrary supports loading a DLL omitting the .dll extension,
but it is better to be explicit and include the extension. This is
consistent with all other uses of LoadLibrary in the Go standard
library.

Change-Id: I7349d0a27db5f8ab59061434f37d10918e43b869
Reviewed-on: https://go-review.googlesource.com/c/go/+/569535
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
13 months agoencoding/binary: use built-in clear to simplify code
Jes Cok [Wed, 6 Mar 2024 17:07:48 +0000 (17:07 +0000)]
encoding/binary: use built-in clear to simplify code

Change-Id: I2f3c7f4a4848ad0fbbf79bd8919b1e2abee72f3f
GitHub-Last-Rev: 06d0047b28fe1c8c87f84aca049b8c76778732b9
GitHub-Pull-Request: golang/go#66136
Reviewed-on: https://go-review.googlesource.com/c/go/+/569280
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: Michael Knyszek <mknyszek@google.com>
13 months agonet/http: remove misleading response headers on error
Mitar [Tue, 5 Mar 2024 23:45:51 +0000 (23:45 +0000)]
net/http: remove misleading response headers on error

ServeContent API is to set some headers you want to see in the response
before calling ServeContent. But if there is an error, those headers
should be removed otherwise they might confused the client.

Removing those headers is useful in general in the case of an error,
so we remove them in http.Error.

Fixes #50905.

Change-Id: If8d2786c1512906ac93e6b388df6ab1c5ecd1ea9
GitHub-Last-Rev: 32b6f045a791cf7bc391f018452a05cc872041ba
GitHub-Pull-Request: golang/go#64312
Reviewed-on: https://go-review.googlesource.com/c/go/+/544019
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Damien Neil <dneil@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
13 months agocmd/dist: fix typo in comment
guoguangwu [Wed, 6 Mar 2024 01:33:39 +0000 (01:33 +0000)]
cmd/dist: fix typo in comment

Change-Id: If8bcde960348ebafec2ced0e22f315685de0bb82
GitHub-Last-Rev: 4477ade97fe831284f78183905ee5222b0d1a7cd
GitHub-Pull-Request: golang/go#66124
Reviewed-on: https://go-review.googlesource.com/c/go/+/569278
Reviewed-by: Michael Knyszek <mknyszek@google.com>
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>

13 months agodatabase/sql: remove useless error check
guoguangwu [Tue, 5 Mar 2024 02:38:41 +0000 (02:38 +0000)]
database/sql: remove useless error check

Change-Id: Id2d45a4b43b05deba4e2c31f7c03008c2f2c18a2
GitHub-Last-Rev: 587bed9a64da08d5b476d87333aed72649dad470
GitHub-Pull-Request: golang/go#66110
Reviewed-on: https://go-review.googlesource.com/c/go/+/569075
Reviewed-by: Michael Knyszek <mknyszek@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: Jorropo <jorropo.pgm@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
13 months agointernal/trace: remove unreachable code
guoguangwu [Fri, 1 Mar 2024 07:29:54 +0000 (07:29 +0000)]
internal/trace: remove unreachable code

Change-Id: If5c9801e8954ce7f517b90ea6c30ea3e9eec09ee
GitHub-Last-Rev: 135c8473ae9bc4126f3acdf72b1aeb90b0022297
GitHub-Pull-Request: golang/go#66051
Reviewed-on: https://go-review.googlesource.com/c/go/+/568395
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Jorropo <jorropo.pgm@gmail.com>
13 months agocmd/compile: mark DIEs of captured variables
Alessandro Arzilli [Fri, 9 Feb 2024 17:41:21 +0000 (18:41 +0100)]
cmd/compile: mark DIEs of captured variables

Adds a new custom attribute to the DIE of captured variables,
containing the offset for the variable inside the closure struct. This
can be used by debuggers to display the contents of a closure variable.

Based on a sample program (delve) this increases the executable size by 0.06%.

benchstat output:

                         │   old.txt    │                new.txt                │
                         │    sec/op    │     sec/op      vs base               │
Template                   153.0m ±  6%    152.5m ±  14%       ~ (p=0.684 n=10)
Unicode                    100.2m ± 15%    104.9m ±   7%       ~ (p=0.247 n=10)
GoTypes                    943.6m ±  8%    986.2m ±  10%       ~ (p=0.280 n=10)
Compiler                   97.79m ±  6%   101.63m ±  12%       ~ (p=0.393 n=10)
SSA                         6.872 ± 37%     9.413 ± 106%       ~ (p=0.190 n=10)
Flate                      128.0m ± 36%    125.0m ±  56%       ~ (p=0.481 n=10)
GoParser                   214.9m ± 26%    201.4m ±  68%       ~ (p=0.579 n=10)
Reflect                    452.6m ± 22%    412.2m ±  74%       ~ (p=0.739 n=10)
Tar                        166.2m ± 27%    155.9m ±  73%       ~ (p=0.393 n=10)
XML                        219.3m ± 24%    211.3m ±  76%       ~ (p=0.739 n=10)
LinkCompiler               523.2m ± 13%    513.5m ±  47%       ~ (p=0.631 n=10)
ExternalLinkCompiler        1.684 ±  2%     1.659 ±  25%       ~ (p=0.218 n=10)
LinkWithoutDebugCompiler   304.9m ± 12%    309.1m ±   7%       ~ (p=0.631 n=10)
StdCmd                      70.76 ± 14%     68.66 ±  53%       ~ (p=1.000 n=10)
geomean                    511.5m          515.4m         +0.77%

                         │   old.txt    │               new.txt                │
                         │ user-sec/op  │  user-sec/op   vs base               │
Template                   269.6m ± 13%   292.3m ±  17%       ~ (p=0.393 n=10)
Unicode                    110.2m ±  8%   101.7m ±  18%       ~ (p=0.247 n=10)
GoTypes                     2.181 ±  9%    2.356 ±  12%       ~ (p=0.280 n=10)
Compiler                   119.1m ± 11%   121.9m ±  15%       ~ (p=0.481 n=10)
SSA                         17.75 ± 52%    26.94 ± 123%       ~ (p=0.190 n=10)
Flate                      256.2m ± 43%   226.8m ±  73%       ~ (p=0.739 n=10)
GoParser                   427.0m ± 24%   422.3m ±  72%       ~ (p=0.529 n=10)
Reflect                    990.5m ± 23%   905.5m ±  75%       ~ (p=0.912 n=10)
Tar                        307.9m ± 27%   308.9m ±  64%       ~ (p=0.393 n=10)
XML                        432.8m ± 24%   427.6m ±  89%       ~ (p=0.796 n=10)
LinkCompiler               796.9m ± 14%   800.4m ±  56%       ~ (p=0.481 n=10)
ExternalLinkCompiler        1.666 ±  4%    1.671 ±  28%       ~ (p=0.971 n=10)
LinkWithoutDebugCompiler   316.7m ± 12%   325.6m ±   8%       ~ (p=0.579 n=10)
geomean                    579.5m         594.0m         +2.51%

          │   old.txt    │                new.txt                │
          │  text-bytes  │  text-bytes   vs base                 │
HelloSize   842.9Ki ± 0%   842.9Ki ± 0%       ~ (p=1.000 n=10) ¹
CmdGoSize   10.95Mi ± 0%   10.95Mi ± 0%       ~ (p=1.000 n=10) ¹
geomean     3.003Mi        3.003Mi       +0.00%
¹ all samples are equal

          │   old.txt    │                new.txt                │
          │  data-bytes  │  data-bytes   vs base                 │
HelloSize   15.08Ki ± 0%   15.08Ki ± 0%       ~ (p=1.000 n=10) ¹
CmdGoSize   314.7Ki ± 0%   314.7Ki ± 0%       ~ (p=1.000 n=10) ¹
geomean     68.88Ki        68.88Ki       +0.00%
¹ all samples are equal

          │   old.txt    │                new.txt                │
          │  bss-bytes   │  bss-bytes    vs base                 │
HelloSize   396.8Ki ± 0%   396.8Ki ± 0%       ~ (p=1.000 n=10) ¹
CmdGoSize   428.8Ki ± 0%   428.8Ki ± 0%       ~ (p=1.000 n=10) ¹
geomean     412.5Ki        412.5Ki       +0.00%
¹ all samples are equal

          │   old.txt    │               new.txt               │
          │  exe-bytes   │  exe-bytes    vs base               │
HelloSize   1.310Mi ± 0%   1.310Mi ± 0%  +0.02% (p=0.000 n=10)
CmdGoSize   16.37Mi ± 0%   16.38Mi ± 0%  +0.01% (p=0.000 n=10)
geomean     4.631Mi        4.632Mi       +0.02%

Change-Id: Ib416ee2d916ec61ad4a5c26bab09597595f57e04
Reviewed-on: https://go-review.googlesource.com/c/go/+/563816
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
13 months agocmd/dist,internal: add GOARM64 environment variable
Andrey Bokhanko [Tue, 30 Jan 2024 16:18:24 +0000 (19:18 +0300)]
cmd/dist,internal: add GOARM64 environment variable

Adds GOARM64 environment variable with accepted range of values "v8.{0-9}",
"v9.{0-5}" and optional ",lse" and ",crypto" suffixes.

Right now it doesn't affect anything, but can be used in the future to
selectively target specific versions of different ARM64 hardware.

For #60905

Change-Id: I6d530041b6931aa884e34f719f8ec41b1cb03ece
Reviewed-on: https://go-review.googlesource.com/c/go/+/559555
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Mauri de Souza Meneguzzo <mauri870@gmail.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Shu-Chun Weng <scw@google.com>
Reviewed-by: Fannie Zhang <Fannie.Zhang@arm.com>
13 months agoslices: document that Clone can return extra capacity
Ian Lance Taylor [Sun, 3 Mar 2024 02:48:26 +0000 (18:48 -0800)]
slices: document that Clone can return extra capacity

Change-Id: I8b9aa1f36ce554d8855ee70e15f0dd0a8cf1097a
Reviewed-on: https://go-review.googlesource.com/c/go/+/568342
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>

14 months agonet/textproto, mime/multipart: avoid unbounded read in MIME header
Damien Neil [Tue, 16 Jan 2024 23:37:52 +0000 (15:37 -0800)]
net/textproto, mime/multipart: avoid unbounded read in MIME header

mime/multipart.Reader.ReadForm allows specifying the maximum amount
of memory that will be consumed by the form. While this limit is
correctly applied to the parsed form data structure, it was not
being applied to individual header lines in a form.

For example, when presented with a form containing a header line
that never ends, ReadForm will continue to read the line until it
runs out of memory.

Limit the amount of data consumed when reading a header.

Fixes CVE-2023-45290
Fixes #65383

Change-Id: I7f9264d25752009e95f6b2c80e3d76aaf321d658
Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/2134435
Reviewed-by: Roland Shoemaker <bracewell@google.com>
Reviewed-by: Tatiana Bradley <tatianabradley@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/569341
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

14 months agonet/http, net/http/cookiejar: avoid subdomain matches on IPv6 zones
Damien Neil [Thu, 11 Jan 2024 19:31:57 +0000 (11:31 -0800)]
net/http, net/http/cookiejar: avoid subdomain matches on IPv6 zones

When deciding whether to forward cookies or sensitive headers
across a redirect, do not attempt to interpret an IPv6 address
as a domain name.

Avoids a case where a maliciously-crafted redirect to an
IPv6 address with a scoped addressing zone could be
misinterpreted as a within-domain redirect. For example,
we could interpret "::1%.www.example.com" as a subdomain
of "www.example.com".

Thanks to Juho Nurminen of Mattermost for reporting this issue.

Fixes CVE-2023-45289
Fixes #65065

Change-Id: I8f463f59f0e700c8a18733d2b264a8bcb3a19599
Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/2131938
Reviewed-by: Tatiana Bradley <tatianabradley@google.com>
Reviewed-by: Roland Shoemaker <bracewell@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/569340
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Auto-Submit: Michael Knyszek <mknyszek@google.com>

14 months agocrypto/x509: make sure pub key is non-nil before interface conversion
Roland Shoemaker [Thu, 18 Jan 2024 20:51:13 +0000 (12:51 -0800)]
crypto/x509: make sure pub key is non-nil before interface conversion

alreadyInChain assumes all keys fit a interface which contains the
Equal method (which they do), but this ignores that certificates may
have a nil key when PublicKeyAlgorithm is UnknownPublicKeyAlgorithm. In
this case alreadyInChain panics.

Check that the key is non-nil as part of considerCandidate (we are never
going to build a chain containing UnknownPublicKeyAlgorithm anyway).

Fixes #65390
Fixes CVE-2024-24783

Change-Id: Ibdccc0a487e3368b6812be35daad2512220243f3
Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/2137282
Reviewed-by: Damien Neil <dneil@google.com>
Run-TryBot: Roland Shoemaker <bracewell@google.com>
Reviewed-by: Tatiana Bradley <tatianabradley@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/569339
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Auto-Submit: Michael Knyszek <mknyszek@google.com>

14 months agoos: fix 63703.md release notes
qmuntal [Tue, 5 Mar 2024 14:55:27 +0000 (15:55 +0100)]
os: fix 63703.md release notes

63703.md contains a paragraph that shouldn't be there,
remove it.

While here, fix a test error message related to the #63703
implementation.

Updates #63703.

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

14 months agocmd/go/internal/modload: make it clear -mod can't be set in some cases
Michael Matloob [Tue, 23 May 2023 20:13:13 +0000 (16:13 -0400)]
cmd/go/internal/modload: make it clear -mod can't be set in some cases

We check that -mod can't be set to mod in workspace mode, but then we
set BuildMod to mod for go work sync below. Make it clear that that's
okay because we can't pass -mod=mod to go work sync (or the other go
mod commands that can run in workspace mode that set mod=mod: go mod
graph, go mod verify, and go mod why).

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

14 months agoos: don't normalize volumes to drive letters in os.Readlink
qmuntal [Wed, 28 Feb 2024 15:07:27 +0000 (16:07 +0100)]
os: don't normalize volumes to drive letters in os.Readlink

This CL updates os.Readlink so it no longer tries to normalize volumes
to drive letters, which was not always even possible.

This behavior is controlled by the `winreadlinkvolume` setting.
For Go 1.23, it defaults to `winreadlinkvolume=1`.
Previous versions default to `winreadlinkvolume=0`.

Fixes #63703.

Cq-Include-Trybots: luci.golang.try:gotip-windows-amd64-longtest,gotip-windows-arm64
Change-Id: Icd6fabbc8f0b78e23a82eef8db89940e89e9222d
Reviewed-on: https://go-review.googlesource.com/c/go/+/567735
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

14 months agocmd/go: respect -coverpkg for unselected no-test packages
Than McIntosh [Mon, 4 Mar 2024 15:52:56 +0000 (15:52 +0000)]
cmd/go: respect -coverpkg for unselected no-test packages

This patch fixes a bug in the code that reports coverage percentages
and/or profiles for packages without tests. Specifically, the code
added as part of the fix for issue 24570 (in CL 495447) didn't
properly consider the -coverpkg selection and would look for the build
action meta-data file for a package that wasn't actually selected for
coverage.

Fixes #65653.

Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest
Change-Id: I66ffac11783c00a8cbd855fd05b9a90e4e0ed402
Reviewed-on: https://go-review.googlesource.com/c/go/+/568835
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
14 months agoslices: simplify rotate code
Keith Randall [Mon, 15 Jan 2024 21:04:36 +0000 (13:04 -0800)]
slices: simplify rotate code

The rotate-by-reverse code in fact does only 2 writes per entry, so
it is fine and simpler.

Change-Id: I5feea9698b5575f1f0ae9069cc1d074643529262
Reviewed-on: https://go-review.googlesource.com/c/go/+/562321
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

14 months agonet/http: adjust wording on ServeMux godoc
Dave Russell [Tue, 17 Oct 2023 08:22:46 +0000 (08:22 +0000)]
net/http: adjust wording on ServeMux godoc

When reading through the docs, I found that the sentence flows better with
the `to` present.

Change-Id: I51c21fa33c7a13748c0814dd87c76b9a8d64e2ec
GitHub-Last-Rev: 0642bd7185343ba562c7057071d4689ead7a378e
GitHub-Pull-Request: golang/go#63587
Reviewed-on: https://go-review.googlesource.com/c/go/+/535935
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
14 months agoos: don't treat mount points as symbolic links
qmuntal [Wed, 28 Feb 2024 15:06:04 +0000 (16:06 +0100)]
os: don't treat mount points as symbolic links

This CL changes the behavior of os.Lstat to stop setting the
os.ModeSymlink type mode bit for mount points on Windows. As a result,
filepath.EvalSymlinks no longer evaluates mount points, which was the
cause of many inconsistencies and bugs.

Additionally, os.Lstat starts setting the os.ModeIrregular type mode bit
for all reparse tags on Windows, except for those that are explicitly
supported by the os package, which, since this CL, doesn't include mount
points. This helps to identify files that need special handling outside
of the os package.

This behavior is controlled by the `winsymlink` GODEBUG setting.
For Go 1.23, it defaults to `winsymlink=1`.
Previous versions default to `winsymlink=0`.

Fixes #39786
Fixes #40176
Fixes #61893
Updates #63703
Updates #40180
Updates #63429

Cq-Include-Trybots: luci.golang.try:gotip-windows-amd64-longtest,gotip-windows-arm64
Change-Id: I2e7372ab8862f5062667d30db6958d972bce5407
Reviewed-on: https://go-review.googlesource.com/c/go/+/565136
Reviewed-by: Bryan Mills <bcmills@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
14 months agonet/http/cgi: close res.Body
guoguangwu [Fri, 1 Mar 2024 03:09:39 +0000 (03:09 +0000)]
net/http/cgi: close res.Body

Change-Id: I4682442f4f9f3d112b78582c3b9fc2d24c2d58a7
GitHub-Last-Rev: 0823701905b8facdde7204aa6d90df6facd6dc51
GitHub-Pull-Request: golang/go#66049
Reviewed-on: https://go-review.googlesource.com/c/go/+/568316
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Damien Neil <dneil@google.com>

14 months agocmd/go: add file with list of all counters we collect
Michael Matloob [Thu, 15 Feb 2024 21:07:40 +0000 (16:07 -0500)]
cmd/go: add file with list of all counters we collect

Maintain a list of counters we collect and test that it hasn't
changed. If it has, fail a test and have the user update the list. The
update process will print a reminder to update the list of collected
counters.

Also run go mod vendor to pull in
golang.org/x/telemetry/counter/countertest.

For #58894

Change-Id: I661a9c3d67cb33f42a5519f4639af7aa05c3821d
Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest
Reviewed-on: https://go-review.googlesource.com/c/go/+/564555
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
14 months agocmd/compile/internal: replace direct calls to Sym.LinksymABI
apocelipes [Mon, 4 Mar 2024 16:44:43 +0000 (16:44 +0000)]
cmd/compile/internal: replace direct calls to Sym.LinksymABI

Using (*Sym).LinksymABI(abi) directly is not recommended.

Replace with (*ir.Name).LinksymABI(abi).

Change-Id: I95d5d35240d4e1856ba511d828f6edefcee81b4f
GitHub-Last-Rev: 6787b65716ab82d2f35cda4f3839bfd85baa41dd
GitHub-Pull-Request: golang/go#66094
Reviewed-on: https://go-review.googlesource.com/c/go/+/568855
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

14 months agoruntime: use .Pointers() instead of manual checking
Pouriya [Tue, 27 Feb 2024 21:51:31 +0000 (21:51 +0000)]
runtime: use .Pointers() instead of manual checking

Change-Id: Ib78c1513616089f4942297cd17212b1b11871fd5
GitHub-Last-Rev: f97fe5b5bffffe25dc31de7964588640cb70ec41
GitHub-Pull-Request: golang/go#65819
Reviewed-on: https://go-review.googlesource.com/c/go/+/565515
Reviewed-by: Jorropo <jorropo.pgm@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
14 months agocmd/compile/internal: use reflectdata.TypeLinksym
apocelipes [Mon, 4 Mar 2024 12:07:50 +0000 (12:07 +0000)]
cmd/compile/internal: use reflectdata.TypeLinksym

As the document of Sym.Linksym said, we replace
reflectdata.TypeSym(t).Linksym() with reflectdata.TypeLinksym(t).

Change-Id: I578eb159e552e60cd05d2aa1560f91797a6629ef
GitHub-Last-Rev: d096cba8f08506d7c5248dbf0179e5aef77e8f65
GitHub-Pull-Request: golang/go#66088
Reviewed-on: https://go-review.googlesource.com/c/go/+/568715
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

14 months agodoc/go1.23: document database/sql wrap errors
aimuz [Mon, 4 Mar 2024 13:48:41 +0000 (13:48 +0000)]
doc/go1.23: document database/sql wrap errors

For #64707.
For #65614.

Change-Id: Ib07ac67d7652bc7c9e1363f70637938c7bb4bc72
GitHub-Last-Rev: a4d8ecacbc677111e39977bacfb8fb9b59fb4ce6
GitHub-Pull-Request: golang/go#66089
Reviewed-on: https://go-review.googlesource.com/c/go/+/568755
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

14 months agointernal/xcoff: fix typo in comment
guoguangwu [Mon, 4 Mar 2024 02:30:21 +0000 (02:30 +0000)]
internal/xcoff: fix typo in comment

Change-Id: I72f73016d0d1ba4f686bafd4ee62a43e4e38aead
GitHub-Last-Rev: 8c824caa3c7c5ac38fd59a1070d0f11d7e5fecfd
GitHub-Pull-Request: golang/go#66082
Reviewed-on: https://go-review.googlesource.com/c/go/+/568655
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>

14 months agomath/rand, math/rand/v2: rename receiver variables
Oleksandr Redko [Sun, 3 Mar 2024 19:52:16 +0000 (21:52 +0200)]
math/rand, math/rand/v2: rename receiver variables

According to the https://go.dev/wiki/CodeReviewComments#receiver-names

Change-Id: Ib8bc57cf6a680e5c75d7346b74e77847945f6939
Reviewed-on: https://go-review.googlesource.com/c/go/+/568635
Reviewed-by: Michael Knyszek <mknyszek@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>
14 months agolib/time: use consistent directory in mkzip usage message
guoguangwu [Sun, 3 Mar 2024 03:49:32 +0000 (03:49 +0000)]
lib/time: use consistent directory in mkzip usage message

Change-Id: I6de70064222038d7d15557be9e85b66f944ac554
GitHub-Last-Rev: fe7d6e94903620a525584eceec00e4801de0faa2
GitHub-Pull-Request: golang/go#66021
Reviewed-on: https://go-review.googlesource.com/c/go/+/568077
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 Knyszek <mknyszek@google.com>
14 months agofmt: allow padding and minus flags at the same time
Mitar [Fri, 1 Mar 2024 23:43:04 +0000 (23:43 +0000)]
fmt: allow padding and minus flags at the same time

Existing implementation did not allow setting both padding and minus flags at the same time because standard formatting does not allow that. But custom Formatter interface implementations might have use of it. This change moves the check from the place flags are parsed to where they are used in standard formatting.

Fixes #61784

Change-Id: If5909d45dc929ddf911453e1056a4661abe76e52
GitHub-Last-Rev: d99ec55d3bbd9b2a8f14c8ade2fb25d6e0c174c3
GitHub-Pull-Request: golang/go#61836
Reviewed-on: https://go-review.googlesource.com/c/go/+/516975
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Martin Möhrmann <moehrmann@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Martin Möhrmann <martin@golang.org>
Auto-Submit: Ian Lance Taylor <iant@golang.org>

14 months agodoc: fix typo of gotypesalias
Benjamin Peterson [Fri, 1 Mar 2024 18:27:48 +0000 (18:27 +0000)]
doc: fix typo of gotypesalias

Change-Id: I943a7794dab919b7377661a4b9e2e1d9865f2922
GitHub-Last-Rev: 2a66fce2734bc453651c22968e2d55e157885398
GitHub-Pull-Request: golang/go#66063
Reviewed-on: https://go-review.googlesource.com/c/go/+/568495
Auto-Submit: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
14 months agocmd/internal/buildid: fix typo in comment
guoguangwu [Thu, 29 Feb 2024 06:58:29 +0000 (06:58 +0000)]
cmd/internal/buildid: fix typo in comment

Change-Id: I271f25aefaace61935d55a1b6b7c026d022d92a7
GitHub-Last-Rev: 304e3ee979f4fde58184e7035cd5d0d6b50bca74
GitHub-Pull-Request: golang/go#66023
Reviewed-on: https://go-review.googlesource.com/c/go/+/567918
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: Michael Knyszek <mknyszek@google.com>
14 months agoreflect: clean up unnecessary comments for rtype
Jes Cok [Thu, 29 Feb 2024 04:40:02 +0000 (04:40 +0000)]
reflect: clean up unnecessary comments for rtype

For consistency, this CL cleans up unnecessary comments,
and moves these Overflow methods to exported area.

For #60427

Change-Id: I14d4ffbc3552d31c211ea1e0b7a0f7090a4a8b89
GitHub-Last-Rev: acdc6ad51bd9ad60a34fdfa8f00a7652cbe34510
GitHub-Pull-Request: golang/go#66019
Reviewed-on: https://go-review.googlesource.com/c/go/+/567917
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: Michael Knyszek <mknyszek@google.com>
14 months agocmd/compile: remove bug workarounds in prove's loop inversion
Jorropo [Sat, 3 Feb 2024 08:06:30 +0000 (09:06 +0100)]
cmd/compile: remove bug workarounds in prove's loop inversion

I wrote theses checks because I got bad panics on some innocent functions,
turns out I was working around #63955 but I was not aware of that at the time.

The proper fix was included in CL 539977 this is now doing nothing.

Change-Id: I89329329933527b6f3cb817dc1e039a38f58da9a
Reviewed-on: https://go-review.googlesource.com/c/go/+/560975
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

14 months agocmd/go/internal/vcs: use git log to avoid unnecessary objects
huweiwen [Thu, 22 Feb 2024 03:10:48 +0000 (03:10 +0000)]
cmd/go/internal/vcs: use git log to avoid unnecessary objects

"git show" by default shows the diff from the previous commit. "-s"
suppress all output from the diff machinery. But it will still try to
fetch the relevant objects, which may be unavailable if the repository
is a partial clone.

Use "git log" instead, which only needs the commit object.

Fixes #65339

Change-Id: I766a680321cd22d5fdbd08d24cb777ef964bdb7c
GitHub-Last-Rev: 87a8ba435251f2a72aa18f2820ccb8ea5b379d69
GitHub-Pull-Request: golang/go#65341
Reviewed-on: https://go-review.googlesource.com/c/go/+/559075
Auto-Submit: Bryan Mills <bcmills@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
14 months agocrypto: use and test purego tag consistently
Filippo Valsorda [Tue, 6 Feb 2024 12:32:39 +0000 (13:32 +0100)]
crypto: use and test purego tag consistently

Fixes #58636
Updates #23172

Change-Id: I578a5597f467be45a7d6fb7582b24855b2e6512b
Reviewed-on: https://go-review.googlesource.com/c/go/+/561935
Reviewed-by: Roland Shoemaker <roland@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

14 months agosyscall: call internal/runtime/syscall.Syscall6 in RawSyscall6
Andy Pan [Thu, 1 Feb 2024 01:07:43 +0000 (09:07 +0800)]
syscall: call internal/runtime/syscall.Syscall6 in RawSyscall6

For #65355

Change-Id: I9168d9a767e3b2ece65ac6dcab6827ab6f6b11bb
Reviewed-on: https://go-review.googlesource.com/c/go/+/560136
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>

14 months agosrc/cmd: update golang.org/x/telemetry to 3d5706d and vendor it
Michael Matloob [Thu, 29 Feb 2024 17:49:05 +0000 (12:49 -0500)]
src/cmd: update golang.org/x/telemetry to 3d5706d and vendor it

Ran commands:
go get golang.org/x/telemetry@3d5706d
go mod vendor

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

14 months agodoc: close HTML tags
cui fliter [Thu, 29 Feb 2024 08:50:23 +0000 (16:50 +0800)]
doc: close HTML tags

Add unclosed HTML tags and remove redundant </a> tags.

Change-Id: I3fffbcfd640001c9cc4f6085150344daa0c4369b
Reviewed-on: https://go-review.googlesource.com/c/go/+/568155
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: shuang cui <imcusg@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

14 months agobytes: add a colon after Output to make the Example in the document display correctly
cui fliter [Thu, 29 Feb 2024 08:09:31 +0000 (16:09 +0800)]
bytes: add a colon after Output to make the Example in the document display correctly

The document address currently showing the problem is: https://pkg.go.dev/bytes#Buffer.ReadByte

Change-Id: Ib52747e38f72541f3ca2a595aa8eca5d91281c80
Reviewed-on: https://go-review.googlesource.com/c/go/+/568135
Auto-Submit: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Run-TryBot: shuang cui <imcusg@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
14 months agoos/exec: remove unnecessary fmt.Sprintf call
guoguangwu [Fri, 1 Mar 2024 10:11:56 +0000 (10:11 +0000)]
os/exec: remove unnecessary fmt.Sprintf call

Change-Id: Ic0ac97a15dadd756d727fd8abe23359b0347af19
GitHub-Last-Rev: a96a3f5fe7fbfb41f38acadab3c03c4a76c89b78
GitHub-Pull-Request: golang/go#66052
Reviewed-on: https://go-review.googlesource.com/c/go/+/568317
Reviewed-by: Bryan Mills <bcmills@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: Jorropo <jorropo.pgm@gmail.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>

14 months agoos: remove if nil!=nil in openFileNolog
qiulaidongfeng [Tue, 27 Feb 2024 13:54:42 +0000 (13:54 +0000)]
os: remove if nil!=nil in openFileNolog

Change-Id: I21cecc13570f3b61f3d6c4fede18dc63ddca1b69
GitHub-Last-Rev: 3c351e4aa84780d682fd7595ac2091defdcdfc62
GitHub-Pull-Request: golang/go#65958
Reviewed-on: https://go-review.googlesource.com/c/go/+/567355
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: Bryan Mills <bcmills@google.com>
Reviewed-by: Quim Muntal <quimmuntal@gmail.com>
14 months agocmd/compile: add 0-sized-value simplification to copyelim
David Chase [Thu, 29 Feb 2024 20:02:44 +0000 (15:02 -0500)]
cmd/compile: add 0-sized-value simplification to copyelim

The problem was caused by faulty handling of unSSA-able
operations on zero-sized data in expand calls, but there
is no point to operations on zero-sized data.  This CL adds
a simplify step to the first place in SSA where all values
are processed and replaces anything producing a 0-sized
struct/array with the corresponding Struct/Array Make0
operation (of the appropriate type).

I attempted not generating them in ssagen, but that was a
larger change, and also had bugs. This is simple and obvious.
The only question is whether it would be worthwhile to do it
earlier (in numberlines or phielem).

Fixes #65808.

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

14 months agocmd/link/internal/riscv64: generate local text symbols for R_RISCV_CALL
Joel Sing [Tue, 27 Feb 2024 12:57:43 +0000 (23:57 +1100)]
cmd/link/internal/riscv64: generate local text symbols for R_RISCV_CALL

Correctly generate local text symbols needed for R_RISCV_CALL when
external linking. R_RISCV_CALL was added in CL #520095 as a way of
marking AUIPC+JALR pairs, instead of overloading R_RISCV_PCREL_ITYPE.
However, genSymsLate was not updated to generate local text symbols
for the new relocation type, leading to HI20 symbol lookup failures.

This issue is detected by cmd/internal/obj/riscv.TestLargeCall,
however this is unfortunately skipped in short mode.

Fixes #65646

Change-Id: I8ee0f13791e0628f31657bf7dae2be8482b689b5
Reviewed-on: https://go-review.googlesource.com/c/go/+/567375
Reviewed-by: Mauri de Souza Meneguzzo <mauri870@gmail.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Run-TryBot: Joel Sing <joel@sing.id.au>
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

14 months agocmd/compile: add missing Unalias call when writing type alias
Cuong Manh Le [Thu, 22 Feb 2024 11:52:39 +0000 (18:52 +0700)]
cmd/compile: add missing Unalias call when writing type alias

Fixes #65778

Change-Id: I93af42967c7976d63b4f460b7ffbcb9a9c05ffe7
Reviewed-on: https://go-review.googlesource.com/c/go/+/565995
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Jorropo <jorropo.pgm@gmail.com>
14 months agocmd/compile: remove unnecessary fmt.Sprintf call
guoguangwu [Thu, 29 Feb 2024 07:48:17 +0000 (07:48 +0000)]
cmd/compile: remove unnecessary fmt.Sprintf call

Change-Id: I38ba7cb0179ec9226a68629c53ea2d81fa19c059
GitHub-Last-Rev: a3d4fe2ac2d2f40033ae0244a264074d45b3ad52
GitHub-Pull-Request: golang/go#66024
Reviewed-on: https://go-review.googlesource.com/c/go/+/568115
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Commit-Queue: Ian Lance Taylor <iant@google.com>
Reviewed-by: qiulaidongfeng <2645477756@qq.com>
Auto-Submit: Robert Griesemer <gri@google.com>

14 months agocmd/internal/testdir: support -godebug
Cuong Manh Le [Thu, 29 Feb 2024 13:17:09 +0000 (20:17 +0700)]
cmd/internal/testdir: support -godebug

Similar with what we are doing for -goexperiment.

For #65778

Change-Id: I7dda69512a3ffb491e3de31941ae1c3d34fececf
Reviewed-on: https://go-review.googlesource.com/c/go/+/568156
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
14 months agogo/types, types2: consistently use error_ type for sub-errors (cleanup)
Robert Griesemer [Wed, 28 Feb 2024 00:26:41 +0000 (16:26 -0800)]
go/types, types2: consistently use error_ type for sub-errors (cleanup)

Also, rename reportAltDecl/recordAltDecl to addAltDecl and
move function into errors.go.

Change-Id: Ie5210d1989f1e51fc5fec483dfa6dba8c4212b59
Reviewed-on: https://go-review.googlesource.com/c/go/+/567616
Reviewed-by: Robert Findley <rfindley@google.com>
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>

14 months agogo/types: generate typeset.go from types2 source
Robert Griesemer [Wed, 28 Feb 2024 19:49:37 +0000 (11:49 -0800)]
go/types: generate typeset.go from types2 source

To simplify the translation, use extra atPos calls where needed
in the respective types2 source.

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

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

14 months agogo/types, types2: better error position for invalid (infinite) types
Robert Griesemer [Thu, 29 Feb 2024 00:13:24 +0000 (16:13 -0800)]
go/types, types2: better error position for invalid (infinite) types

Provide an explicit start position to Checker.cycleError for better
control over the reported error.

For #65711.

Change-Id: Ie3016523442d75f348a033c1b944db493943f433
Reviewed-on: https://go-review.googlesource.com/c/go/+/567916
Auto-Submit: 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>
Reviewed-by: Robert Griesemer <gri@google.com>
14 months agogo/types, types2: disable incorrect optimization in type validity check
Robert Griesemer [Wed, 28 Feb 2024 23:47:28 +0000 (15:47 -0800)]
go/types, types2: disable incorrect optimization in type validity check

Fixes #65711.

Change-Id: I3196b7d053c9868b74c53623526f2da0ab878f53
Reviewed-on: https://go-review.googlesource.com/c/go/+/567976
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>
Reviewed-by: Robert Findley <rfindley@google.com>
14 months agocmd/compile: soften type matching when allocating stack slots
khr@golang.org [Tue, 20 Feb 2024 18:32:26 +0000 (10:32 -0800)]
cmd/compile: soften type matching when allocating stack slots

Currently we use pointer equality on types when deciding whether we can
reuse a stack slot. That's too strict, as we don't guarantee pointer
equality for the same type. In particular, it can vary based on whether
PtrTo has been called in the frontend or not.

Instead, use the type's LinkString, which is guaranteed to both be
unique for a type, and to not vary given two different type structures
describing the same type.

Update #65783

Change-Id: I64f55138475f04bfa30cfb819b786b7cc06aebe4
Reviewed-on: https://go-review.googlesource.com/c/go/+/565436
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
14 months agonet/http: remove Content-Length header in http.Error
Damien Neil [Sat, 6 Jan 2024 00:10:33 +0000 (16:10 -0800)]
net/http: remove Content-Length header in http.Error

Error replies to a request with an error message and HTTP code.
Delete any preexisting Content-Length header before writing the header;
if a Content-Length is present, it's probably for content that the
caller has given up on writing.

For #50905

Change-Id: Ia3d4ca008be46fa5d41afadf29ca5cacb1c47660
Reviewed-on: https://go-review.googlesource.com/c/go/+/554216
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
14 months agoruntime: move per-P timers state into its own struct
Russ Cox [Wed, 14 Feb 2024 16:57:05 +0000 (11:57 -0500)]
runtime: move per-P timers state into its own struct

Continuing conversion from C to Go, introduce type timers
encapsulating all timer heap state, with methods for operations.
This should at least be easier to think about, instead of having
these fields strewn through the P struct. It should also be easier
to test.

I am skeptical about the pair of atomic int64 deadlines:
I think there are missed wakeups lurking.
Having the code in an abstracted API should make it easier
to reason through and fix if needed.

[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: If5ea3e0b946ca14076f44c85cbb4feb9eddb4f95
Reviewed-on: https://go-review.googlesource.com/c/go/+/564132
Reviewed-by: Austin Clements <austin@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Russ Cox <rsc@golang.org>

14 months agointernal/trace: fix typo in comment
guoguangwu [Thu, 29 Feb 2024 01:50:51 +0000 (01:50 +0000)]
internal/trace: fix typo in comment

Change-Id: I7c82426ea9eb8ed100af08cd5aa302e9582055b3
GitHub-Last-Rev: 23535cd52f03ec611c8a11b4ac3993137cbc6655
GitHub-Pull-Request: golang/go#66013
Reviewed-on: https://go-review.googlesource.com/c/go/+/568075
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: Carlos Amedee <carlos@golang.org>
14 months agoencoding/json: make use of reflect.Type.{OverflowInt, OverflowUint}
Jes Cok [Wed, 28 Feb 2024 23:50:37 +0000 (23:50 +0000)]
encoding/json: make use of reflect.Type.{OverflowInt, OverflowUint}

CL 567296 added {OverflowComplex, OverflowFloat, OverflowInt, OverflowUint}
to reflect.Type, this CL uses these methods to simplify code.

For #60427

Change-Id: I229aef9e4095a2f025afd782081f6c9e6d7710f3
GitHub-Last-Rev: c824e5a1b5547e2cc23142fbcf0d6dd59f0e8506
GitHub-Pull-Request: golang/go#66000
Reviewed-on: https://go-review.googlesource.com/c/go/+/567775
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Joseph Tsai <joetsai@digital-static.net>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
14 months agocmd/go/internal/envcmd: show GODEBUG in 'go env' output
suntala [Thu, 22 Feb 2024 22:49:36 +0000 (22:49 +0000)]
cmd/go/internal/envcmd: show GODEBUG in 'go env' output

Fixes #65777

Change-Id: I62067d8212bfd9f9475ecad036a1218ffc5c2130
GitHub-Last-Rev: a395b0293a4796e4ac5db64c1521ade4ede0dfd8
GitHub-Pull-Request: golang/go#65888
Reviewed-on: https://go-review.googlesource.com/c/go/+/566097
Reviewed-by: Bryan Mills <bcmills@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
14 months agoruntime: don't re-initialize itab while looking for missing function
khr@golang.org [Wed, 28 Feb 2024 00:00:52 +0000 (16:00 -0800)]
runtime: don't re-initialize itab while looking for missing function

The itab we're initializing again, just to figure out which method
is missing, might be stored in read-only memory.
This can only happen in certain weird generics situations, so it is
pretty rare, but it causes a runtime crash when it does happen.

Fixes #65962

Change-Id: Ia86e216fe33950a794ad8e475e76317f799e9136
Reviewed-on: https://go-review.googlesource.com/c/go/+/567615
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
14 months agogo/types, types2: add tracing to Checker.validType
Robert Griesemer [Wed, 28 Feb 2024 23:01:25 +0000 (15:01 -0800)]
go/types, types2: add tracing to Checker.validType

Debugging support.

For #65711.

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

14 months agointernal/coverage/encodemeta: simplify appending zero values
apocelipes [Tue, 27 Feb 2024 21:13:15 +0000 (21:13 +0000)]
internal/coverage/encodemeta: simplify appending zero values

Appending zero values directly.

Change-Id: Icfb6e135b6aa16662dd67bdbf64ea0f63c612b2f
GitHub-Last-Rev: 57547b94087f216e943362e507b2339dd385f568
GitHub-Pull-Request: golang/go#65291
Reviewed-on: https://go-review.googlesource.com/c/go/+/558576
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
14 months agotext/tabwriter: add recovered panic message to rethrow
Nicolas Hillegeer [Wed, 28 Feb 2024 23:21:18 +0000 (15:21 -0800)]
text/tabwriter: add recovered panic message to rethrow

Without it, there is little information to debug why the original write
failed.

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

14 months agocmd/link: add option to enable full RELRO for ELF
Nick Revin [Mon, 26 Feb 2024 19:54:41 +0000 (19:54 +0000)]
cmd/link: add option to enable full RELRO for ELF

-bindnow linker option enables full RELRO on ELF targets.

This options defaults to false and preserves
current behavior - partial relro for buildmode=pie.

Also, the following changes were made to align
internal linker's behavior with external ELF linkers:
- GNU_RELRO segment is marked Read-only
- .dynamic is a relro section for partial and full RELRO
- .got is a relro section for partial and full RELRO
- .got.plt is a relro section for full RELRO only

Supersedes #45681 (golang.org/cl/312509)

Change-Id: I51c4ef07b14beceb7cd6fd989f323e45f89a63ca
GitHub-Last-Rev: bc6826441065395b80a2b66cde67466c4d9bce2e
GitHub-Pull-Request: golang/go#58869
Reviewed-on: https://go-review.googlesource.com/c/go/+/473495
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

14 months agoruntime/cgo: ignore unknown warning options
Ian Lance Taylor [Tue, 27 Feb 2024 21:22:40 +0000 (13:22 -0800)]
runtime/cgo: ignore unknown warning options

For #65290
Fixes #65971

Change-Id: If15853f287e06b85bb1cb038b3785516d5812f84
Reviewed-on: https://go-review.googlesource.com/c/go/+/567556
Auto-Submit: Ian Lance Taylor <iant@google.com>
Commit-Queue: 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: Mauri de Souza Meneguzzo <mauri870@gmail.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
14 months agocmd/internal/obj/ppc64: generate smaller machine code for OR/XOR of uint32 values
Paul E. Murphy [Mon, 27 Nov 2023 23:05:56 +0000 (17:05 -0600)]
cmd/internal/obj/ppc64: generate smaller machine code for OR/XOR of uint32 values

These binary operations can be done in two sequential instructions instead of loading a
constant into REGTMP and doing the binary op.

Change-Id: Ie0ab863f9e81afad140b92b265bca4d3f0fe90b1
Reviewed-on: https://go-review.googlesource.com/c/go/+/565215
Reviewed-by: Lynn Boger <laboger@linux.vnet.ibm.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Run-TryBot: Paul Murphy <murp@ibm.com>

14 months agoall: run go fmt
sivchari [Mon, 26 Feb 2024 05:59:15 +0000 (14:59 +0900)]
all: run go fmt

I ran go fmt to fix format on the entire repository.

Change-Id: I2f09166b6b8ba0ffb0ba27f6500efb0ea4cf21ff
Reviewed-on: https://go-review.googlesource.com/c/go/+/566835
Reviewed-by: 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>
Auto-Submit: Ian Lance Taylor <iant@golang.org>

14 months agotesting: fix typo in comment
guoguangwu [Wed, 28 Feb 2024 09:30:08 +0000 (09:30 +0000)]
testing: fix typo in comment

Change-Id: I5aa6093b0199df1ef5b0ad0fcfa651a4b990bfd5
GitHub-Last-Rev: b053d993eb497500ee63024ef12784f63fac6c0e
GitHub-Pull-Request: golang/go#65986
Reviewed-on: https://go-review.googlesource.com/c/go/+/567655
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
Auto-Submit: Carlos Amedee <carlos@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>