1
0
mirror of https://github.com/golang/go synced 2024-11-16 20:54:48 -07:00
Commit Graph

56664 Commits

Author SHA1 Message Date
qmuntal
656a20a52a net: make Dial fail faster on Windows closed loopback devices
On Windows when connecting to an unavailable port, ConnectEx() will
retry for 2s, even on loopback devices.

This CL uses a call to WSAIoctl to make the ConnectEx() call fail
faster on local connections.

Fixes #23366

Change-Id: Iafeca8ea0053f01116b2504c45d88120f84d05e9
Reviewed-on: https://go-review.googlesource.com/c/go/+/495875
Reviewed-by: Heschi Kreinick <heschi@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Quim Muntal <quimmuntal@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2023-05-19 20:19:50 +00:00
Austin Clements
6333725d5f cmd/dist: flush incomplete lines in -json mode
Currently, if a test prints an incomplete line and then exits, in JSON
mode, the filter we use to rewrite Package lines will keep the last
incomplete line in an internal buffer and never print it. In theory
this should never happen anyway because the test should only write
JSON to stdout, but we try pretty hard to pass through any non-JSON,
so it seems inconsistent to swallow incomplete lines.

Fix this by adding a testJSONFilter.Flush method and calling it in the
right places. Unfortunately this is a bit tricky because the filter is
constructed pretty far from where we run the exec.Cmd, so we return
the flush function through the various layers in order to route it to
the place where we call Cmd.Run.

Updates #37486.

Change-Id: I38af67e8ad23458598a32fd428779bb0ec21ac3c
Reviewed-on: https://go-review.googlesource.com/c/go/+/496516
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Austin Clements <austin@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
2023-05-19 20:13:24 +00:00
Michael Anthony Knyszek
e6fb1905cb runtime: make traceClockNow nosplit
It's called from exitsyscall, which is nosplit.

Change-Id: I3f5f92e044497a88a72c1870beb2bdd15c4263c4
Reviewed-on: https://go-review.googlesource.com/c/go/+/496517
Auto-Submit: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: David Chase <drchase@google.com>
2023-05-19 19:56:59 +00:00
cuiweixie
a1a048a8ab maps: enhance the robustness of the tests
Change-Id: I908e11196f55069d6dca6a19cd206629618e9f37
Reviewed-on: https://go-review.googlesource.com/c/go/+/496079
Auto-Submit: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Run-TryBot: xie cui <523516579@qq.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
2023-05-19 19:26:57 +00:00
cuiweixie
09e0f50d03 maps: delete unused var
Change-Id: I3d0c196e2ec139d224d057a954c631251b80e921
Reviewed-on: https://go-review.googlesource.com/c/go/+/496077
Run-TryBot: xie cui <523516579@qq.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
2023-05-19 19:25:41 +00:00
Keith Randall
bd3f44e4ff cmd/compile: constant-fold loads from constant dictionaries and types
Retrying the original CL with a small modification. The original CL
did not handle the case of reading an itab out of a dictionary
correctly.  When we read an itab out of a dictionary, we must treat
the type inside that itab as maybe being put in an interface.

Original CL: 486895
Revert CL: 490156

Change-Id: Id2dc1699d184cd8c63dac83986a70b60b4e6cbd7
Reviewed-on: https://go-review.googlesource.com/c/go/+/491495
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2023-05-19 18:10:11 +00:00
Michael Anthony Knyszek
b60db8f7d9 runtime: formalize the trace clock
Currently the trace clock is cputicks() with comments sprinkled in
different places as to which clock to use. Since the execution tracer
redesign will use a different clock, it seems like a good time to clean
that up.

Also, rename the start/end timestamps to be more readable (i.e.
startTime vs. timeStart).

Change-Id: If43533eddd0e5f68885bb75cdbadb38da42e7584
Reviewed-on: https://go-review.googlesource.com/c/go/+/494775
Reviewed-by: Michael Pratt <mpratt@google.com>
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2023-05-19 18:01:57 +00:00
Ian Lance Taylor
dc4993e7c6 cmp: new package
The new cmp package provides types and functions related to
comparing ordered values.

For #59488

Change-Id: I43f4b2e6036f63b87c2152672d2b6fa18235cbeb
Reviewed-on: https://go-review.googlesource.com/c/go/+/496356
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Eli Bendersky‎ <eliben@golang.org>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@google.com>
2023-05-19 17:41:52 +00:00
miller
86c6b4763e internal/poll: handle SetDeadline to time.Now() in Plan 9
The implementation of SetDeadline in Plan 9 begins by calculating
d = the offset of the requested deadline from time.Now(). If d > 0,
a timer is set to interrupt future I/O. If d < 0, the channel is
flagged to prevent future I/O and any current I/O is cancelled.
But if d = 0, nothing happens and the deadline isn't set.

The d = 0 case should be handled the same as d < 0.

Fixes #60282
Fixes #52896

Change-Id: Id8167db3604db1c129d99376fa78a3da75417d20
Reviewed-on: https://go-review.googlesource.com/c/go/+/496137
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: David du Colombier <0intro@gmail.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2023-05-19 17:10:57 +00:00
Michael Anthony Knyszek
b1aadd034c runtime: emit STW events for all pauses, not just those for the GC
Currently STW events are only emitted for GC STWs. There's little reason
why the trace can't contain events for every STW: they're rare so don't
take up much space in the trace, yet being able to see when the world
was stopped is often critical to debugging certain latency issues,
especially when they stem from user-level APIs.

This change adds new "kinds" to the EvGCSTWStart event, renames the
GCSTW events to just "STW," and lets the parser deal with unknown STW
kinds for future backwards compatibility.

But, this change must break trace compatibility, so it bumps the trace
version to Go 1.21.

This change also includes a small cleanup in the trace command, which
previously checked for STW events when deciding whether user tasks
overlapped with a GC. Looking at the source, I don't see a way for STW
events to ever enter the stream that that code looks at, so that
condition has been deleted.

Change-Id: I9a5dc144092c53e92eb6950e9a5504a790ac00cf
Reviewed-on: https://go-review.googlesource.com/c/go/+/494495
Reviewed-by: Michael Pratt <mpratt@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Michael Knyszek <mknyszek@google.com>
2023-05-19 17:06:45 +00:00
cuiweixie
944911af56 html/template: expose ErrJSTemplate
Fixes #59584

Change-Id: Iabe61476c7457dfffbfe5d0b1fe904901a466c73
Reviewed-on: https://go-review.googlesource.com/c/go/+/496395
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Dmitri Shuralyov <dmitshur@google.com>
Run-TryBot: xie cui <523516579@qq.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
2023-05-19 16:51:35 +00:00
Michael Anthony Knyszek
24617a068c runtime: flush idle time to sched.idleTime on limiter event consumption
This was an oversight, which might cause accounted-for idle time to be
lost. Noticed this while working on #60276.

Change-Id: Ic743785d6dc82555e660f2c9b6aaa9dedef56ed8
Reviewed-on: https://go-review.googlesource.com/c/go/+/496117
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
2023-05-19 16:24:53 +00:00
Michael Anthony Knyszek
78df00dd6f runtime: fix lockrank ordering for pinner implementation
The new Pinner API's implementation imposes some partial-orders that are
safe but previously did not exist between a mspanSpecial, mheapSpecial,
and mheap. Fix that up in the lock ranking.

For #46787.

Change-Id: I51cc8f7f069240caeb44d749bed43515634f4814
Reviewed-on: https://go-review.googlesource.com/c/go/+/496193
Run-TryBot: Michael Knyszek <mknyszek@google.com>
Reviewed-by: David Chase <drchase@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
2023-05-19 16:15:06 +00:00
cuiweixie
f283cba396 maps,runtime: improve maps.Keys
name     old time/op    new time/op    delta
Keys-10    8.65ms ± 0%    7.06ms ± 0%  -18.41%  (p=0.000 n=9+9)

name     old alloc/op   new alloc/op   delta
Keys-10    58.2kB ± 1%    47.4kB ± 2%  -18.54%  (p=0.000 n=10+10)

name     old allocs/op  new allocs/op  delta
Keys-10      0.00           0.00          ~     (all equal)

Change-Id: Ia7061c37be89e906e79bc3ef3bb1ef0d7913f9f6
Reviewed-on: https://go-review.googlesource.com/c/go/+/481435
Reviewed-by: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Run-TryBot: xie cui <523516579@qq.com>
2023-05-19 15:54:43 +00:00
Sven Anderson
251daf46fb runtime: implement Pinner API for object pinning
Some C APIs require the use or structures that contain pointers to
buffers (iovec, io_uring, ...).  The pointer passing rules would
require that these buffers are allocated in C memory and to process
this data with Go libraries it would need to be copied.

In order to provide a zero-copy way to use these C APIs, this CL
implements a Pinner API that allows to pin Go objects, which
guarantees that the garbage collector does not move these objects
while pinned.  This allows to relax the pointer passing rules so that
pinned pointers can be stored in C allocated memory or can be
contained in Go memory that is passed to C functions.

The Pin() method accepts pointers to objects of any type and
unsafe.Pointer.  Slices and arrays can be pinned by calling Pin()
with the pointer to the first element.  Pinning of maps is not
supported.

If the GC collects unreachable Pinner holding pinned objects it
panics.  If Pin() is called with the other non-pointer types it
panics as well.

Performance considerations: This change has no impact on execution
time on existing code, because checks are only done in code paths,
that would panic otherwise.  The memory footprint on existing code is
one pointer per memory span.

Fixes: #46787

Signed-off-by: Sven Anderson <sven@anderson.de>
Change-Id: I110031fe789b92277ae45a9455624687bd1c54f2
Reviewed-on: https://go-review.googlesource.com/c/go/+/367296
Auto-Submit: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Run-TryBot: Michael Knyszek <mknyszek@google.com>
2023-05-19 14:59:14 +00:00
Oleksandr Redko
3b9f99ebaa go/types: fix typos in comments
Change-Id: Ifadb11dc8ba8e63c736cb7ac277247bc587ce4b3
Reviewed-on: https://go-review.googlesource.com/c/go/+/496136
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2023-05-19 14:31:23 +00:00
Michael Anthony Knyszek
e97bd776f9 runtime: make the memory limit heap goal headroom proportional
Currently if GOGC=off and GOMEMLIMIT is set, then the synchronous
scavenger is likely to work fairly often to maintain the limit, since
the heap goal goes right up to the edge of the memory limit (minus a
fixed 1 MiB of headroom).

If the application's allocation rate is high, and page-level
fragmentation is high, then most allocations will scavenge.

This change mitigates this problem by adding a proportional component
to constant headroom added to the memory-limit-based heap goal. This
means the runtime will have much more headroom before fragmentation
forces memory to be eagerly scavenged.

The proportional headroom in this case is 3%, or ~30 MiB for a 1 GiB
heap. This technically will increase GC frequency in the GOGC=off case
by a tiny amount, but will likely have a positive impact on both
allocation throughput and latency that outweighs this difference.

I wrote a small program to reproduce this issue and confirmed that the
issue is resolved by this patch:

https://github.com/golang/go/issues/57069#issuecomment-1551746565

This value of 3% is chosen as it seems to be a inflection point in this
particular small program. 2% still resulted in quite a bit of eager
scavenging work. I confirmed this results in a GC frequency increase of
about 3%.

This choice is still somewhat arbitrary because the program is
arbitrary, so perhaps worth revisiting in the future. Still, it should
help a good number of programs.

Fixes #57069.

Change-Id: Icb9829db0dfefb4fe42a0cabc5aa8d35970dd7d5
Reviewed-on: https://go-review.googlesource.com/c/go/+/460375
Reviewed-by: Michael Pratt <mpratt@google.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2023-05-19 13:53:21 +00:00
Tobias Klauser
9ed2b115fb runtime: report correct fcntl syscall error in checkCloseonexec
runtime.fcntl returns the error value as a negative value, so it needs
to be inverted before being converted to syscall.Errno.

Change-Id: I43cd0b035150424ac59e623b17a9396c7d62c186
Reviewed-on: https://go-review.googlesource.com/c/go/+/495675
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2023-05-19 13:50:58 +00:00
Robert Griesemer
08e39a1961 go/types, types2: fix comments in unify.go
No code changes.

Change-Id: I4c17e87673fc7dc1d87807e73beec828cbd4289b
Reviewed-on: https://go-review.googlesource.com/c/go/+/496355
Run-TryBot: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
2023-05-19 13:43:15 +00:00
Robert Griesemer
ade3f3f5ef go/types, types2: type-check built-ins even if there's a version error
There is no harm in continuing type-checking a built-in even if there
is a version error.

Change-Id: I161abd904a26075694c26639e247a17126947fcd
Reviewed-on: https://go-review.googlesource.com/c/go/+/496415
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
2023-05-19 13:42:46 +00:00
Michael Anthony Knyszek
a3e90dc377 runtime: add eager scavenging details to GODEBUG=scavtrace=1
Also, clean up atomics on released-per-cycle while we're here.

For #57069.

Change-Id: I14026e8281f01dea1e8c8de6aa8944712b7b24d9
Reviewed-on: https://go-review.googlesource.com/c/go/+/495916
Reviewed-by: Michael Pratt <mpratt@google.com>
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2023-05-19 13:38:43 +00:00
Alessandro Arzilli
0bbb54a02d cmd/link: add ReflectMethod flag to -dumpdep output
Adds ReflectMethod flag to the output of -dumpdep.

Fixes #60221

Change-Id: I631d72ee21b819a3a629780317ff4d962cc121e0
Reviewed-on: https://go-review.googlesource.com/c/go/+/495715
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Alessandro Arzilli <alessandro.arzilli@gmail.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
2023-05-19 12:07:32 +00:00
Bryan C. Mills
d0c72c23dc cmd/go: add a GODEBUG to limit the number of concurrent network connections
I implemented this in order to debug connection failures on a
new-to-me VM development environment that uses Cloud NAT. It doesn't
directly fix the bug, but perhaps folks will find it useful to
diagnose port-exhaustion-related flakiness in other environments.

For #52545.

Change-Id: Icd3f13dcf62e718560c4f4a965a4df7c1bd785ce
Reviewed-on: https://go-review.googlesource.com/c/go/+/473277
Run-TryBot: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
Auto-Submit: Bryan Mills <bcmills@google.com>
2023-05-19 02:47:12 +00:00
Austin Clements
8f1031df77 cmd/cgo/internal/testcarchive: fix nocgo and no-c-archive builds
CL 495918 enabled testcarchive much more widely and added many dynamic
test skips. CL 495855 added TestDeepStack before these dynamic skips
were in. Unfortunately, the two CLs don't logically commute, so when
CL 495918 landed, it broke at least nocgo builders and platforms that
don't support c-archive builds. Fix this by adding the necessary skips
to TestDeepStack.

Change-Id: I3d352f731fe67a01c7b96871fde772db8eb21b5d
Reviewed-on: https://go-review.googlesource.com/c/go/+/496376
Auto-Submit: Austin Clements <austin@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
2023-05-19 02:15:30 +00:00
Robert Griesemer
4088e97fc2 cmd/compile: use more lenient type inference for untyped arguments for go1.21
This CL permanently enables the new behavior for -lang=go1.21 and
newer, and keeps the existing behavior if -lang=go1.20 or older.

To be submitted once #58671 is accepted.

For #58671.

Change-Id: I83a1d393f0ce7871be8f38ec35742d393946c55f
Reviewed-on: https://go-review.googlesource.com/c/go/+/496035
Run-TryBot: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
2023-05-19 01:56:58 +00:00
Austin Clements
ad7d1d995f cmd/cgo/internal/testsovar: merge into testso
The test driver for testso and testsovar are literally identical, and
only the testdata code is different between the two test packages.
Merge them into a single test package with two tests that share a
driver.

Change-Id: I3f107a6aba345c0dd58606c10e3ac8eee33b33c5
Reviewed-on: https://go-review.googlesource.com/c/go/+/496315
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2023-05-19 01:37:41 +00:00
Austin Clements
b42ce3a65f cmd/cgo/internal/testtls: cleanup and support more arches
Currently, this test only enabled on non-Darwin UNIX platforms because
it uses the non-standard _thread attribute for thread-local storage.
C11 introduced a standard way to declare something thread-local, so
this CL takes advantage of that to generalize the test to Darwin and
Windows.

Change-Id: Iba31b6216721df6eb8e978d7487cd3a787cae588
Reviewed-on: https://go-review.googlesource.com/c/go/+/496295
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Austin Clements <austin@google.com>
2023-05-19 01:37:39 +00:00
Austin Clements
3ebbaf3a4d cmd/dist: drop remaining conditions on default cgo tests
Currently, dist registers cmd/cgo/internal{test,testtls,testnocgo}
specially, so they're opted out of "go test std cmd". It has to
register these test packages to run in various non-default build
configurations, but at this point they can also run with the default
build configuration (and for test and testtls, we intentionally want
to test them in the default configuration; this is pointless but
harmless for testnocgo). Hence, this CL drops the special registration
of their default build configurations from registerCgoTests and lets
them be registered as part of registerStdTests.

Change-Id: Id283f3cdcdb202955a854648c0ed1e3c4aa554d1
Reviewed-on: https://go-review.googlesource.com/c/go/+/496179
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
2023-05-19 01:37:38 +00:00
Austin Clements
cbd3305f8c cmd/cgo/internal/testnocgo: always run in default configuration
This test is actually intended to test that we can build in -static
mode even without any cgo. That means it's quite harmless to run in
the default build configuration (in addition to running with various
other build configurations).

Change-Id: Ic6cb5c0eaab83f9bd5718aae57d0fdc69afcb8b6
Reviewed-on: https://go-review.googlesource.com/c/go/+/496178
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2023-05-19 01:37:37 +00:00
Austin Clements
ab3c2b6d89 cmd/cgo/internal/testtls: build and run everywhere
This makes testtls build and run on all platforms in the default build
configuration (though it will Skip on some).

Change-Id: I6aba96a82d618c9798a0d4418b40b2644cfceec9
Reviewed-on: https://go-review.googlesource.com/c/go/+/496177
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
2023-05-19 01:37:35 +00:00
Austin Clements
408f7a4663 cmd/dist: don't pass -linkmode=auto
This is the default value of this flag, so passing it clutters up
debugging output. This also makes it clearer which tests are running
with a default configuration.

Change-Id: If793934829c79f087c7a6e3fa8f64dc33959c213
Reviewed-on: https://go-review.googlesource.com/c/go/+/496176
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2023-05-19 01:37:34 +00:00
Austin Clements
18ffa7185d cmd/dist: let several cgo tests run as regular cmd tests
Several cgo tests no longer have any special conditions, so they can
just be normal cmd tests. This brings dist's "go_test:.*" tests much
closer to what "go test std cmd" runs.

Change-Id: I4d09f60628a41081e97e6b6e7dd0d93df47a65bb
Reviewed-on: https://go-review.googlesource.com/c/go/+/495919
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
2023-05-19 01:37:32 +00:00
Austin Clements
a674ab1961 cmd/dist: refine test conditions and enable more cgo tests on Android, iOS
This CL moves many cgo test conditions out of dist and into the tests
themselves, now that they can use the testenv.Must* helpers.

This refines a lot of the conditions, which happens to have the effect
of enabling many tests on Android and iOS that are disabled by
too-coarse GOOS checks in dist today.

Fixes #15919.

Change-Id: I2947526b08928d2f7f89f107b5b2403b32092ed8
Reviewed-on: https://go-review.googlesource.com/c/go/+/495918
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
2023-05-19 01:37:31 +00:00
Austin Clements
071770b846 cmd/dist: enable more cgo tests if GO_GCFLAGS != ""
Currently, we have several tests disabled if GO_GCFLAGS is non-empty.

Long ago, this was critical because many of these tests use "go
install" with no -gcflags and would thus overwrite std packages in
GOROOT built with -gcflags=$GO_GCFLAGS. Now these packages all live in
the build cache, so this is no longer a concern.

The other reason for this (the reason given in the code comment), is
that these tests will rebuild significant portions of std without
flags. While this is still theoretically true, there are many tests
that run "go build" with no -gcflags, so these tests don't contribute
much overall.

Empirically, on my linux/amd64 host, running these tests at all grows
the Go build cache by 14%, from 1.899 GB to 2.165 GB. When building
with GO_GCFLAGS="-N -l" (the only use case on the builders), enabling
them grows the Go build cache by 18%, from 1.424 GB to 1.684 GB. This
is only a 4 percentage point difference, and still results in a build
cache that's smaller than the default build

Given all this, there's little reason to carry the complexity of
disabling these tests when GO_GCFLAGS != "". Removing this condition
is a step toward running these as regular cmd tests.

Change-Id: I2c41be721927c40a742e01476cd9a0f7650d38e6
Reviewed-on: https://go-review.googlesource.com/c/go/+/495917
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2023-05-19 01:37:29 +00:00
Russ Cox
e95982fe30 cmd/api: skip TestIssue21181
It is incredibly slow, taking half as long as the regular cmd/api checks
and over 5 minutes on plan9-arm. Leave it for the longtest builders.

Change-Id: Ic8bd420f174268d0b6a13d84e7bd364f6c13cf41
Reviewed-on: https://go-review.googlesource.com/c/go/+/496375
Auto-Submit: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
2023-05-19 01:36:29 +00:00
Alan Donovan
3ca52f4c31 slices: add in-place Reverse function
Fixes #58565

Change-Id: I583f8380c12386178fb18e553322bbb019d9fae0
Reviewed-on: https://go-review.googlesource.com/c/go/+/468855
Run-TryBot: Alan Donovan <adonovan@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Shay Nehmad <dude500@gmail.com>
2023-05-19 00:43:02 +00:00
Oleksandr Redko
58d40d156e os: remove unnecessary return after t.Fatal
Change-Id: Ibddf36431abb799d8f9288d6e17159ce1538d62e
Reviewed-on: https://go-review.googlesource.com/c/go/+/495879
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2023-05-19 00:41:52 +00:00
Heschi Kreinick
38ae922b9b doc: add TODOs to go1.21
Generated with relnote. I did my best to put things where they made
sense, but some weren't obvious, like the Unicode upgrade and backward
compatibility stuff.

For #58645.

Change-Id: Ic3cd9ef32cec7591ace4d2df1da40e4afd97d083
Reviewed-on: https://go-review.googlesource.com/c/go/+/496316
Auto-Submit: Heschi Kreinick <heschi@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Heschi Kreinick <heschi@google.com>
2023-05-18 22:21:11 +00:00
Robert Griesemer
edbef1a848 go/types, types2: remove unnecessary assignment (minor cleanup)
Change-Id: I77e5056a159b6041ca49480a3c493a515d4b3a2f
Reviewed-on: https://go-review.googlesource.com/c/go/+/496255
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2023-05-18 22:02:20 +00:00
Austin Clements
78203ac536 cmd/dist: tweaks to -json mode
These are some follow-up tweaks to CL 494958. This CL drops a stale
and unnecessary check and passes through trailing non-JSON output.

Updates #37486.

Change-Id: I7cdb73a103f9cd49767d5491812d5ad011ee5c14
Reviewed-on: https://go-review.googlesource.com/c/go/+/496297
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Austin Clements <austin@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Austin Clements <austin@google.com>
2023-05-18 21:19:05 +00:00
Robert Griesemer
b5515eef56 go/types, types2: implement min/max builtins
For #59488.

Change-Id: I4553ab11af9179a4786dede44877f88286c168dc
Reviewed-on: https://go-review.googlesource.com/c/go/+/496038
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
2023-05-18 21:16:29 +00:00
Bryan C. Mills
c7d6c6000a cmd/go/internal/modfetch: avoid creating unused temp directories
(Discovered via #60113, but this doesn't address that issue.)

Change-Id: I8b89e74b786dcfb0aa5d71fcbd0df8af33b98f36
Reviewed-on: https://go-review.googlesource.com/c/go/+/494375
Run-TryBot: Bryan Mills <bcmills@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
2023-05-18 20:10:14 +00:00
Bryan C. Mills
917171f564 cmd/go/internal/modload: fix sanity check in rawGoModSummary
m.Path is never empty for a module in the build list; this fixes a
typo from CL 334932.

Change-Id: I5328081ba3bcf5eeac9a1b21a03969ba82ab20ab
Reviewed-on: https://go-review.googlesource.com/c/go/+/489076
Auto-Submit: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
Run-TryBot: Bryan Mills <bcmills@google.com>
2023-05-18 19:58:34 +00:00
Bryan C. Mills
bc04d4afa2 cmd/go: log more information about leaked temp files
Previously, we were only logging the top-level names of leaked
directories, which doesn't provide much information for debugging.

For #55260.

Change-Id: I845d158135d67b5d7fdeb16ab7031a061535e643
Reviewed-on: https://go-review.googlesource.com/c/go/+/479055
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
Auto-Submit: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2023-05-18 19:40:29 +00:00
Bryan C. Mills
308ca75edb cmd/go: make TestScript/gotoolchain more realistic
- Build the fake go1.999testpath binary from Go source instead of
  special-casing a fake command on Windows.

- Skip the part of the test that uses shell scripts served from the
  test GOPROXY if /bin/sh is not present.

This makes the test more expensive, but also more realistic: notably,
it does not require test hooks to determine whether to run a real or
fake binary.

Change-Id: If14fec52186631d7833eba653c91ec5198dede58
Reviewed-on: https://go-review.googlesource.com/c/go/+/486400
Run-TryBot: Bryan Mills <bcmills@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
2023-05-18 19:37:07 +00:00
Bryan C. Mills
ebfd80ba6f cmd/go: propagate Context arguments through modfetch methods
For #56886.
For #38714.

Change-Id: I15c4a8673407d3423d7e203d645c6d0fb780d192
Reviewed-on: https://go-review.googlesource.com/c/go/+/452456
Reviewed-by: Michael Matloob <matloob@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
2023-05-18 19:33:59 +00:00
Robert Griesemer
72f448cb48 go/types, types2: factor out type matching in binary operations
Change-Id: Ica61698b6ba00687dcd133245bfc3d87808c7bca
Reviewed-on: https://go-review.googlesource.com/c/go/+/496096
Run-TryBot: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
2023-05-18 18:40:06 +00:00
Robert Griesemer
44b8f3907c go/types, types2: reduce differences between go/types and types2 builtins.go
Change-Id: I2946e061c70d31df3ba2aa3582700c3785b647e0
Reviewed-on: https://go-review.googlesource.com/c/go/+/495615
Reviewed-by: Robert Findley <rfindley@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
2023-05-18 18:39:34 +00:00
Robert Griesemer
8e3dfe783a go/types, types2: assert that builtin reports valid operand mode upon success
Fix a case where x.mode == invalid was returned despite builtin
returning true.

Change-Id: Iae9c18aac16bcbadc3530d341b380e05c8743fcc
Reviewed-on: https://go-review.googlesource.com/c/go/+/495299
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2023-05-18 18:39:32 +00:00
Robert Griesemer
66432e1b62 go/types, types2: remove argument "getter" use from Checker.builtins (cleanup)
Check all arguments for validity once, in the beginning.
Conservatively replace arg(x, i) calls with *x = args[i].
Use y (2nd arguments) directly, w/o copying.
Remove unnecessary copies and slice creations in append.

Change-Id: I1e2891cba9658f5b3cdf897e81db2f690a99b16b
Reviewed-on: https://go-review.googlesource.com/c/go/+/495515
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
2023-05-18 18:39:12 +00:00