Commit graph

52937 commits

Author SHA1 Message Date
Michael Anthony Knyszek 4b236b45d0 runtime: convert flaky semaphore linearity test into benchmark
Also, add a benchmark for another case that was originally tested.

Also also, remove all the dead code this now creates.

Fixes #53428.

Change-Id: Idbba88d3d31d38a8854fd5ed99001e394da27300
Reviewed-on: https://go-review.googlesource.com/c/go/+/412878
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Run-TryBot: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
2022-06-21 19:37:22 +00:00
Bryan C. Mills 530511bacc cmd/go/internal/modindex: avoid walking modules when not needed
Due to a missed condition in CL 412394, we were walking all modules
(instead of just the ones contained in GOROOT) at each invocation of a
devel version of cmd/go.

Moreover, while we were running cmd/go tests, we were re-walking
GOROOT at each 'go' invocation in the test even though we expect
GOROOT to be stable within a test run.

This change always avoids walking non-GOROOT modules, and also adds a
salt (configurable via GODEBUG) and uses it to avoid walking GOROOT
modules when GOROOT is known to be stable (such as over the course of
a 'cmd/go' test run).

This should fix the cmd/go test timeouts that are currently occurring
on the dragonfly-amd64 builder, such as this one:
https://build.golang.org/log/21c01c3ae5490d387d84abeaf872b3a0a76ab8e5

Updates #53290.

Change-Id: Ic807d215831a3cd21c63e0bccd3d7acd10d8f2b7
Reviewed-on: https://go-review.googlesource.com/c/go/+/412779
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Bryan Mills <bcmills@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
2022-06-21 17:32:57 +00:00
Keith Randall c2d373d5d1 cmd/compile: allow 128-bit values to be spilled
We sometimes use 16-byte load+store to move values around in memory.
In rare circumstances, the loaded value must be spilled because the
store can't happen yet.

In that case, we need to be able to spill the 16-byte value.

Fixes #53454

Change-Id: I09fd08e11a63c6ba3ef781d3f5ede237e9b0132e
Reviewed-on: https://go-review.googlesource.com/c/go/+/413294
Reviewed-by: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
2022-06-21 17:23:40 +00:00
Matthew Dempsky 19ed442807 test: add regress test for #53477
This test already passes for GOEXPERIMENT=unified; add regress test to
ensure it stays that way.

Updates #53477.

Change-Id: Ib7aa7428260595077052207899edcc044a6ab1c8
Reviewed-on: https://go-review.googlesource.com/c/go/+/413394
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Auto-Submit: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: David Chase <drchase@google.com>
2022-06-21 15:00:37 +00:00
Tobias Klauser 3fcbfb07a8 doc/go1.19: fix HTML validation issues
Avoid duplicating tag ID runtime and remove a superflous </dd> tag.

Found by https://validator.w3.org

Change-Id: I9c84b8257acbb6d3d6817192bb8d355207944b9a
Reviewed-on: https://go-review.googlesource.com/c/go/+/413254
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
2022-06-20 18:39:08 +00:00
Cuong Manh Le 527ace0ffa cmd/compile: skip substituting closures in unsafe builtins arguments
For unsafe.{Alignof,Offsetof,Sizeof}, subster will transform them them
to OLITERAL nodes, and discard their arguments. However, any closure in
their children nodes were already processed and added to declaration
queue. Thus, we lack of information for generating instantiation for
the closure.

To fix it, just skip substituting the closures if we are going to edit
the children nodes of unsafe builtins.

Fixes #53390

Change-Id: Ia815cd05af9dc0491f10faac4399f378ac53dec6
Reviewed-on: https://go-review.googlesource.com/c/go/+/412794
Reviewed-by: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2022-06-18 00:48:50 +00:00
Matthew Dempsky ec58e3f327 test: add regress test for #53419
This currently works with GOEXPERIMENT=unified. Add a regress test to
make sure it stays that way.

Updates #53419.

Change-Id: I2ea1f9039c59807fbd497d69a0420771f8d6d035
Reviewed-on: https://go-review.googlesource.com/c/go/+/413014
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Auto-Submit: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-06-17 22:44:22 +00:00
Josh Powers 103cc661f1 cmd/go/internal/modfetch: prevent duplicate hashes in go.sum
To write go.sum, each module and then each hash is looped through. The
hashes are kept in a slice and there is no check to ensure that hashes
were not added or already exist in the file. Therefore, unique the
hashes of each module before writing to prevent duplicates.

Fixes: #28456

Change-Id: I1cf7e7cdee3e7530a0ee605cd76d738627be1e0d
GitHub-Last-Rev: 0ed02e9591
GitHub-Pull-Request: golang/go#53291
Reviewed-on: https://go-review.googlesource.com/c/go/+/411154
Auto-Submit: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-06-17 21:38:40 +00:00
Kevin Burke d42a48828f sync: add more notes about Cond behavior
Cond is difficult to use correctly (I was just bitten by it in
a production app that I inherited). While several proposals have come
up to improve or remove sync.Cond, no action has so far been taken.

Update the documentation to discourage use of sync.Cond, and point
people in the direction of preferred alternatives. I believe this will
help encourage behavior we want (less use of sync.Cond and more use of
channels), while also paving the way for, potentially, removing Cond
in a future version of the language.

Thanks very much to Bryan Mills and Sean Liao for discussion and
recommendations.

Updates #20491.
Updates #21165.

Change-Id: Ib4d0631c79d4c4d0a30027255cd43bc47cddebd3
Reviewed-on: https://go-review.googlesource.com/c/go/+/412237
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2022-06-17 21:35:36 +00:00
Bryan C. Mills 9e2f289754 cmd/go/internal/work: log clearer detail for subprocess errors in (*Builder).toolID
For #52647.

Change-Id: Ic12123769d339c2df677500ed59f15a4ee5037d3
Reviewed-on: https://go-review.googlesource.com/c/go/+/412954
Run-TryBot: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Bryan Mills <bcmills@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2022-06-17 21:21:58 +00:00
Dmitri Goutnik dd2d00f9d5 net: fix flaky *TimeoutMustNotReturn tests
The tester goroutine doesn't always gets a chance to run before the
timeout expires. Wait for the goroutine to start and set deadlines
before staring the timer.

Fixes #36796

Change-Id: Iffed6259de31340c3f66e34da473826a1d09fcde
Reviewed-on: https://go-review.googlesource.com/c/go/+/412858
Reviewed-by: Damien Neil <dneil@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-06-17 21:21:26 +00:00
Alan Donovan 6c25ba624f go/token: delete unused File.set field
This field is only used for a sanity check in a test.

Change-Id: I868ed10131ec33994ebb1b1d88f6740956824bd7
Reviewed-on: https://go-review.googlesource.com/c/go/+/409834
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
2022-06-17 15:02:55 +00:00
Bryan C. Mills 9068c6844d cmd/dist: add package . to 'go test' commands
This suppresses verbose output if the test passes,
eliminating some "hello from C" noise for the ../misc/cgo test.

Change-Id: I6324bfb4b3633c20e0eb0ae03aa25d40fab9fcfb
Reviewed-on: https://go-review.googlesource.com/c/go/+/412776
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-06-16 21:58:40 +00:00
Michael Anthony Knyszek 7bad61554e runtime: write much more direct test for semaphore waiter scalability
This test originally existed as two tests in test/locklinear.go, but
this checked against actual locks and was flaky. The test was checking
a property of a deep part of the runtime but from a much higher level,
and it's easy for nondeterminism due to scheduling to completely mess
that up, especially on an oversubscribed system.

That test was then moved to the sync package with a more rigorous
testing methodology, but it could still flake pretty easily.

Finally, this CL makes semtable more testable, exports it in
export_test.go, then writes a very direct scalability test for exactly
the situation the original test described. As far as I can tell, this is
much, much more stable, because it's single-threaded and is just
checking exactly the algorithm we need to check.

Don't bother trying to bring in a test that checks for O(log n) behavior
on the other kind of iteration. It'll be perpetually flaky because the
underlying data structure is a treap, so it's only _expected_ to be
O(log n), but it's very easy for it to get unlucky without a large
number of iterations that's too much for a simple test.

Fixes #53381.

Change-Id: Ia1cd2d2b0e36d552d5a8ae137077260a16016602
Reviewed-on: https://go-review.googlesource.com/c/go/+/412875
Reviewed-by: Michael Pratt <mpratt@google.com>
2022-06-16 21:25:35 +00:00
Michael Matloob f38a580a51 cmd/go: add more tracing
Change-Id: I26ed64c097533ee9276e598653db72efc053c4e5
Reviewed-on: https://go-review.googlesource.com/c/go/+/403156
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
Run-TryBot: Michael Matloob <matloob@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
2022-06-16 20:59:51 +00:00
Russ Cox 635b1244aa cmd/go: pass GOEXPERIMENT through to subtests
This fixes:

	export GOEXPERIMENT=unified
	go install cmd
	go install std cmd
	go install std cmd
	go test -short cmd/go -run=TestScript/test_relative_import_dash_i

That script test checks that runtime is non-stale, but whether it's stale
depends on the setting of GOEXPERIMENT. Stop filtering that variable out.

Change-Id: I71bdbca495c16981cdcddf4ab4d87a38ca72a389
Reviewed-on: https://go-review.googlesource.com/c/go/+/412874
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Auto-Submit: Russ Cox <rsc@golang.org>
2022-06-16 20:01:10 +00:00
Ian Lance Taylor ef808ae1d4 expvar: don't crash if map value set to nil
Fixes #52719

Change-Id: Ib032193d00664090c47ae92e7d59674ec2d0165a
Reviewed-on: https://go-review.googlesource.com/c/go/+/408677
Reviewed-by: Alan Donovan <adonovan@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
2022-06-16 18:29:19 +00:00
Robert Griesemer 32510eea74 go/parser: remove unused method checkBinaryExpr
Change-Id: Ica981657e50e30cbfa1757e8457819a479f11c7d
Reviewed-on: https://go-review.googlesource.com/c/go/+/412775
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Robert Griesemer <gri@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
2022-06-16 18:25:05 +00:00
Michael Matloob 74f1fa6ecb cmd/go: parallelize matchPackages work in each module
In each module matchPackages looks in, when doing the walk, do the
scanDir call in a par.Queue so all the read work can be done in
parallel.

Change-Id: I27153dbb3a2ed417ca24972f47134e9e914a55d1
Reviewed-on: https://go-review.googlesource.com/c/go/+/404097
Reviewed-by: Michael Matloob <matloob@golang.org>
Run-TryBot: Michael Matloob <matloob@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
2022-06-16 16:44:35 +00:00
Cherry Mui 1d9d99b7ce cmd/link: consider alignment in carrier symbol size calculation
Currently, when we calculate the size of a carrier symbol, we use
the previous symbol's end address as the start. But the symbol
actually starts after applying the alignment. Do this in the
size calculation.

Should fix AIX build.

Updates #53372.

Change-Id: I17942b1fe8027dce12b78c8e8c80ea6cebcee240
Reviewed-on: https://go-review.googlesource.com/c/go/+/412734
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
2022-06-16 16:27:17 +00:00
Robert Griesemer bcce8ef498 spec: adjust incorrect sentence in section on rune literals
Add an additional example.

Fixes #53217.

Change-Id: I899376b9c1fa8dc5d475d8d3d6c8788ab79b0847
Reviewed-on: https://go-review.googlesource.com/c/go/+/412238
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2022-06-16 16:22:37 +00:00
Ian Lance Taylor ecc268aa26 test: add test that gofrontend fails
For #52870

Change-Id: Ic0791af4283c9e426f7cbfab0514517ff84cfa80
Reviewed-on: https://go-review.googlesource.com/c/go/+/412535
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
2022-06-16 01:03:59 +00:00
Ian Lance Taylor b6c1606889 internal/goarch, internal/goos: update generators for syslist.go
Update the generator programs for the changes to syslist.go in CL
390274 and the changes to the generated files in CL 344955.

Tested by running the programs and verifying that the files did not
change.

Fixes #53299

Change-Id: I2b2c5769f7e9283aa05c803256d2ea1eb9ad1547
Reviewed-on: https://go-review.googlesource.com/c/go/+/411334
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-06-15 21:31:23 +00:00
Koichi Shiraishi 91baf5cecc reflect: fix reference comment to runtime/map.go
Change-Id: Icb552dc7106afbf6bd4bd3660d632f174153f834
Reviewed-on: https://go-review.googlesource.com/c/go/+/408914
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
2022-06-15 21:24:24 +00:00
Vojtěch Boček 0e3d0c9581 syscall: clarify Pdeathsig documentation on Linux
This is a rather large footgun, so let's mention that it sends the signal on thread termination and not process termination in the documentation.

Updates #27505

Change-Id: I489cf7136e34a1a7896067ae24187b0d523d987e
GitHub-Last-Rev: c8722b25d1
GitHub-Pull-Request: golang/go#53365
Reviewed-on: https://go-review.googlesource.com/c/go/+/412114
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2022-06-15 21:18:07 +00:00
Robert Griesemer 74bf90c779 go/types, types2: add test case for issue for coverage
The specific error doesn't occur anymore.
Add a test to prevent regressions.

For #50729.

Change-Id: Ibf6ef6009b3d226b4f345b5a5657939915f19633
Reviewed-on: https://go-review.googlesource.com/c/go/+/412235
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2022-06-15 21:18:06 +00:00
Tobias Klauser 0cd0c12f57 doc/go1.19: use matching closing tag in unix build constraint heading
Change-Id: Idb990eac60e334a5901b2d6cdc2380225d011dd6
Reviewed-on: https://go-review.googlesource.com/c/go/+/412294
Auto-Submit: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2022-06-15 21:16:14 +00:00
Guoqi Chen 97bfc77f38 syscall, runtime/internal/syscall: always zero the higher bits of return value on linux/loong64
All loong64 syscalls return values only via R4/A0, and R5/A1 may contain unrelated
content. Always zero the second return value.

Change-Id: I62af59369bece5bd8028b937c74f4694150f7a55
Reviewed-on: https://go-review.googlesource.com/c/go/+/411615
Run-TryBot: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Austin Clements <austin@google.com>
2022-06-15 20:49:30 +00:00
subham sarkar 937fa5000a net/netip: add missing ) in ParsePrefix errors
The existing error messages didn't add right parenthesis ')' properly
leading to improper formation of error messages.

Fixes #53283

Change-Id: Iadf9b8059403efa07e39716a81fab68cd10b7f87
Reviewed-on: https://go-review.googlesource.com/c/go/+/411015
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Damien Neil <dneil@google.com>
2022-06-15 20:07:10 +00:00
Cherry Mui c2c76c6f19 cmd/link: set alignment for carrier symbols
For carrier symbols like type.*, currently we don't set its
alignment. Normally it doesn't actually matter as we still align
the inner symbols. But in some cases it does make the symbol table
a bit weird, e.g. on darwin/arm64,

0000000000070000 s _runtime.types
0000000000070001 s _type.*

The address of the symbol _type.* is a bit weird. And the new
darwin linker from Xcode 14 beta doesn't like that (see issue
53372).

This CL aligns them.

Fixes #53372.

Change-Id: I1cb19dcf172e9a6bca248d85a7e54da76cbbc8a4
Reviewed-on: https://go-review.googlesource.com/c/go/+/411912
Reviewed-by: Than McIntosh <thanm@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-06-15 17:37:53 +00:00
Bryan C. Mills 36147dd1e8 cmd/go/internal/modindex: disable indexing for modules outside GOROOT and the module cache
Since CL 410821 we were indexing these modules with a cache key based
on the mtimes of the files within the module. However, that seems to
be causing test failures (#53269 and maybe #53371).

In addition, indexing these modules caused a potentially-expensive
operation (re-indexing a whole module) whenever any individual file
within the module is changed, even if it isn't relevant to the
package(s) being loaded from that module. In some cases, that could
cause a significant performance regression for 'go' commands invoked
on a small subset of the packages in the module (such as running 'go
test' on a single changed package — a common case during development).

Instead, we now index only those modules found within the module cache
and within GOROOT.

In addition, we now check mtimes when indexing GOROOT modules if the
Go version begins with the string "devel ", which indicates a
non-released Go version that may include local file edits within GOROOT.

For #53371.
For #53269.

Change-Id: Id3aa81b55ecfc478e47dd420148d39d2cf476f2d
Reviewed-on: https://go-review.googlesource.com/c/go/+/412394
Reviewed-by: Michael Matloob <matloob@golang.org>
Auto-Submit: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Bryan Mills <bcmills@google.com>
2022-06-15 17:13:55 +00:00
Robert Griesemer 2a78e8afc0 test: add tests for string/[]byte/[]rune conversions
Matches examples in spec section on string conversions.

For #23814.

Change-Id: I08099c27bfdb98735868266f5a42901321b97b56
Reviewed-on: https://go-review.googlesource.com/c/go/+/412095
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
2022-06-15 00:06:24 +00:00
Ian Lance Taylor f9c0264107 net: avoid infinite recursion in Windows Resolver.lookupTXT
For #33097

Change-Id: I6138dc844f0b29b01c78a02efc1e1b1ad719b803
Reviewed-on: https://go-review.googlesource.com/c/go/+/412139
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
2022-06-15 00:03:12 +00:00
Robert Griesemer 0dffda1383 spec: clarify "slice of bytes" and "slice of runes" through examples
The spec section on conversions uses the terms "slice of bytes" and
"slice of runes". While not obviously clear, what is meant are slice
types whose element types are byte or rune types; specifically the
underlying types of the slices' element types must be byte or rune.

Some of this was evident from the examples, but not all of it. Made
this clearer by adding more examples illustrating various permitted
conversions.

Note that the 1.17 compiler did not accept the following conversions:

        string([]myByte{...})
        string([]myRune{...})
        myString([]myByte{...})
        myString([]myRune{...})

(where myByte, myRune, and myString have underlying types of byte,
rune, and string respectively) - it reported an internal error.
But it did accept the inverse conversions:

        []myByte("...")
        []myRune("...")
        []myByte(myString("..."))
        []myRune(myString("..."))

The 1.18 compiler made those conversions symmetric and they are now
permitted in both directions.

The extra examples reflect this reality.

Fixes #23814.

Change-Id: I5a1c200b45ddd0e8c0dc0d11da3a6c39cb2dc848
Reviewed-on: https://go-review.googlesource.com/c/go/+/412094
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2022-06-14 23:44:35 +00:00
Keith Randall c22a6c3b90 reflect: when StructOf overflows computing size/offset, panic
Fixes #52740

Change-Id: I849e585deb77cfcfc1b517be4a171eb29b30c5f3
Reviewed-on: https://go-review.googlesource.com/c/go/+/412214
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Keith Randall <khr@google.com>
2022-06-14 23:23:04 +00:00
Keith Randall e1e66a03a6 cmd/compile,runtime,reflect: move embedded bit from offset to name
Previously we stole a bit from the field offset to encode whether
a struct field was embedded.

Instead, encode that bit in the name field, where we already have
some unused bits to play with. The bit associates naturally with
the name in any case.

This leaves a full uintptr to specify field offsets. This will make
the fix for #52740 cleaner.

Change-Id: I0bfb85564dc26e8c18101bc8b432f332176d7836
Reviewed-on: https://go-review.googlesource.com/c/go/+/412138
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
2022-06-14 23:22:11 +00:00
Ian Lance Taylor cb9bf93078 cmd/go: quote package directory when calling glob
Fixes #53314

Change-Id: I4933b59ee247daec5cf96eb15c52ff54d3ec26a9
Reviewed-on: https://go-review.googlesource.com/c/go/+/411696
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
2022-06-14 21:55:52 +00:00
ag9920 cad477c922 cpu: fix typos in test case
Change-Id: Id6a27d0b3f3fc4181a00569bacc578e72b04ce09
GitHub-Last-Rev: 85c063d1a2
GitHub-Pull-Request: golang/go#53359
Reviewed-on: https://go-review.googlesource.com/c/go/+/411916
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Peter Zhang <binbin36520@gmail.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
2022-06-14 14:49:40 +00:00
Austin Clements c29be2d41c runtime: add HACKING section on nosplit functions
Change-Id: I247874d5c49d2c0d8db2a3d227aa848093551d9b
Reviewed-on: https://go-review.googlesource.com/c/go/+/401759
Reviewed-by: Michael Pratt <mpratt@google.com>
2022-06-13 21:24:54 +00:00
Austin Clements c5be77b687 doc/go1.19: minor edits
For #51400

Change-Id: Ia5289dad84fb63ca6f16a40f076b5ef10511f6b0
Reviewed-on: https://go-review.googlesource.com/c/go/+/411116
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2022-06-13 21:19:00 +00:00
Michael Anthony Knyszek 56bc3098f4 sync: improve linearity test robustness
This change improves the robustness of the locklinear test in the
following ways:

* It removes allocations from the timing, which may be very variable if
  we're unlucky.
* It ensures that goroutines are properly cleaned up before the test
  function returns, reducing the chance that they bleed into repeat
  attempts. It also stops timing before this cleanup.

Fixes #32986.

Change-Id: I3a8096e6922f23d899ad602e2845bdfc639ed742
Reviewed-on: https://go-review.googlesource.com/c/go/+/409894
Reviewed-by: Michael Pratt <mpratt@google.com>
2022-06-13 20:16:01 +00:00
Michael Anthony Knyszek 1fe2810f9c sync: move lock linearity test and treat it like a performance test
This change moves test/locklinear.go into the sync package tests, and
adds a bit of infrastructure since there are other linearity-checking
tests that could benefit from it too. This infrastructure is also
different than what test/locklinear.go does: instead of trying really
hard to get at least one success, we instead treat this like a
performance test and look for a significant difference via a t-test.

This makes the methodology behind the tests more rigorous, and should
reduce flakiness as transient noise should produce an insignificant
result. A follow-up CL does more to make these tests even more robust.

For #32986.

Change-Id: I408c5f643962b70ea708930edb4ac9df1c6123ce
Reviewed-on: https://go-review.googlesource.com/c/go/+/411396
Reviewed-by: Michael Pratt <mpratt@google.com>
2022-06-13 20:15:55 +00:00
Michael Anthony Knyszek 6130461149 internal/testmath: add two-sample Welch's t-test for performance tests
This CL copies code from github.com/aclements/go-moremath/stats and
github.com/aclements/go-moremath/mathx for Welch's t-test. Several
existing tests in the Go repository check performance and scalability,
and this import is part of a move toward a more rigorous measurement of
both.

Note that the copied code is already licensed to Go Authors, so there's
no need to worry about additional licensing considerations.

For #32986.

Change-Id: I058630fab7216d1a589bb182b69fa2231e6f5475
Reviewed-on: https://go-review.googlesource.com/c/go/+/411395
Reviewed-by: Michael Pratt <mpratt@google.com>
2022-06-13 20:15:50 +00:00
Dmitri Shuralyov 24b9039149 doc/go1.19: prefer relative links to other parts of the Go website
The Go website can be served on more than one domain (for example,
go.dev, golang.google.cn, tip.golang.org, localhost:6060, and so on).
Use relative links which work in all contexts.

For #51400.
Updates #53337.

Change-Id: I100938981447537ac242b4045929f6db8a2674c2
Reviewed-on: https://go-review.googlesource.com/c/go/+/411974
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2022-06-13 20:00:24 +00:00
Ian Lance Taylor fbc75dff2f cmd/cgo: remove -fsanitize=hwaddress hardware tags
No test because this isn't support on any of the builders.

Fixes #53285

Change-Id: If8d17bdcdac81a6ce404a35a289bf83f07f02855
Reviewed-on: https://go-review.googlesource.com/c/go/+/411698
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-06-13 19:09:14 +00:00
Robert Griesemer 5ee939b819 spec: clarify behavior of map size hint for make built-in
The spec already states that the precise behavior of the map size
hint provided to the make built-in is implementation-dependent.

Exclude requiring specific run-time behavior for maps.
(The current Go compiler does not panic if the size hint is negative
at run-time.)

Fixes #53219.

Change-Id: I2f3618bf9ba4ed921e18dc4f2273eaa770805bd7
Reviewed-on: https://go-review.googlesource.com/c/go/+/411919
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
2022-06-13 19:06:53 +00:00
Robert Griesemer 4703546a29 spec: add missing optional type arguments after TypeName in syntax
Types may be generic, so each occurrence of a TypeName may be
followed by optional type arguments. Add the missing syntactic
(EBNF) factor.

The syntax of type names followed by type arguments matches the
syntax of operand names followed by type arguments (operands may
also be types, or generic functions, among other things). This
opens the door to factoring out this shared syntax, but it will
also require some adjustments to prose to make it work well.
Leaving for another change.

Fixes #53240.

Change-Id: I15212225c28b27f7621e3ca80dfbd131f6b7eada
Reviewed-on: https://go-review.googlesource.com/c/go/+/411918
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
2022-06-13 19:06:49 +00:00
Damien Neil 2c52465cb3 net: avoid darwin_arm64 bug in TestDialParallelSpuriousConnection
On darwin_arm64, reading from a socket at the same time as the other
end is closing it will occasionally hang for 60 seconds before
returning ECONNRESET. (This is a macOS issue, not a Go issue.)

Work around this condition by adding a brief sleep before the read.

Fixes #37795.

Change-Id: I63f92b91fb297cd66f89cdab707583afd50ab9c5
Reviewed-on: https://go-review.googlesource.com/c/go/+/411155
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Damien Neil <dneil@google.com>
2022-06-13 19:00:03 +00:00
Michael Matloob 9228d7d7d5 doc/go1.19: add a release note for module indexing
Change-Id: I264499d955049c5b7c4bdda7ce23cf7fe7031402
Reviewed-on: https://go-review.googlesource.com/c/go/+/411497
Reviewed-by: Michael Matloob <matloob@golang.org>
Run-TryBot: Michael Matloob <matloob@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
2022-06-13 18:56:11 +00:00
Cuong Manh Le 7eeec1f6e4 cmd/compile: fix missing dict pass for type assertions
For type assertions, if either src or dst type has shape, we must
convert them to dynamic type assertions.

Fixes #53309

Change-Id: Ia3362fa67c011febcbdb5b26f856d081b5c366de
Reviewed-on: https://go-review.googlesource.com/c/go/+/411617
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
2022-06-13 16:53:11 +00:00