]> Cypherpunks repositories - gostls13.git/log
gostls13.git
13 months agoencoding/gob: make x509.Certificate marshalable again
Russ Cox [Tue, 12 Mar 2024 16:51:44 +0000 (12:51 -0400)]
encoding/gob: make x509.Certificate marshalable again

The OID type is not exported data like most of the other x509 structs.
Using it in x509.Certificate made Certificate not gob-compatible anymore,
which breaks real-world code. As a temporary fix, make gob ignore
that field, making it work as well as it did in Go 1.21.

For Go 1.23, we anticipate adding a proper fix and removing the gob
workaround. See #65633 and #66249 for more details.

For #66249.
Fixes #65633.

Change-Id: Idd1431d15063b3009e15d0565cd3120b9fa13f61
Reviewed-on: https://go-review.googlesource.com/c/go/+/571095
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Roland Shoemaker <roland@golang.org>
13 months agoRevert "net/url: consider an empty base Path as equivalent to / in JoinPath"
Russ Cox [Thu, 14 Mar 2024 13:50:37 +0000 (13:50 +0000)]
Revert "net/url: consider an empty base Path as equivalent to / in JoinPath"

This reverts commit a46285f8c2389b92952c1484daacfccf70a17047 (CL 469935).

Reason for revert: This breaks a variety of code inside Google
that seem representative of possible external real-world usage.

If we roll this forward again we should include a GODEBUG like
urljoinpathslash=0 to go back to the old behavior.

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

13 months agoRevert: "cmd/link: add option to enable full RELRO for ELF"
Than McIntosh [Wed, 13 Mar 2024 17:46:29 +0000 (17:46 +0000)]
Revert: "cmd/link: add option to enable full RELRO for ELF"

This reverts https://go.dev/cl/c/go/+/473495.

Reason for revert: breaks some Google-internal tests.

This revert will be temporary until we can gather more info on the
nature of the failures and hopefully develop an upstream test case,
etc.

Updates #45681.

Change-Id: Ib628ddc53bc5489e4f76c0f4ad809b75e899102c
Reviewed-on: https://go-review.googlesource.com/c/go/+/571415
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
13 months agocmd/go/internal/modcmd: fix typo in comment
guoguangwu [Thu, 14 Mar 2024 03:16:23 +0000 (03:16 +0000)]
cmd/go/internal/modcmd: fix typo in comment

Change-Id: I331c46083e9608227615183ba7e25f6299669341
GitHub-Last-Rev: 0cb78ae1c1e7554b0ef54c5e82fab0901a178494
GitHub-Pull-Request: golang/go#66305
Reviewed-on: https://go-review.googlesource.com/c/go/+/571536
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: Sam Thanawalla <samthanawalla@google.com>
13 months agoRevert "net/http: remove superfluous newline on redirects"
Russ Cox [Thu, 14 Mar 2024 13:55:01 +0000 (13:55 +0000)]
Revert "net/http: remove superfluous newline on redirects"

This reverts commit 2b58355ef624239dbe32185dc8dfc9d1074615c6.

Reason for revert: This breaks tons of tests for no real reason.

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

13 months agoruntime: fix lost sleep causing TestZeroTimer flakes
Russ Cox [Wed, 13 Mar 2024 23:48:58 +0000 (19:48 -0400)]
runtime: fix lost sleep causing TestZeroTimer flakes

Classic operating system kernel mistake: if you start using
per-CPU data without disabling interrupts on the CPU,
and then an interrupt reschedules the process onto a different
CPU, now you're using the wrong CPU's per-CPU data.
The same thing happens in Go if you use per-M or per-P
data structures while not holding a lock nor using acquirem.

In the original timer.modify before CL 564977, I had been
very careful about this during the "unlock t; lock ts" dance,
only calling releasem after ts was locked. That made sure
we used the right ts. The refactoring of that code into its
own helper function in CL 564977 missed that nuance.

The code

    ts := &getg().m.p.p.ptr().timers
    ts.lock()

was now executing without holding any locks nor acquirem.
If the goroutine changed its M or P between deciding which
ts to use and actually locking that ts, the code would proceed
to add the timer t to some other P's timers. If the P was idle
by then, the scheduler could have already checked it for timers
and not notice the newly added timer when deciding when the
next timer should trigger.

The solution is to do what the old code correctly did, namely
acquirem before deciding which ts to use, rather than assume
getg().m.p won't change before ts.lock can complete.
This CL does that.

Before CL 564977,

stress ./time.test -test.run='ZeroTimer/impl=(func|cache)' -test.timeout=3m -test.count=20

ran without failure for over an hour on my laptop.
Starting in CL 564977, it consistently failed within a few minutes.
After this CL, it now runs without failure for over an hour again.

Fixes #66006.

Change-Id: Ib9e7ccaa0f22a326ce3fdef2b9a92f7f0bdafcbf
Reviewed-on: https://go-review.googlesource.com/c/go/+/571196
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Russ Cox <rsc@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
13 months agoRevert "cmd/compile/internal/inline: refactor fixpoint algorithm"
Matthew Dempsky [Thu, 14 Mar 2024 02:03:29 +0000 (02:03 +0000)]
Revert "cmd/compile/internal/inline: refactor fixpoint algorithm"

This reverts commit 28e0052ee7f3623c28aa08afc41416b29cbddebc.

Reason for revert: #66261

Change-Id: I9dfc8946c41e504c97ecad752971d760ae7a7416
Reviewed-on: https://go-review.googlesource.com/c/go/+/571555
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Auto-Submit: Matthew Dempsky <mdempsky@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Than McIntosh <thanm@google.com>
13 months agocmd/go/internal/test: add 'tests' vet check to 'go test' suite
Alan Donovan [Wed, 20 Sep 2023 18:13:35 +0000 (14:13 -0400)]
cmd/go/internal/test: add 'tests' vet check to 'go test' suite

The tests analyser reports structural problems in test
declarations. Presumably most of these would be caught by
go test itself, which compiles and runs (some subset of) the
tests, but Benchmark and Fuzz functions are executed less
frequently and may benefit more from static checks.

Also, reflect the change in go test help message.

+ release note

Fixes golang/go#44251

Change-Id: If5b9dee6d18fa0bc4de7f5f5f549eddeae953fc2
Reviewed-on: https://go-review.googlesource.com/c/go/+/529816
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Alan Donovan <adonovan@google.com>

13 months agointernal/trace/v2: support old trace format
Dominik Honnef [Sat, 20 Jan 2024 16:37:50 +0000 (17:37 +0100)]
internal/trace/v2: support old trace format

Add support for traces from Go 1.11–1.19 by converting old traces to the
Go 1.22 format on the fly.

We import Gotraceui's trace parser, which is an optimized parser based
on Go 1.19's internal/trace package, and further modify it for the needs
of the conversion process.

With the optimized parser, loading old traces using the new API is twice
as fast and uses less total memory than 'go tool trace' did in older
versions.

The new parser does not, however, support traces from versions older
than 1.11.

This commit does not update cmd/trace to use the new API for old traces.

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

13 months agotime: garbage collect unstopped Tickers and Timers
Russ Cox [Thu, 15 Feb 2024 01:36:47 +0000 (20:36 -0500)]
time: garbage collect unstopped Tickers and Timers

From the beginning of Go, the time package has had a gotcha:
if you use a select on <-time.After(1*time.Minute), even if the select
finishes immediately because some other case is ready, the underlying
timer from time.After keeps running until the minute is over. This
pins the timer in the timer heap, which keeps it from being garbage
collected and in extreme cases also slows down timer operations.
The lack of garbage collection is the more important problem.

The docs for After warn against this scenario and suggest using
NewTimer with a call to Stop after the select instead, purely to work
around this garbage collection problem.

Oddly, the docs for NewTimer and NewTicker do not mention this
problem, but they have the same issue: they cannot be collected until
either they are Stopped or, in the case of Timer, the timer expires.
(Tickers repeat, so they never expire.) People have built up a shared
knowledge that timers and tickers need to defer t.Stop even though the
docs do not mention this (it is somewhat implied by the After docs).

This CL fixes the garbage collection problem, so that a timer that is
unreferenced can be GC'ed immediately, even if it is still running.
The approach is to only insert the timer into the heap when some
channel operation is blocked on it; the last channel operation to stop
using the timer takes it back out of the heap. When a timer's channel
is no longer referenced, there are no channel operations blocked on
it, so it's not in the heap, so it can be GC'ed immediately.

This CL adds an undocumented GODEBUG asynctimerchan=1
that will disable the change. The documentation happens in
the CL 568341.

Fixes #8898.
Fixes #61542.

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

13 months agotime: clean up benchmarks
Russ Cox [Mon, 11 Mar 2024 03:41:33 +0000 (23:41 -0400)]
time: clean up benchmarks

Comparing BenchmarkStop against very old commits like
CL 13094043, I was very confused about how timers had
gotten almost 10X slower since 2013.

It turns out that CL 68060043 introduced a factor of 1000
in the benchmark cost, by counting batches of 1000 as 1 op
instead of 1000 ops, and timers have actually gotten
dramatically faster since 2013, with the addition of per-P
timer heaps and other optimizations.

This CL rewrites the benchmarks to use testing.PB directly,
so that the factor of 1000 disappears, and "/op" really means "/op".
In the few tests that need to run in batches for one reason or
another, add "1000" to the name to make clear that batches
are being run.

Change-Id: I27ed74d1e420934982e4205aad4f218cdfc42509
Reviewed-on: https://go-review.googlesource.com/c/go/+/570495
Auto-Submit: Russ Cox <rsc@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

13 months agoos,internal/godebugs: add missing IncNonDefault calls
qmuntal [Mon, 11 Mar 2024 17:16:16 +0000 (18:16 +0100)]
os,internal/godebugs: add missing IncNonDefault calls

Fixes #66215

Change-Id: Id7de15feabe08f66c048dc114c09494813c9febc
Reviewed-on: https://go-review.googlesource.com/c/go/+/570695
Reviewed-by: Cherry Mui <cherryyz@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 agoencoding/binary: cache struct sizes to speed up Read and Write for slice of structs.
kwakubiney [Mon, 11 Mar 2024 22:53:08 +0000 (22:53 +0000)]
encoding/binary: cache struct sizes to speed up Read and Write for slice of structs.

A lot of allocations happen in dataSize due to reflection.

Cache the result of the function when encoding a
slice of structs similar to what is done for struct types
so that subsequent calls to dataSize can avoid allocations.

                        │   old.txt   │            new.txt            │
                        │   sec/op    │   sec/op     vs base          │
WriteSlice1000Structs-2   846.7µ ± 4%   856.4µ ± 3%  ~ (p=0.602 n=20)

                        │   old.txt    │            new.txt             │
                        │     B/s      │     B/s       vs base          │
WriteSlice1000Structs-2   84.48Mi ± 4%   83.52Mi ± 3%  ~ (p=0.602 n=20)

                        │   old.txt    │               new.txt               │
                        │     B/op     │     B/op      vs base               │
WriteSlice1000Structs-2   80.18Ki ± 0%   80.06Ki ± 0%  -0.15% (p=0.000 n=20)

                        │   old.txt   │              new.txt               │
                        │  allocs/op  │ allocs/op   vs base                │
WriteSlice1000Structs-2   16.000 ± 0%   1.000 ± 0%  -93.75% (p=0.000 n=2

                       │   old.txt   │              new.txt               │
                       │   sec/op    │   sec/op     vs base               │
ReadSlice1000Structs-2   847.4µ ± 4%   821.1µ ± 3%  -3.10% (p=0.012 n=20)

                       │   old.txt    │               new.txt               │
                       │     B/s      │     B/s       vs base               │
ReadSlice1000Structs-2   84.40Mi ± 4%   87.11Mi ± 3%  +3.20% (p=0.012 n=20)

                       │   old.txt    │               new.txt               │
                       │     B/op     │     B/op      vs base               │
ReadSlice1000Structs-2   80.12Ki ± 0%   80.00Ki ± 0%  -0.15% (p=0.000 n=20)

                       │   old.txt   │              new.txt               │
                       │  allocs/op  │ allocs/op   vs base                │
ReadSlice1000Structs-2   16.000 ± 0%   1.000 ± 0%  -93.75% (p=0.000 n=20)

Fixes #66253

Change-Id: I8227e61306db1fe103489ea4fee2429247c3debc
Reviewed-on: https://go-review.googlesource.com/c/go/+/570855
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>

13 months agocmd/go: change some counter names
Michael Matloob [Mon, 11 Mar 2024 20:35:45 +0000 (16:35 -0400)]
cmd/go: change some counter names

Primarily, this change removes the cmd/ prefix on the go command
counter names. The 'error' counter is changed to 'errors' reflecting
that it's a bucket that contains multiple errors. the switch-exec and
select-exec counters are moved into a 'toolchain' grouping.

For #58894

Change-Id: Id6e0e7a0b4a5e42a0aef04b1210d2bb5256eb6c2
Reviewed-on: https://go-review.googlesource.com/c/go/+/570736
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

13 months agoruntime: add minimal debug tracing of runtime timers
Russ Cox [Sat, 9 Mar 2024 18:41:24 +0000 (13:41 -0500)]
runtime: add minimal debug tracing of runtime timers

Toggled by a compile-time const, so there should be no
runtime footprint in ordinary builds.

Change-Id: I7751847524f4fda3853388d3e5a18188bd737c27
Reviewed-on: https://go-review.googlesource.com/c/go/+/570336
Auto-Submit: Russ Cox <rsc@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Austin Clements <austin@google.com>
13 months agoruntime: clean up timer state
Russ Cox [Sat, 9 Mar 2024 18:36:58 +0000 (13:36 -0500)]
runtime: clean up timer state

The timers had evolved to the point where the state was stored as follows:

if timer in heap:
    state has timerHeaped set
    if heap timer is stale:
        heap deadline in t.when
        real deadline in t.nextWhen
        state has timerNextWhen set
    else:
        real deadline in t.when
        t.nextWhen unset
else:
    real deadline in t.when
    t.nextWhen unset

That made it hard to find the real deadline and just hard to think about everything.
The new state is:

real deadline in t.when (always)
if timer in heap:
    state has timerHeaped set
    heap deadline in t.whenHeap
    if heap timer is stale:
        state has timerModified set

Separately, the 'state' word itself was being used as a lock
and state bits because the code started with CAS loops,
which we abstracted into the lock/unlock methods step by step.
At this point, we can switch to a real lock, making sure to
publish the one boolean needed by timers fast paths
at each unlock.

All this simplifies various logic considerably.

Change-Id: I35766204f7a26d999206bd56cc0db60ad1b17cbe
Reviewed-on: https://go-review.googlesource.com/c/go/+/570335
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>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
13 months agoruntime: fix another lock ordering problem
Russ Cox [Wed, 13 Mar 2024 02:00:22 +0000 (22:00 -0400)]
runtime: fix another lock ordering problem

https://logs.chromium.org/logs/golang/buildbucket/cr-buildbucket/8753622336585847105/+/u/step/11/log/2
shows a staticlockranking crash with pollcache (defaulted to LEAF)
being held during a write barrier, which got unlucky and acquired
wbufSpans, triggering a lock ordering throw.

My change in https://go-review.googlesource.com/c/go/+/570335/13/src/runtime/netpoll.go
around line 700 caused batching of many write barriers on the first
call rather than having just a few write barriers on each call,
making the crash much more likely, but the ordering problem
appears to have always existed. We just never allocated enough
pollDescs to trigger it.

Change-Id: Icb5e8340a5027dd4f7535a5ef02b2868476539e5
Reviewed-on: https://go-review.googlesource.com/c/go/+/571195
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Russ Cox <rsc@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
13 months agocmd/asm,cmd/compile: generate less instructions for most 32 bit constant adds on...
Paul E. Murphy [Fri, 16 Feb 2024 19:29:16 +0000 (13:29 -0600)]
cmd/asm,cmd/compile: generate less instructions for most 32 bit constant adds on ppc64x

For GOPPC64 < 10 targets, most large 32 bit constants (those
exceeding int16 capacity) can be added using two instructions
instead of 3.

This cannot be done for values greater than 0x7FFF7FFF, so this
must be done during asm preprocessing as the optab matching
rules cannot differentiate this special case.

Likewise, constants 0x8000 <= x < 0x10000 are not converted. The
assembler currently generates 2 instructions sequences for these
constants.

Change-Id: I1ccc839c6c28fc32f15d286b2e52e2d22a2a06d4
Reviewed-on: https://go-review.googlesource.com/c/go/+/568116
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Run-TryBot: Paul Murphy <murp@ibm.com>
Reviewed-by: Lynn Boger <laboger@linux.vnet.ibm.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

13 months agocmd/compile: fix sign/zero-extension removal
Keith Randall [Sun, 3 Mar 2024 03:22:07 +0000 (19:22 -0800)]
cmd/compile: fix sign/zero-extension removal

When an opcode generates a known high bit state (typically, a sub-word
operation that zeros the high bits), we can remove any subsequent
extension operation that would be a no-op.

x = (OP ...)
y = (ZeroExt32to64 x)

If OP zeros the high 32 bits, then we can replace y with x, as the
zero extension doesn't do anything.

However, x in this situation normally has a sub-word-sized type.  The
semantics of values in registers is typically that the high bits
beyond the value's type size are junk. So although the opcode
generating x *currently* zeros the high bits, after x is rewritten to
another opcode it may not - rewrites of sub-word-sized values can
trash the high bits.

To fix, move the extension-removing rules to late lower. That ensures
that their arguments won't be rewritten to change their high bits.

I am also worried about spilling and restoring. Spilling and restoring
doesn't preserve the high bits, but instead sets them to a known value
(often 0, but in some cases it could be sign-extended).  I am unable
to come up with a case that would cause a problem here, so leaving for
another time.

Fixes #66066

Change-Id: I3b5c091b3b3278ccbb7f11beda8b56f4b6d3fde7
Reviewed-on: https://go-review.googlesource.com/c/go/+/568616
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

13 months agointernal/syscall/windows: implement SupportUnixSocket by enumerating protocols
qmuntal [Fri, 8 Mar 2024 10:19:14 +0000 (11:19 +0100)]
internal/syscall/windows: implement SupportUnixSocket by enumerating protocols

windows.SupportUnixSocket is currently implemented using a Windows
version check. This approach is not reliable, see #27943 and #28061.
Also, it uses the undocumented RtlGetNtVersionNumbers API, which
we should try to avoid.

This PR implements SupportUnixSocket by enumerating the available
protocols and checking for AF_UNIX support.

Cq-Include-Trybots: luci.golang.try:gotip-windows-arm64
Change-Id: I76cd635067309f09571ad0eac4a5699450a2709a
Reviewed-on: https://go-review.googlesource.com/c/go/+/570075
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

13 months agocmd/covdata: fix typo in comment
guoguangwu [Tue, 12 Mar 2024 08:22:19 +0000 (08:22 +0000)]
cmd/covdata: fix typo in comment

Change-Id: I14d2e58e36feb17a52fdc376a4562628e0da6698
GitHub-Last-Rev: 7e5d056dc5e0b9c009f5ed716ad4e9110551fe25
GitHub-Pull-Request: golang/go#66262
Reviewed-on: https://go-review.googlesource.com/c/go/+/570896
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Than McIntosh <thanm@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

13 months agocmd/go: check case-insensitive path collisions for go mod vendor.
Sam Thanawalla [Mon, 11 Mar 2024 19:35:27 +0000 (19:35 +0000)]
cmd/go: check case-insensitive path collisions for go mod vendor.

Fixes: #38571
Change-Id: Iec1cd1532ff17f7d943149f9b6a79e7fd419d179
Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest,gotip-windows-amd64-longtest
Reviewed-on: https://go-review.googlesource.com/c/go/+/570775
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
13 months agostrconv: use generics to reduce redundant helper functions
apocelipes [Tue, 12 Mar 2024 10:18:00 +0000 (10:18 +0000)]
strconv: use generics to reduce redundant helper functions

Benchstat shows there are no noticeable performance changes here.

Change-Id: If2250334fe6664986f044cbaabfa1bfc84f871f7
GitHub-Last-Rev: d41a498d54483759b9c85c3d8efa848c0cc1bbd9
GitHub-Pull-Request: golang/go#66266
Reviewed-on: https://go-review.googlesource.com/c/go/+/570935
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>
Commit-Queue: Ian Lance Taylor <iant@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
13 months agocmd/go/internal/modfetch: pass "-c" arguments to git before subcommands
Bryan C. Mills [Wed, 6 Mar 2024 22:50:45 +0000 (17:50 -0500)]
cmd/go/internal/modfetch: pass "-c" arguments to git before subcommands

I accidentally transposed the arguments in CL 556358, causing the
shallow 'git fetch' attempt to always fail. That didn't break any
tests because we fall back to a full fetch, which works for nearly all
real Git servers, and we didn't have a test that checked for shallow
fetches.

Tested manually using:
GOPROXY=direct go mod download -x -json gerrit.wikimedia.org/r/mediawiki@v0.0.0-20240202145822-67da0cbcfdf7

(I'm still thinking about how to add a proper regression test.)

Fixes #66147.

Change-Id: I0bb17283bae856f369fd24f29375e507d0999933
Cq-Include-Trybots: luci.golang.try:gotip-darwin-amd64-longtest,gotip-linux-amd64-longtest,gotip-windows-amd64-longtest
Reviewed-on: https://go-review.googlesource.com/c/go/+/569422
Auto-Submit: Bryan Mills <bcmills@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

13 months agoall: gofmt
sivchari [Mon, 11 Mar 2024 14:28:30 +0000 (23:28 +0900)]
all: gofmt

These files are not formatted by gofmt. Thus, run gofmt to format them.

Change-Id: Iea9650e64b1f47cf82739f3a8a34f47740a96455
Reviewed-on: https://go-review.googlesource.com/c/go/+/570398
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>

13 months agoall.bash: allow spaces in $GOTOOLDIR to print build info
Jes Cok [Sun, 10 Mar 2024 12:36:44 +0000 (20:36 +0800)]
all.bash: allow spaces in $GOTOOLDIR to print build info

For consistency with all.bat: "%GOTOOLDIR%/dist" banner

Fixes #66061

Change-Id: I3387003a77a5fe82fe132e7aba472b06dd9068f5
Reviewed-on: https://go-review.googlesource.com/c/go/+/570395
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Cherry Mui <cherryyz@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 agoio: close PipeReader in test
guoguangwu [Mon, 11 Mar 2024 11:09:50 +0000 (11:09 +0000)]
io: close PipeReader in test

Change-Id: I33858efc00dff02432f28f1e5a94aeea261a5bad
GitHub-Last-Rev: 98861f8d6e187a03330a0947ff651826024fcad2
GitHub-Pull-Request: golang/go#66230
Reviewed-on: https://go-review.googlesource.com/c/go/+/570357
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>
13 months agostrconv: use slices.BinarySearch to simplify makeisprint.go
apocelipes [Mon, 11 Mar 2024 17:41:43 +0000 (17:41 +0000)]
strconv: use slices.BinarySearch to simplify makeisprint.go

Change-Id: I9886a99f730b7616f6f8a5e6154e1beb7d3c79e6
GitHub-Last-Rev: 3f9dc7707377f79968e2dfcd206b83db21e60e60
GitHub-Pull-Request: golang/go#66242
Reviewed-on: https://go-review.googlesource.com/c/go/+/570535
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
13 months agocmd/go: provide a better error message when there's no go directive
Michael Matloob [Mon, 11 Mar 2024 17:53:40 +0000 (13:53 -0400)]
cmd/go: provide a better error message when there's no go directive

On Go 1.21+ it's an error for a workspace to contain a module with a
version newer than the workspace's stated go version. If the workspace
doesn't explicitly have a go version it's explicitly 1.18. So if a
workspace without a go directive contains a module whose go directive
is newer on it's always an error for 1.21+. In the error, before this
CL the error would read "module <path> listed in go.work requires go
>= <version>, but go.work lists go 1.18". After this change the second
clause would read "but go.work implicitly requires go 1.18.

Fixes #66207

Change-Id: I44680880162a82e5cee9cfc8655d6774add6f762
Reviewed-on: https://go-review.googlesource.com/c/go/+/570735
Reviewed-by: Alan Donovan <adonovan@google.com>
Reviewed-by: Sam Thanawalla <samthanawalla@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

13 months agonet/http/httptest: add NewRequestWithContext
Kevin Burke [Thu, 7 Dec 2023 21:13:25 +0000 (13:13 -0800)]
net/http/httptest: add NewRequestWithContext

This matches the net/http API.

Updates #59473.

Change-Id: I99917cef3ed42a0b4a2b39230b492be00da8bbfd
Reviewed-on: https://go-review.googlesource.com/c/go/+/548355
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
13 months agonet/http: support socks5h proxy schema
胡玮文 [Fri, 8 Mar 2024 05:42:49 +0000 (13:42 +0800)]
net/http: support socks5h proxy schema

Extend the net/http Transport to recognize the 'socks5h' schema as an
alias for 'socks5'. Traditionally, the 'socks5h' schema indicates that
the hostname should be resolved by the proxy server, which is behavior
already implemented in Go for 'socks5'.

Fixes #24135

Change-Id: I0a6a92bbd282a3200dc4dc7b47a9b0628f931783
Reviewed-on: https://go-review.googlesource.com/c/go/+/569977
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Damien Neil <dneil@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
13 months agotime: fix typo in BenchmarkReset
qiulaidongfeng [Sat, 9 Mar 2024 04:09:45 +0000 (04:09 +0000)]
time: fix typo in BenchmarkReset

Change-Id: I1dbd1c5aa26f458cdac7a3f0ca974254a069311f
GitHub-Last-Rev: da481ba7a9082a5fae5cc7c72821167d9879f54f
GitHub-Pull-Request: golang/go#66219
Reviewed-on: https://go-review.googlesource.com/c/go/+/569897
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
13 months agocompress/gzip: close writer in test
guoguangwu [Sat, 9 Mar 2024 03:10:36 +0000 (03:10 +0000)]
compress/gzip: close writer in test

Change-Id: I12bc9287106f1492cbc9e74b4163cce97c957d31
GitHub-Last-Rev: cda1b48fe3ee9083a2262f1d6eeb039c66c12b40
GitHub-Pull-Request: golang/go#66185
Reviewed-on: https://go-review.googlesource.com/c/go/+/569896
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Joseph Tsai <joetsai@digital-static.net>
Auto-Submit: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

13 months agoos: close pipe in test
guoguangwu [Mon, 11 Mar 2024 05:03:53 +0000 (05:03 +0000)]
os: close pipe in test

Change-Id: Ic8b06c6fd9fc6a30b26f4e4614aa40b5cad3a5e7
GitHub-Last-Rev: 8397a8b30cf11c00e53b35e528f82a8534a00e01
GitHub-Pull-Request: golang/go#66240
Reviewed-on: https://go-review.googlesource.com/c/go/+/570515
Auto-Submit: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
13 months agoimage: use built-in clear to simplify code
apocelipes [Mon, 11 Mar 2024 12:17:12 +0000 (12:17 +0000)]
image: use built-in clear to simplify code

Change-Id: Id34936a115baaf61e4268582c6d9a2027494c385
GitHub-Last-Rev: 5fe455b7d24e3e3b871c8999c5bb534f3e1e3ab5
GitHub-Pull-Request: golang/go#66244
Reviewed-on: https://go-review.googlesource.com/c/go/+/570555
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>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Keith Randall <khr@golang.org>

13 months agocmd/preprofile: fix typo in comment
guoguangwu [Sun, 10 Mar 2024 13:05:30 +0000 (13:05 +0000)]
cmd/preprofile: fix typo in comment

Change-Id: Ib44e9e6345fa8df7f46bc9cbdc19ad8ba73c8b83
GitHub-Last-Rev: 5a37ad798807c1bbc1600086ff162dc7019d1bca
GitHub-Pull-Request: golang/go#66233
Reviewed-on: https://go-review.googlesource.com/c/go/+/570415
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>

13 months agocmd/trace/v2: fix typo in comment
guoguangwu [Sun, 10 Mar 2024 07:36:36 +0000 (07:36 +0000)]
cmd/trace/v2: fix typo in comment

Change-Id: Icbf295e668335945084616a88c3ea2cef1bb2527
GitHub-Last-Rev: 0341d0fea71a194d7a85741f6951c8c7c21aee33
GitHub-Pull-Request: golang/go#66229
Reviewed-on: https://go-review.googlesource.com/c/go/+/570356
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: Cherry Mui <cherryyz@google.com>
13 months agocmd/compile: use raw strings to avoid double escapes
guoguangwu [Mon, 11 Mar 2024 01:22:21 +0000 (01:22 +0000)]
cmd/compile: use raw strings to avoid double escapes

Change-Id: I39917b90b67f630f8212853c0a201635960275cb
GitHub-Last-Rev: fe886534b493fc6241b4451256c889b2fdee997f
GitHub-Pull-Request: golang/go#66180
Reviewed-on: https://go-review.googlesource.com/c/go/+/569975
Auto-Submit: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
13 months agonet/http: update bundle
Russ Cox [Sat, 9 Mar 2024 04:08:13 +0000 (23:08 -0500)]
net/http: update bundle

go install golang.org/x/tools/cmd/bundle@latest
go generate net/http

This fixes the longtest builders, which broke at CL 570156.

Change-Id: I85e6a1c20bd0080228400a561efd750342ae2d67
Reviewed-on: https://go-review.googlesource.com/c/go/+/570276
Reviewed-by: Damien Neil <dneil@google.com>
Auto-Submit: Russ Cox <rsc@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

13 months agocmd/link,debug/elf: mark Go binaries with no branch target CFI on openbsd
Joel Sing [Wed, 21 Feb 2024 12:29:12 +0000 (23:29 +1100)]
cmd/link,debug/elf: mark Go binaries with no branch target CFI on openbsd

OpenBSD enables Indirect Branch Tracking (IBT) on amd64 and Branch Target
Identification (BTI) on arm64, where hardware permits. Since Go generated
binaries do not currently support IBT or BTI, temporarily mark them with
PT_OPENBSD_NOBTCFI which prevents branch target CFI from being enforced
on execution. This should be removed as soon asn IBT and BTI support are
available.

Fixes #66040
Updates #66054

Change-Id: I91ac05736e6942c54502bef4b8815eb8740d2d5e
Reviewed-on: https://go-review.googlesource.com/c/go/+/568435
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Josh Rickmar <jrick@zettaport.com>
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Joel Sing <joel@sing.id.au>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
13 months agocmd/go: respect GODEBUG in test cache
Russ Cox [Sat, 9 Mar 2024 00:29:27 +0000 (19:29 -0500)]
cmd/go: respect GODEBUG in test cache

GODEBUG affects test execution but was not being tracked.

Fixes #66213.
Fixes #65436.

Change-Id: I3ac3c397f0c6fa46cd9be0d22d03020d0632f64f
Reviewed-on: https://go-review.googlesource.com/c/go/+/570259
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Russ Cox <rsc@golang.org>

13 months agotime: disable TestLongAdjustTimers on android/ios
Russ Cox [Sat, 9 Mar 2024 00:05:02 +0000 (19:05 -0500)]
time: disable TestLongAdjustTimers on android/ios

The simulators are too slow.

Change-Id: I0aaf2304ad0881c74886ff3185c09614de2aae63
Reviewed-on: https://go-review.googlesource.com/c/go/+/570236
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Russ Cox <rsc@golang.org>

13 months agointernal/godebugs: test for use of IncNonDefault
Russ Cox [Sat, 9 Mar 2024 02:01:17 +0000 (21:01 -0500)]
internal/godebugs: test for use of IncNonDefault

A few recent godebugs are missing IncNonDefault uses.
Test for that, so that people remember to do it.
Filed bugs for the missing ones.

For #66215.
For #66216.
For #66217.

Change-Id: Ia3fd10fd108e1b003bb30a8bc2f83995c768fab6
Reviewed-on: https://go-review.googlesource.com/c/go/+/570275
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
13 months agocmd/go: check checkCounters counter read only on supported platforms
Hana (Hyang-Ah) Kim [Fri, 8 Mar 2024 21:23:36 +0000 (16:23 -0500)]
cmd/go: check checkCounters counter read only on supported platforms

Telemetry counters writing is disabled on certain platforms.
See x/telemetry/internal/telemetry.DisabledOnPlatform.

For #66205

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

13 months agotime: move runtimeTimer out of Timer struct
Russ Cox [Thu, 29 Feb 2024 23:03:23 +0000 (18:03 -0500)]
time: move runtimeTimer out of Timer struct

If user code has two timers t1 and t2 and does *t1 = *t2
(or *t1 = Timer{}), it creeps me out that we would be
corrupting the runtime data structures inlined in the
Timer struct. Replace that field with a pointer to the
runtime data structure instead, so that the corruption
cannot happen, even in a badly behaved program.

In fact, remove the struct definition entirely and linkname
a constructor instead. Now the runtime can evolve the struct
however it likes without needing to keep package time in sync.

Also move the workaround logic for #21874 out of
runtime and into package time.

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

13 months agocmd/link: fix typo in comment
guoguangwu [Fri, 8 Mar 2024 02:59:26 +0000 (02:59 +0000)]
cmd/link: fix typo in comment

Change-Id: Ib24841f4823c357ddeefa28435c2b80867d752d2
GitHub-Last-Rev: b0c6c58b24af43b0a0e759b152eb245b3bf1ce4e
GitHub-Pull-Request: golang/go#66182
Reviewed-on: https://go-review.googlesource.com/c/go/+/570015
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 agoall: update golang.org/x/net
Damien Neil [Fri, 8 Mar 2024 17:34:00 +0000 (09:34 -0800)]
all: update golang.org/x/net

Commands run (in both src and src/cmd):
go get golang.org/x/net@master
go mod tidy
go mod vendor

For #24135

Change-Id: I88084d174c15a65350be1b43e27de619dc6d4dd6
Reviewed-on: https://go-review.googlesource.com/c/go/+/570156
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: 胡玮文 <huww98@outlook.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
13 months agocmd/compile: compile cap(ch) as call to runtime.chancap
Russ Cox [Thu, 29 Feb 2024 19:28:09 +0000 (14:28 -0500)]
cmd/compile: compile cap(ch) as call to runtime.chancap

An upcoming CL will give this call more to do.
For now, separate out the compiler change that
stops inlining the computation.

For #37196.

Change-Id: I965426d446964b9b4958e4613246002a7660e7eb
Reviewed-on: https://go-review.googlesource.com/c/go/+/568375
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Auto-Submit: Russ Cox <rsc@golang.org>

13 months agoruntime: fix spurious race using Ticker.Reset
Russ Cox [Fri, 1 Mar 2024 01:14:32 +0000 (20:14 -0500)]
runtime: fix spurious race using Ticker.Reset

Ticker.Reset was added in CL 217362 in 2020.
It added the runtime helper modTimer, which is
analogous to startTimer and resetTimer but for tickers.
Unlike those, it does not contain a racerelease, which
means that code synchronizing by starting a ticker
will be diagnosed with a spurious race.

Add racerelease to modTimer and add tests of all
three racereleases (in startTimer, resetTimer, and modTimer).

Also do not call time.resetTimer from elsewhere in runtime,
since that function is only for package time. Use t.reset instead.

For #33184.

Change-Id: Ie40c1ad24911f21e81b1d3cc608cf086ff2bc83d
Reviewed-on: https://go-review.googlesource.com/c/go/+/568340
Auto-Submit: Russ Cox <rsc@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
13 months agoruntime: gofmt
Russ Cox [Fri, 8 Mar 2024 21:35:16 +0000 (16:35 -0500)]
runtime: gofmt

CL 565515 introduced these non-gofmt'ed lines. Gofmt them.

Change-Id: Id64244c204b2d6a0bd6377caa17869284eb34f45
Reviewed-on: https://go-review.googlesource.com/c/go/+/570216
Auto-Submit: Russ Cox <rsc@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
13 months agoruntime: remove sched, allp < timers lockrank rule
Russ Cox [Thu, 29 Feb 2024 22:00:29 +0000 (17:00 -0500)]
runtime: remove sched, allp < timers lockrank rule

allp < timers has not been necessary since CL 258303.

sched < timers was implied by allp < timers, and that
was still necessary, but only when the world is stopped.
Rewrite the code to avoid that lock since the world is stopped.

Now timers and timer are independent of the scheduler,
so they could call into the scheduler (for example to ready
a goroutine) if we wanted them to.

Change-Id: I12a93013c98e51c9e2f2148175b02afce8384a59
Reviewed-on: https://go-review.googlesource.com/c/go/+/568337
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Auto-Submit: Russ Cox <rsc@golang.org>

13 months agoruntime: re-add call to ts.cleanHead (née cleantimers) during timer add
Russ Cox [Fri, 1 Mar 2024 00:08:59 +0000 (19:08 -0500)]
runtime: re-add call to ts.cleanHead (née cleantimers) during timer add

Before CL 564118, there were two ways to add a new timer:
addtimer or modtimer. Much code was duplicated between them
and it was always valid to call modtimer instead of addtimer
(but not vice versa), so that CL changed all addtimer call sites
to use modtimer and deleted addtimer.

One thing that was unique to addtimer, however, was that it
called cleantimers (now named ts.cleanHead) after locking the
timers, while modtimer did not. This was the only difference
in the duplicated code, and I missed it. Restore the call to
ts.cleanHead when adding a new timer.

Also fix double-unlock in cleanHead.

Change-Id: I26cc50d650f31f977c0c31195cd013244883dba9
Reviewed-on: https://go-review.googlesource.com/c/go/+/568338
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Russ Cox <rsc@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
13 months agoruntime: avoid pp.timers.lock in updateTimerPMask
Russ Cox [Thu, 29 Feb 2024 21:52:58 +0000 (16:52 -0500)]
runtime: avoid pp.timers.lock in updateTimerPMask

The comment in updateTimerPMask is wrong. It says:

// Looks like there are no timers, however another P
// may be adding one at this very moment.
// Take the lock to synchronize.

This was my incorrect simplification of the original comment
from CL 264477 when I was renaming all the things it mentioned:

// Looks like there are no timers, however another P may transiently
// decrement numTimers when handling a timerModified timer in
// checkTimers. We must take timersLock to serialize with these changes.

updateTimerPMask is being called by pidleput, so the P in question
is not in use. And other P's cannot add to this P.
As the original comment more precisely noted, the problem was
that other P's might be calling timers.check, which updates ts.len
occasionally while ts is locked, and one of those updates might
"leak" an ephemeral len==0 even when the heap is not going to
be empty when the P is finally unlocked. The lock/unlock in
updateTimerPMask synchronizes to avoid that. But this defeats
most of the purpose of using ts.len in the first place.

Instead of requiring that synchronization, we can arrange that
ts.len only ever shows a "publishable" length, meaning the len(ts.heap)
we leave behind during ts.unlock.

Having done that, updateTimerPMask can be inlined into pidleput.

The big comment on updateTimerPMask explaining how timerpMask
works is better placed as the doc comment for timerpMask itself,
so move it there.

Change-Id: I5442c9bb7f1473b5fd37c43165429d087012e73f
Reviewed-on: https://go-review.googlesource.com/c/go/+/568336
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Russ Cox <rsc@golang.org>

13 months agoruntime: introduce timers.lock, timers.unlock methods
Russ Cox [Thu, 29 Feb 2024 21:51:44 +0000 (16:51 -0500)]
runtime: introduce timers.lock, timers.unlock methods

No semantic changes here.
Cleaning up for next change.

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

13 months agointernal/syscall/windows: unexport Version
qmuntal [Fri, 8 Mar 2024 08:37:29 +0000 (09:37 +0100)]
internal/syscall/windows: unexport Version

windows.Version is just a thin wrapper around RtlGetNtVersionNumbers,
which is an undocumented Windows API.

This CL unexports windows.Version so it is harder to use by accident.

Change-Id: Ib782da04e4e8be66970111a75f5c2df27ef51643
Reviewed-on: https://go-review.googlesource.com/c/go/+/570055
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 agotime: make sure tests avoid the special-case channel code
Russ Cox [Thu, 29 Feb 2024 16:56:07 +0000 (11:56 -0500)]
time: make sure tests avoid the special-case channel code

Many of the tests in package time are about proper manipulation
of the timer heap. But now NewTimer bypasses the timer heap
except when something is blocked on the associated channel.
Make the tests test the heap again by using AfterFunc instead of
NewTimer.

In particular, adds a non-chan version of TestZeroTimer, which
was flaky-broken and then fixed by CLs in the cleanup stack.
This new tests makes sure we notice if it breaks again.

Fixes #66006.

Change-Id: Ib59fc1b8b85ef5a21e72fe418c627c9b8b8a083a
Reviewed-on: https://go-review.googlesource.com/c/go/+/568255
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Russ Cox <rsc@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
13 months agoruntime: fix mishandling of timer zombie count
Russ Cox [Fri, 8 Mar 2024 02:17:04 +0000 (21:17 -0500)]
runtime: fix mishandling of timer zombie count

The timer zombie count was fundamentally racy and worked around
in CL 569995. We worked around that by ignoring underflow.
The fundamnental race was because t.ts was set before t was
inserted into ts. CL 564997 corrected that fundamental problem,
so now we can account for zombies completely accurately,
never seeing values less than zero. Do that.

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

13 months agoruntime: fix timers.wakeTime inaccuracy race
Russ Cox [Fri, 16 Feb 2024 22:56:43 +0000 (17:56 -0500)]
runtime: fix timers.wakeTime inaccuracy race

timers.wakeTime, which is called concurrently by P's trying to decide
how long they should sleep, can return inaccurate values while
timers.adjust is running. (Before the refactoring, this was still true
but the code did not have good names and was spread across more
files, making the race harder to see.)

The runtime thread sleeping code is complex enough that I am not
confident that the inaccuracy can cause delayed timer wakeups,
but I am also not confident that it can't, nor that it won't in the future.

There are two parts to the fix:

1. A simple logic change in timers.adjust.

2. The introduction of t.maybeAdd to avoid having a t that is
marked as belonging to a specific timers ts but not present
in ts.heap. That was okay before when everything was racy
but needs to be eliminated to make timers.adjust fully consistent.
The cost of the change is an extra CAS-lock operation on a timer add
(close to free since the CAS-lock was just unlocked) and a change
in the static lock ranking to allow malloc while holding a timer lock.

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

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>