1
0
mirror of https://github.com/golang/go synced 2024-11-17 12:04:43 -07:00
Commit Graph

50760 Commits

Author SHA1 Message Date
Daniel Martí
9678f79414 cmd/go: work out VCS information once per repository
We need VCS status information for each main package we load.
If two main packages are under the same VCS repository,
we can reuse that information to avoid duplicating work.

For instance, the kubernetes holds 51 main packages in its root module,
meaning that "go list ./..." repeated the same git calls 51 times.
Instead, use a global par.Cache to deduplicate that work.

Below are the numbers on kubernetes 5eb584d1cb6917,
via "benchcmd -n 8 KubernetesListPackages go list ./...":

	name                    old time/op         new time/op         delta
	KubernetesListPackages          8.91s ± 0%          3.33s ± 1%  -62.61%  (p=0.000 n=7+8)

	name                    old user-time/op    new user-time/op    delta
	KubernetesListPackages          11.2s ± 1%           8.1s ± 2%  -27.50%  (p=0.000 n=7+8)

	name                    old sys-time/op     new sys-time/op     delta
	KubernetesListPackages          8.02s ± 0%          1.67s ± 6%  -79.21%  (p=0.001 n=6+8)

	name                    old peak-RSS-bytes  new peak-RSS-bytes  delta
	KubernetesListPackages          127MB ± 2%          123MB ± 7%     ~     (p=0.328 n=8+8)

Fixes #49582.

Change-Id: Ib7ef5dc7a35c83a11e209441f5d6f3b8da068259
Reviewed-on: https://go-review.googlesource.com/c/go/+/365394
Trust: Daniel Martí <mvdan@mvdan.cc>
Trust: Dominik Honnef <dominik@honnef.co>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
2021-11-22 23:09:35 +00:00
Robert Griesemer
0244343088 spec: fix Swap example (correctly swap type arguments and parameters)
Thanks to @danscales for noticing the mistake.

Change-Id: I547ee80a78419765b82d39d7b34dc8d3bf962c35
Reviewed-on: https://go-review.googlesource.com/c/go/+/366215
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Dan Scales <danscales@google.com>
2021-11-22 23:00:32 +00:00
Robert Griesemer
7456b94853 doc/go1.18: document new overflow error for some untyped arguments to print/ln
Fixes #49216.
For #47694.

Change-Id: Ib129d790c382ddcc9677d87db4ca827b7159856a
Reviewed-on: https://go-review.googlesource.com/c/go/+/366275
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-11-22 22:36:03 +00:00
Robert Griesemer
7fbe2f4cc8 doc/go1.18: document compiler change for "declared but not used" errors
Fixes #49214.
For #47694.

Change-Id: Iba68ed17bfd81890309b6a6732087f87a03e1350
Reviewed-on: https://go-review.googlesource.com/c/go/+/366274
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-11-22 22:35:57 +00:00
Ryan Leung
11972353a6 cmd/go: allow a package that ends with _test having an internal test package
Fixes #45477

Change-Id: I2f1ed281515ec40d31fd07ce9f4901777691bfa7
GitHub-Last-Rev: 7894d9400c
GitHub-Pull-Request: golang/go#49673
Reviewed-on: https://go-review.googlesource.com/c/go/+/365534
Trust: Heschi Kreinick <heschi@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
2021-11-22 22:35:55 +00:00
Michael Matloob
100d7ea50d cmd/go: correct an inaccuracy in the 'go help work' docs
Change-Id: If2c6586b5ad212214b8041f8768fe7d26b877207
Reviewed-on: https://go-review.googlesource.com/c/go/+/366314
Trust: Michael Matloob <matloob@golang.org>
Run-TryBot: Michael Matloob <matloob@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2021-11-22 21:52:20 +00:00
Bryan C. Mills
f13fcd9e68 runtime: execute TestSpuriousWakeupsNeverHangSemasleep in parallel
This test spends most of its time sleeping and waiting on a subprocess
to sleep. It seems like a prime candidate to run in parallel, although
we may need to relax its hard-coded 2s timeout on the sleep(1)
subprocess.

For #48770

Change-Id: I4e839739fe82446615f9894c1904c87e5f3cf386
Reviewed-on: https://go-review.googlesource.com/c/go/+/366256
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
2021-11-22 20:34:40 +00:00
Bryan C. Mills
17aa212799 runtime: in TestSpuriousWakeupsNeverHangSemasleep, wait for the runtime to register handlers
According to https://man7.org/linux/man-pages/man7/signal.7.html, the
default behavior of SIGIO is to terminate the program. The Go runtime
changes that behavior with its own signal handler, so the program will
terminate if we send the signal before the runtime has finished
setting up.

Fixes #49727

Change-Id: I65db66f5176831c8d7454eebc0138d825c68e100
Reviewed-on: https://go-review.googlesource.com/c/go/+/366255
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-11-22 20:34:30 +00:00
Robert Findley
773f43b356 go/types, types2: substitute for type parameters in signatures when
comparing type identity

Generic signatures should be considered identical modulo type parameter
renaming. Update Identical to reflect this, by substituting type
parameters.

Fixes #49722

Change-Id: I33743768c72d8aa59c29bf72fcbabc5974f0b805
Reviewed-on: https://go-review.googlesource.com/c/go/+/366178
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
2021-11-22 20:32:29 +00:00
Bryan C. Mills
189b4a2f42 cmd/go: forward the MallocNanoZone variable to script tests
For #49138
Fixes #49723

Change-Id: Ia93130fdc042a1e2107be95cccd7e7eeaa909a87
Reviewed-on: https://go-review.googlesource.com/c/go/+/366254
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-11-22 19:49:38 +00:00
Bharath Kumar Uppala
8f559bcb46 testing: mention that TB also covers the new type F
Fixes #48146

Change-Id: I7c667a7915db81558514bc9fada6898c565eb0fd
Reviewed-on: https://go-review.googlesource.com/c/go/+/365894
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
Reviewed-by: Katie Hockman <katie@golang.org>
Run-TryBot: Emmanuel Odeke <emmanuel@orijtech.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Katie Hockman <katie@golang.org>
Trust: Ian Lance Taylor <iant@golang.org>
2021-11-22 19:43:16 +00:00
Ian Lance Taylor
81031300a7 misc/cgo/testcshared: skip TestGo2C2Go on Windows
For #27019
Fixes #49457

Change-Id: I398abb7b555196ced34a6dd04b68195bf8bbdd38
Reviewed-on: https://go-review.googlesource.com/c/go/+/365994
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Patrik Nyblom <pnyb@google.com>
2021-11-22 18:57:50 +00:00
Bryan C. Mills
5a3d871831 net: allow more generous slop in Fluctuation tests
It appears that at least the OpenBSD kernel gets sloppier the longer
the timeout we give it, up to an observed overhead of around 25%.
Let's give it a little more than that (33%) in the comparison, and
also increase the growth curve to match the actual observed times
instead of exponential initial growth.

Fixes #36108

Change-Id: Id3e54559b7c45b7c8bc0ca07dce74ca60e77e7ed
Reviewed-on: https://go-review.googlesource.com/c/go/+/366176
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-11-22 18:57:33 +00:00
Bryan C. Mills
2d7ae3fbd8 net: diagnose unexpected nils in TestUnixAndUnixpacketServer
For #34611

Change-Id: I31894d58498b2c290ecceccfc004bc817f8969c9
Reviewed-on: https://go-review.googlesource.com/c/go/+/366114
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-11-22 18:55:55 +00:00
Bryan C. Mills
9e94cc3666 misc/cgo/test: remove unnecessary forward declaration
This test otherwise fails to build on windows/arm64 as of CL 364774
due to a warning (promoted to an error) about a mismatched dllexport
attribute. Fortunately, it seems not to need the forward-declared
function in this file anyway.

Updates #49633
Updates #49721

Change-Id: Ia4698b85077d0718a55d2cc667a7950f1d8e50ab
Reviewed-on: https://go-review.googlesource.com/c/go/+/366075
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-11-22 18:50:19 +00:00
Michael Matloob
cd0bf38966 cmd/go: report a helpful error when there are no modules in workspace
The current error message that no go.mod files were found is not
helpful, especially when a go.mod file exists in the current directory.

Fixes #49594

Change-Id: I750475ce8654eeb3e0a2857d5a2de1a9c6ede415
Reviewed-on: https://go-review.googlesource.com/c/go/+/365319
Trust: Michael Matloob <matloob@golang.org>
Run-TryBot: Michael Matloob <matloob@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2021-11-22 16:53:57 +00:00
Bryan C. Mills
6275b54a2a Revert "cmd/go: temporarily skip TestScript/test_fuzz_minimize"
This reverts CL 365315.

Reason for revert: test may have been fixed by intervening changes.

Change-Id: I110948d53a789527edf471f1637eadbd98a1fc5a
Reviewed-on: https://go-review.googlesource.com/c/go/+/366074
Trust: Bryan C. Mills <bcmills@google.com>
Trust: Katie Hockman <katie@golang.org>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Katie Hockman <katie@golang.org>
2021-11-22 16:15:36 +00:00
Michael Matloob
e73c6c8808 cmd/go: fix go work sync when there are zero workspace modules
go work sync panics when there are no workspace modules. This is
because the code that set the pruning mode only did so with modules
present. This change changes pruningForGoVersion to properly return
workspace pruning in workspace mode to prevent that. Another weird
scenario can happen when there are no workspace modules, but the
command-line-arguments module is created by default. Check for that
when iterating over the workspace modules to avoid trying to find the
nonexistant go.mod file for that modules.

Fixes #49591

Change-Id: Iee8bc92a8aaf9c440f88fe4f9ca908a8d461cd36
Reviewed-on: https://go-review.googlesource.com/c/go/+/365234
Trust: Michael Matloob <matloob@golang.org>
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Michael Matloob <matloob@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2021-11-22 15:54:11 +00:00
zhouguangyuan
b2aa1380d9 A+C: add Zhou Guangyuan (individual CLA)
Change-Id: I34b966b2f3de93a1d086be3dea5ebc6c60cf1eec
Reviewed-on: https://go-review.googlesource.com/c/go/+/365754
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
2021-11-22 12:30:26 +00:00
zhouguangyuan
ffb6c79828 go/types,types2: use allInteger to check type for shifted operand
Fixes: #49705

Change-Id: I35a1c5f29b57f3facc5e89d33a8dec88e0ff4afa
Reviewed-on: https://go-review.googlesource.com/c/go/+/365895
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
Trust: Emmanuel Odeke <emmanuel@orijtech.com>
2021-11-22 12:29:44 +00:00
Robert Griesemer
e30ebaab0b spec: add section on the structure of interfaces
This change introduces the notion of a structural interface
and its corresponding structural type.

Change-Id: Ib5442dfd04cb5950b4467428cae51849f8922272
Reviewed-on: https://go-review.googlesource.com/c/go/+/365474
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-11-22 04:27:29 +00:00
Robert Griesemer
a287c4aa38 spec: add type parameter types
- add section on type parameters
- added two sections on the scope of type parameters
- expanded general section on types accordingly
- introduced the notion of a named type which will
  help in simplifying various rules (subsequent CLs)

Change-Id: I49c1ed7d6d4f951d751f0a3ca5dfb637e49829f2
Reviewed-on: https://go-review.googlesource.com/c/go/+/365414
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-11-22 03:24:07 +00:00
Robert Griesemer
0c3b4a358a spec: add type parameter lists
Change-Id: I29e9188a0fa1326c2755a9b86aeb47feaa8019be
Reviewed-on: https://go-review.googlesource.com/c/go/+/365274
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-11-22 03:24:01 +00:00
Dan Scales
91abe4be0e test: fix -G=0 mode for longtest builder
For -G=3 for test using 'any'.

Change-Id: Ia37ee944a38be4f4330e62ad187f10f2d42e41bd
Reviewed-on: https://go-review.googlesource.com/c/go/+/365839
Trust: Dan Scales <danscales@google.com>
Run-TryBot: Dan Scales <danscales@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
2021-11-20 08:47:36 +00:00
Dan Scales
be18cd51de cmd/compile: ensure generic function is loaded when it needs to be re-exported
In the case where we need to re-export a generic function/method from
another package in the export data of the current package, make sure it
is loaded before trying to write it out.

Fixed #49667

Change-Id: I177754bb762689f34cf5c8ad246d43f1cdbbf195
Reviewed-on: https://go-review.googlesource.com/c/go/+/365837
Trust: Dan Scales <danscales@google.com>
Run-TryBot: Dan Scales <danscales@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2021-11-20 01:00:16 +00:00
Alan Donovan
d2f4c935f2 runtime/cgo: add example of Handle with void* parameter
Fixes #49633

Change-Id: I12ca350f7dd6bfc8753a4a169f29b89ef219b035
Reviewed-on: https://go-review.googlesource.com/c/go/+/364774
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Bryan C. Mills <bcmills@google.com>
2021-11-20 00:37:28 +00:00
Cherry Mui
57aba325c8 cmd/link: exit early when -d is used on libc platforms
On platforms where we use libc for syscalls, we dynamically link
with libc and therefore dynamic linking cannot be disabled. Exit
early when -d is specified.

Update #42459.

Change-Id: I05abfe111df723b5ee512ceafef734e3804dd0a8
Reviewed-on: https://go-review.googlesource.com/c/go/+/365658
Trust: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
2021-11-20 00:32:49 +00:00
Matthew Dempsky
b31dda8a2a cmd/compile: handle any as alias like byte and rune
`types.Types[types.TINTER]` is already used for `interface{}`, so we
can conveniently just extend the existing logic that substitutes
`byte` and `rune` with `uint8` and `int32` to also substitute `any`.

Fixes #49665.

Change-Id: I1ab1954699934150aab899b35037d5611c8ca47e
Reviewed-on: https://go-review.googlesource.com/c/go/+/365354
Trust: Matthew Dempsky <mdempsky@google.com>
Trust: Dan Scales <danscales@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Dan Scales <danscales@google.com>
2021-11-19 22:35:28 +00:00
Bryan C. Mills
5e774b0f5c net: simplify deadline fluctuation tests
These tests were checking for fairly narrow timing windows, but were
running in parallel and heavily dependent on timer and goroutine
scheduling. This change eliminates unnecessary goroutines, runs the
tests sequentially (dramatically shortening the timeouts to reduce the
penalty of doing so), and uses timestamp comparison instead of
background timers to hopefully gain some robustness from monotonic
timestamps.

Many of the other tests from this package would benefit from similar
simplifications, which we can apply if and when we notice flaky
failures or want to improve the latency of running the test.

Fixes #36108

Change-Id: I17d8af7d2eefb1ec14fe0d9d891142a39599a562
Reviewed-on: https://go-review.googlesource.com/c/go/+/365334
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
2021-11-19 21:59:14 +00:00
Roland Shoemaker
6027b2183d crypto/x509/internal/macos: use APIs available on ios
Use SecCertificateCopyData instead of SecItemExport, which is only
available on macOS.

Updates #49616

Change-Id: Ieda33894930d23c6dab6112ee18120f8a440083b
Reviewed-on: https://go-review.googlesource.com/c/go/+/364554
Trust: Roland Shoemaker <roland@golang.org>
Run-TryBot: Roland Shoemaker <roland@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
2021-11-19 21:57:03 +00:00
Cherry Mui
ba9f0f6665 doc/go1.18: mention register ABI on ARM64 and PPC64
For #47694.

Change-Id: Ide378f4a34587027c3d84fed2126c5b9bd8f7287
Reviewed-on: https://go-review.googlesource.com/c/go/+/363694
Trust: Cherry Mui <cherryyz@google.com>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
2021-11-19 21:41:33 +00:00
Jeremy Faller
aec5c2eed6 [go] doc: document speedups to Trim[|Left|Right]
CL: #332771

Updates: #47694
Change-Id: I8c729084b7a8745ec73f87ef3c469edbd596ddb4
Reviewed-on: https://go-review.googlesource.com/c/go/+/365318
Trust: Jeremy Faller <jeremy@golang.org>
Run-TryBot: Jeremy Faller <jeremy@golang.org>
Reviewed-by: Joe Tsai <joetsai@digital-static.net>
2021-11-19 21:36:24 +00:00
Jeremy Faller
0f75a9ecdf [go] doc: add new bufio functionality
cl/345570
cl/345569

Updates: #47694
Change-Id: I170af16d5fc9f022d3d29ed0772cfc3d02b8bbcf
Reviewed-on: https://go-review.googlesource.com/c/go/+/365317
Trust: Jeremy Faller <jeremy@golang.org>
Run-TryBot: Jeremy Faller <jeremy@golang.org>
Reviewed-by: Joe Tsai <joetsai@digital-static.net>
2021-11-19 21:36:17 +00:00
Bryan C. Mills
ac0da79a67 cmd/go: temporarily skip TestScript/test_fuzz_minimize
This test is failing on the longtest builders.
Adding a skip temporarily until it can be diagnosed and fixed.

For #49685

Change-Id: I0ceaf009f5029d1ad6f667f7cfee1f1605737bf3
Reviewed-on: https://go-review.googlesource.com/c/go/+/365315
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Roland Shoemaker <roland@golang.org>
2021-11-19 18:35:56 +00:00
Roland Shoemaker
80cb59c0c1 internal/fuzz: fix chunk swap mutator
When swapping two chunks of bytes in a slice, don't pick chunks which
extend beyond the end of the slice. Also don't pick chunks which
intersect with each other.

Fixes #49047

Change-Id: I070eb1888d05ae849ec6122d01c40c45e602019f
Reviewed-on: https://go-review.googlesource.com/c/go/+/365175
Trust: Roland Shoemaker <roland@golang.org>
Trust: Bryan C. Mills <bcmills@google.com>
Trust: Katie Hockman <katie@golang.org>
Run-TryBot: Roland Shoemaker <roland@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Katie Hockman <katie@golang.org>
2021-11-19 18:23:43 +00:00
Roland Shoemaker
a94409660d internal/fuzz: compute correct number of mutations
When reconstructing inputs, we miscalculated the number of mutations
that needed to be applied. If the count%chainedMutation == 0 we would
apply 0 mutations, when we should actually be applying chainedMutation
mutations, due to how count is incremented.

Fixes #49047

Change-Id: I76773bff0afd6dfd40deafc317be095da995ecc5
Reviewed-on: https://go-review.googlesource.com/c/go/+/365294
Trust: Roland Shoemaker <roland@golang.org>
Trust: Katie Hockman <katie@golang.org>
Run-TryBot: Roland Shoemaker <roland@golang.org>
Run-TryBot: Katie Hockman <katie@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Katie Hockman <katie@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
2021-11-19 17:42:26 +00:00
Dan Scales
e8cda0a6c9 cmd/compile: don't run ComputeAddrTaken on imported generic functions
It causes a crash because of the unexpected XDOT operation. It's not
needed, since we will run ComputeAddrTaken() on function instantiations
after stenciling. And it's not always correct, since we may not be able
to distinguish between a array and a slice, if a type is dependent on a
type param.

However, we do need to call ComputeAddrTaken on instantiations created
during inlining, since that is after the main ComputeAddrTaken pass.

Fixes #49659

Change-Id: I0bb610cf11f14e4aa9068f6ca2a012337b069c79
Reviewed-on: https://go-review.googlesource.com/c/go/+/365214
Trust: Dan Scales <danscales@google.com>
Run-TryBot: Dan Scales <danscales@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2021-11-19 00:05:59 +00:00
Ian Lance Taylor
2375b6edf3 cmd/go/internal/test: add dep from test pkg build to real pkg build
If we have to build a test package, and if the full set of packages
being tested imports the regular package somewhere, then make building
the test package depend on building the regular package.  That way if
the regular package fails to build we only report the error once.

Fixes #44624

Change-Id: Ic7d66d8fec9c4688d369153a4b21194989f8def3
Reviewed-on: https://go-review.googlesource.com/c/go/+/365215
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2021-11-18 22:40:42 +00:00
Robert Griesemer
24898d6948 spec: various clarifications/fixes for method sets and interfaces
- fixed a typo in the method set section
- express in the syntax that ~T denotes an underlying type
- be more precise when talking about types vs type terms
- refer to "unions" rather than "union expressions"
- make it clear in the spec title that this is WIP

Change-Id: I9b2c4b1f77bc50dd574ed6893bedd40529c320fc
Reviewed-on: https://go-review.googlesource.com/c/go/+/365154
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-11-18 20:11:45 +00:00
Mikhail Faraponov
c4aae23d64 net: optimize ctxDone usage
Change-Id: I6db6fcf0ebe36da77af062114b5264405f15fee8
GitHub-Last-Rev: 80a97262bb
GitHub-Pull-Request: golang/go#49620
Reviewed-on: https://go-review.googlesource.com/c/go/+/364514
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
Trust: Damien Neil <dneil@google.com>
2021-11-18 19:16:38 +00:00
Robert Findley
feb330dcdd go/types: add test for imported constraints pre-1.18
This is a port of CL 363834 from types2 to go/types.

Change-Id: I32583ead4bce626e0761f4c327678050404a15c9
Reviewed-on: https://go-review.googlesource.com/c/go/+/364937
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2021-11-18 16:18:50 +00:00
Robert Findley
8d6c4e07fd go/types: use "implements" rather than "satisfies" in error messages
This is a port of CL 363839 from types2 to go/types.

Change-Id: I9efe412a6a602fd55170d1ee89c8e1513037c926
Reviewed-on: https://go-review.googlesource.com/c/go/+/364936
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2021-11-18 14:08:30 +00:00
Robert Findley
5d5f2b1e20 go/types: remove unneccesary tests in implements and lookup
This is a port of CL 363838 from types2 to go/types.

Change-Id: I03f4da86ea38209a73f567cc5d84e7afd08883ac
Reviewed-on: https://go-review.googlesource.com/c/go/+/364935
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2021-11-18 14:08:10 +00:00
Robert Findley
9ea939be60 go/types: implement Checker.implements
This is a port of CL 363837 from types2 to go/types. As usual, test
error messages had to be repositioned on the operand.

Change-Id: I2b53fae7aa30f9147f8d05f75b0ab252338320bb
Reviewed-on: https://go-review.googlesource.com/c/go/+/364934
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2021-11-18 14:08:03 +00:00
Than McIntosh
14c3f749be cmd/link: relocate dwarf examiner helper to separate package
The linker DWARF test includes an "examiner" helper type (with
associated methods) that is used to help linker DWARF tests read DWARF
info in a higher level and more structured way than just raw
debug/dwarf operations. This patch extracts out "examiner" and
relocates it to a separate package, so that it can be used in other
package tests as well, if need be.

Change-Id: Iec66061e2719ee698c12d8fa17b11698442b336d
Reviewed-on: https://go-review.googlesource.com/c/go/+/364036
Trust: Than McIntosh <thanm@google.com>
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2021-11-18 14:00:00 +00:00
Robert Griesemer
f6647f2e3b spec: generalize method sets and interface types to type sets
This is the first of several CLs that update the existing
Go 1.17 spec for type parameters.

This CL updates the section on method sets and interface types.
It also adds "any", "comparable" to the list of predeclared
identifiers.

Change-Id: I0ce25dc02791c33150c0d949528512610faf3eab
Reviewed-on: https://go-review.googlesource.com/c/go/+/362999
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-11-18 06:05:29 +00:00
Keith Randall
d8f7a64519 test: make issue8606b test more robust
Use actual unmapped memory instead of small integers to make
pointers that will fault when accessed.

Fixes #49562

Change-Id: I2c60c97cf80494dd962a07d10cfeaff6a00f4f8e
Reviewed-on: https://go-review.googlesource.com/c/go/+/364914
Trust: Keith Randall <khr@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2021-11-18 02:53:02 +00:00
Robert Findley
f1cc529429 go/types: better position for invalid slice indices error
This is a port of CL 363671 from types2 to go/types. Also adjust the
error message to match types2 ("invalid" vs "swapped").

Change-Id: I662a73c915814fea14bfcb1ebde0fbf39589f022
Reviewed-on: https://go-review.googlesource.com/c/go/+/364902
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2021-11-18 02:19:50 +00:00
Robert Findley
72f0976ac4 go/types: better position for "3-index slice of string" error
This is a port of CL 363670 from types2 to go/types.

Change-Id: I2ac3a5f86bb4eafddd2854e193083b2b737e29b6
Reviewed-on: https://go-review.googlesource.com/c/go/+/364901
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2021-11-18 02:18:12 +00:00
Robert Findley
3404ee3e86 go/types: move match function to end of file (cleanup)
This is a port of CL 363669 from types2 to go/types.

Change-Id: Id1f375ff5708dab528144e30ce16d24d6fdf7d00
Reviewed-on: https://go-review.googlesource.com/c/go/+/364900
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2021-11-18 02:17:34 +00:00