]> Cypherpunks repositories - gostls13.git/log
gostls13.git
3 years agogo/types: ensure that constructed type parameters are immutable
Robert Findley [Mon, 29 Nov 2021 19:52:54 +0000 (14:52 -0500)]
go/types: ensure that constructed type parameters are immutable

TypeParam.iface may mutate TypeParam.bound in the event that the type
parameter bound is not an interface.

Ensure that iface() is called before the type-checking pass returns, and
before NewTypeParam or TypeParam.SetConstraint exits.

Fixes #49788

Change-Id: I72279acf5f0223161671c04887bc2c3df4158927
Reviewed-on: https://go-review.googlesource.com/c/go/+/367614
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>
3 years agogo/types: consider structural restrictions in Implements
Robert Findley [Mon, 29 Nov 2021 17:21:46 +0000 (12:21 -0500)]
go/types: consider structural restrictions in Implements

Fixes #49786

Change-Id: I4559d013399deda48bcb97aef3427ecf87a3ef26
Reviewed-on: https://go-review.googlesource.com/c/go/+/367515
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>
3 years agogo/types: better error message for missing ~ in constraint
Robert Griesemer [Fri, 26 Nov 2021 21:27:12 +0000 (13:27 -0800)]
go/types: better error message for missing ~ in constraint

This is a port of CL 366758 from types2 to go/types.

For #49179.

Change-Id: I7e1c6ffb392d5c535cf901004b7acbe8c3be9b0f
Reviewed-on: https://go-review.googlesource.com/c/go/+/367199
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
3 years agogo/types: better error position for instantiation failure
Robert Griesemer [Fri, 26 Nov 2021 21:14:01 +0000 (13:14 -0800)]
go/types: better error position for instantiation failure

This is a port of CL 366757 from types2 to go/types,
adjusted for the different handling of index expressions
in go/types.

For #49179.

Change-Id: Ic859eb09683134d055e28c8e0cb1f3814a87dc5c
Reviewed-on: https://go-review.googlesource.com/c/go/+/367198
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
3 years agogo/types: produce empty type set for invalid ~T
Robert Griesemer [Fri, 26 Nov 2021 20:43:06 +0000 (12:43 -0800)]
go/types: produce empty type set for invalid ~T

This is a clean port of CL 366278 from types2 to go/types.

For #49739.

Change-Id: I2e2cb739c02fcc07e012499c7b65b13b057875ea
Reviewed-on: https://go-review.googlesource.com/c/go/+/367197
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
3 years agogo/types: report types for mismatched call and return statements
Robert Griesemer [Thu, 25 Nov 2021 00:48:00 +0000 (16:48 -0800)]
go/types: report types for mismatched call and return statements

This is a port of CL 364874 from types2 to go/types with various
adjustments:

- the error position for "not enough arguments" in calls is the
  closing ) rather than the position of the last provided argument

- the ERROR comments in tests are positioned accordingly

- the reg. expression for matching error strings accepts newlines
  for the . pattern (added s flag)

For #48834.
For #48835.

Change-Id: I64362ecf605bcf9d89b8dc121432e0131bd5da1b
Reviewed-on: https://go-review.googlesource.com/c/go/+/367196
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
3 years agogo/types: restore original assignment error messages
Robert Griesemer [Thu, 25 Nov 2021 00:18:57 +0000 (16:18 -0800)]
go/types: restore original assignment error messages

This is the missing portion of the port of CL 351669
from types2 to go/types, now that we have a local flag
to control for compiler error messages.

Mostly a clean port but for adjustments to error reporting
which requires error codes in go/types.

Prerequisite for port of CL 364874.

Change-Id: I5fc8c83003e4396351f42e9adb08f4ebc8a05653
Reviewed-on: https://go-review.googlesource.com/c/go/+/367195
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
3 years agoruntime: fix preemption sensitivity in TestTinyAllocIssue37262
Austin Clements [Mon, 22 Nov 2021 20:33:01 +0000 (15:33 -0500)]
runtime: fix preemption sensitivity in TestTinyAllocIssue37262

TestTinyAllocIssue37262 assumes that all of its allocations will come
from the same tiny allocator (that is, the same P), and that nothing
else will allocate from that tiny allocator while it's running. It can
fail incorrectly if these assumptions aren't met.

Fix this potential test flakiness by disabling preemption during this
test.

As far as I know, this has never happened on the builders. It was
found by mayMoreStackPreempt.

Change-Id: I59f993e0bdbf46a9add842d0e278415422c3f804
Reviewed-on: https://go-review.googlesource.com/c/go/+/366994
Trust: Austin Clements <austin@google.com>
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
3 years agospec: adjust section on package unsafe for type parameters
Robert Griesemer [Sun, 28 Nov 2021 23:25:09 +0000 (15:25 -0800)]
spec: adjust section on package unsafe for type parameters

Change-Id: I562d4648756e710020ee491f3801896563a89baa
Reviewed-on: https://go-review.googlesource.com/c/go/+/367395
Trust: Robert Griesemer <gri@golang.org>
Trust: Dan Scales <danscales@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
3 years agospec: rules for index expressions, len, cap, with type parameter types
Robert Griesemer [Wed, 24 Nov 2021 04:24:40 +0000 (20:24 -0800)]
spec: rules for index expressions, len, cap, with type parameter types

We want to support some special cases for index expressions, len, and
cap on operands of type parameters (such as indexing a value constrained
by byte slices and strings), hence the extra rules.

Change-Id: I4a07dc7e64bb47361b021d606c52eae1784d5430
Reviewed-on: https://go-review.googlesource.com/c/go/+/366814
Trust: Robert Griesemer <gri@golang.org>
Trust: Dan Scales <danscales@google.com>
Reviewed-by: Dan Scales <danscales@google.com>
3 years agospec: corrections to various sections
Robert Griesemer [Sun, 28 Nov 2021 22:17:11 +0000 (14:17 -0800)]
spec: corrections to various sections

- fix definition of "specific types" and add more examples
- state that a parameterized function must be instantiated
  when used as a function value
- remove duplicate word ("can can" -> "can")

Thanks to @danscales for finding these.

Change-Id: Ideb41efc35a3e67694d3bc97e462454feae37c44
Reviewed-on: https://go-review.googlesource.com/c/go/+/367394
Trust: Robert Griesemer <gri@golang.org>
Trust: Dan Scales <danscales@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Dan Scales <danscales@google.com>
3 years agovendor: update golang.org/x/net to tip
Ian Lance Taylor [Tue, 23 Nov 2021 20:34:04 +0000 (12:34 -0800)]
vendor: update golang.org/x/net to tip

This brings in a fix for OpenBSD that lets it correctly gather network
interface information.

For #42064

Change-Id: Ib88fd2f494bb2ee86fd2725d8375b2df1404c4ca
Reviewed-on: https://go-review.googlesource.com/c/go/+/366756
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>

3 years agodoc/go1.18: use <code> instead of <pre> for target specification
Jason A. Donenfeld [Mon, 29 Nov 2021 16:05:41 +0000 (11:05 -0500)]
doc/go1.18: use <code> instead of <pre> for target specification

For #47694.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Change-Id: I38c2fd9b57fbbacf220a2bc679f67e2dfdcc7cb1
Reviewed-on: https://go-review.googlesource.com/c/go/+/367514
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
3 years agocmd/link: merge note sections into one segment
Meng Zhuo [Tue, 30 Mar 2021 11:58:35 +0000 (19:58 +0800)]
cmd/link: merge note sections into one segment

The ld from binutils merges note sections into one PT_NOTE
segment.
We should do that for consistency with binutils.

Change-Id: I45703525c720972d49c36c4f10ac47d1628b5698
Reviewed-on: https://go-review.googlesource.com/c/go/+/265957
Trust: Meng Zhuo <mzh@golangcn.org>
Trust: Emmanuel Odeke <emmanuel@orijtech.com>
Run-TryBot: Meng Zhuo <mzh@golangcn.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
3 years agoA+C: add Bharath Kumar Uppala (individual CLA)
Bharath Kumar Uppala [Thu, 25 Nov 2021 04:39:47 +0000 (10:09 +0530)]
A+C: add Bharath Kumar Uppala (individual CLA)

Change-Id: I4943e943892bd29bca2afafddb62f3060bc153e9
Reviewed-on: https://go-review.googlesource.com/c/go/+/367074
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Meng Zhuo <mzh@golangcn.org>
3 years agospec: fix link for instantiations
syumai [Sat, 27 Nov 2021 11:16:57 +0000 (11:16 +0000)]
spec: fix link for instantiations

This change corrects the link `Instantiantions` to `Instantiations` in the spec.

Change-Id: Ib0ed03420ae401d20af1ea723c5487018b2f462d
GitHub-Last-Rev: b84316c818b4aba022362fd09fac0d2b85da1a81
GitHub-Pull-Request: golang/go#49816
Reviewed-on: https://go-review.googlesource.com/c/go/+/367274
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
3 years agocmd/go: fix a typo in mod_lazy_new_import.txt
tangxi666 [Sat, 27 Nov 2021 05:20:05 +0000 (05:20 +0000)]
cmd/go: fix a typo in mod_lazy_new_import.txt

x/y -> a/y

Change-Id: If24970623731098bb72345b8f4c8518b563bbec8
GitHub-Last-Rev: 8a35dddbc155d97f03c08c06d945596584bc2e6d
GitHub-Pull-Request: golang/go#49813
Reviewed-on: https://go-review.googlesource.com/c/go/+/367202
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>

3 years agotesting: simplify fuzzResult.String to avoid unnecessarily using fmt.Sprintf
sivchari [Sat, 27 Nov 2021 23:02:16 +0000 (23:02 +0000)]
testing: simplify fuzzResult.String to avoid unnecessarily using fmt.Sprintf

Change-Id: I16b6bfb6b0f02672c894b20845aa14d8dd1979b4
GitHub-Last-Rev: 75ab90123a8a5ad42e96795b756d3a9e898aaa06
GitHub-Pull-Request: golang/go#49819
Reviewed-on: https://go-review.googlesource.com/c/go/+/367314
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Emmanuel Odeke <emmanuel@orijtech.com>
TryBot-Result: Go Bot <gobot@golang.org>

3 years agodoc: go1.18 release notes for CLs 323318/332771
Carlo Alberto Ferraris [Mon, 22 Nov 2021 01:26:48 +0000 (01:26 +0000)]
doc: go1.18 release notes for CLs 323318/332771

Updates #47694

Change-Id: Ib76737996a701906117e096eb6d05b388576a874
GitHub-Last-Rev: 05b96499651bb4e90617460a72f1df9f2c8615f3
GitHub-Pull-Request: golang/go#49588
Reviewed-on: https://go-review.googlesource.com/c/go/+/363840
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Trust: Daniel Martí <mvdan@mvdan.cc>

3 years agocmd/go/internal: gofmt after CL 355010
Tobias Klauser [Thu, 25 Nov 2021 11:22:36 +0000 (12:22 +0100)]
cmd/go/internal: gofmt after CL 355010

Change-Id: I25902cc4e7a3d2a78b467825b723cd72b310e2a3
Reviewed-on: https://go-review.googlesource.com/c/go/+/367094
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
3 years agobufio: mention that panic at slicing means underlying reader is broken
Keith Randall [Fri, 26 Nov 2021 15:36:09 +0000 (07:36 -0800)]
bufio: mention that panic at slicing means underlying reader is broken

Fixes #49795

Change-Id: I2b4fd14f0ed36b643522559bebf5ce52b1d7b304
Reviewed-on: https://go-review.googlesource.com/c/go/+/367214
Trust: Keith Randall <khr@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
3 years agocmd/doc: fix "builtin" package parsing
Roi Martin [Thu, 25 Nov 2021 12:47:39 +0000 (13:47 +0100)]
cmd/doc: fix "builtin" package parsing

As stated in the code, "The builtin package needs special treatment: its
symbols are lower case but we want to see them, always". Thus, cmd/doc
forces the -u flag if the package being queried is called "builtin".
However, this happens after having already parsed the package. This
CL forces the -u flag just after parsing the command arguments and
before parsing any package.

Fixes #49796.

Change-Id: If690a900c7cfd1700feecb9529bd4344c3c249d1
Reviewed-on: https://go-review.googlesource.com/c/go/+/367134
Reviewed-by: Rob Pike <r@golang.org>
Run-TryBot: Rob Pike <r@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Emmanuel Odeke <emmanuel@orijtech.com>

3 years agodoc/go1.18: document non-cooperative preemption on windows/arm{,64}
Jason A. Donenfeld [Thu, 25 Nov 2021 12:05:58 +0000 (13:05 +0100)]
doc/go1.18: document non-cooperative preemption on windows/arm{,64}

For #47694.
Updates #49759.

Change-Id: I7accd81b8ea6c31e4a2b5e155cf93fe9c447813b
Reviewed-on: https://go-review.googlesource.com/c/go/+/367095
Trust: Jason A. Donenfeld <Jason@zx2c4.com>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
3 years agotest/fixedbugs: fix go directive of issue16008.go
sivchari [Fri, 26 Nov 2021 07:45:44 +0000 (07:45 +0000)]
test/fixedbugs: fix go directive of issue16008.go

This change modifies issue16008.go
I fixed // go:noinline to //go:noinline

Change-Id: Ic133eec51f0a7c4acf8cb22d25473ca08f1e916c
GitHub-Last-Rev: dd1868f2ca1f9ca7e2d6d1bfc15c601649896fdd
GitHub-Pull-Request: golang/go#49801
Reviewed-on: https://go-review.googlesource.com/c/go/+/367174
Reviewed-by: Alberto Donizetti <alb.donizetti@gmail.com>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
Trust: Alberto Donizetti <alb.donizetti@gmail.com>
Run-TryBot: Alberto Donizetti <alb.donizetti@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>

3 years agoA+C: add Chaoqun Han (individual CLA)
Chaoqun Han [Thu, 25 Nov 2021 01:41:06 +0000 (09:41 +0800)]
A+C: add Chaoqun Han (individual CLA)

Change-Id: Id4aa067ef84510a31992d7d32cc697dd8b8342f1
Reviewed-on: https://go-review.googlesource.com/c/go/+/367035
Reviewed-by: Meng Zhuo <mzh@golangcn.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Meng Zhuo <mzh@golangcn.org>
Run-TryBot: Meng Zhuo <mzh@golangcn.org>
TryBot-Result: Go Bot <gobot@golang.org>

3 years agoruntime: support non-cooperative preemption on windows/arm64
Jason A. Donenfeld [Tue, 23 Nov 2021 19:57:24 +0000 (20:57 +0100)]
runtime: support non-cooperative preemption on windows/arm64

This adds support for injecting asynchronous preemption calls on
windows/arm64. This code exactly follows sigctxt.pushCall for POSIX OSes
on arm64.

Fixes #49759.

Change-Id: Id35ff6bc105c1db9d7ed2918d3ecab0e4e9a9431
Reviewed-on: https://go-review.googlesource.com/c/go/+/366735
Trust: Jason A. Donenfeld <Jason@zx2c4.com>
Run-TryBot: Jason A. Donenfeld <Jason@zx2c4.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: Patrik Nyblom <pnyb@google.com>
3 years agoruntime: support non-cooperative preemption on windows/arm
Jason A. Donenfeld [Tue, 23 Nov 2021 19:04:24 +0000 (20:04 +0100)]
runtime: support non-cooperative preemption on windows/arm

This adds support for injecting asynchronous preemption calls on
windows/arm. This code follows sigctxt.pushCall for POSIX OSes
on arm, except we subtract 1 from IP, just as in CL 273727.

Updates #10958.
Updates #24543.
Updates #49759.

Change-Id: Id0c2aed28662f50631b8c8cede3b4e6f088dafea
Reviewed-on: https://go-review.googlesource.com/c/go/+/366734
Trust: Jason A. Donenfeld <Jason@zx2c4.com>
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: Patrik Nyblom <pnyb@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
3 years agocmd/dist: add buildtag parsing test
Russ Cox [Wed, 24 Nov 2021 15:35:21 +0000 (10:35 -0500)]
cmd/dist: add buildtag parsing test

Forgot to 'git add' this test written as part of CL 359314.

For #41184.

Change-Id: I2ebd48fd62a2053c8b16e5a8c48c1e11d1b86d5b
Reviewed-on: https://go-review.googlesource.com/c/go/+/366894
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
3 years agocmd/compile/internal/types2: better error message for missing ~ in constraint
Robert Griesemer [Tue, 23 Nov 2021 23:55:11 +0000 (15:55 -0800)]
cmd/compile/internal/types2: better error message for missing ~ in constraint

If a constraint could be satisfied if one of its type elements
had a ~, provide this information in the error message.

Fixes #49179.

Change-Id: I59f1a855a0646ad7254a978420b0334f1f52ec22
Reviewed-on: https://go-review.googlesource.com/c/go/+/366758
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
3 years agocmd/compile/internal/types2: better error position for instantiation failure
Robert Griesemer [Tue, 23 Nov 2021 21:54:02 +0000 (13:54 -0800)]
cmd/compile/internal/types2: better error position for instantiation failure

- Thread type argument expressions (rather than posLists) through various
type-checker functions so we can provide a better error position.

- Adjust signatures that expect a syntax.Pos to accept a poser instead
to avoid gratuituous conversions from expressions to positions.

- Rename targsx to xlist so we use xlist consistently for expression
lists.

First step in providing a better error message for the issue below.

For #49179.

Change-Id: I8fc685a2ee4f5640f4abd35568ba32bcb34e9e84
Reviewed-on: https://go-review.googlesource.com/c/go/+/366757
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
3 years agoruntime: skip TestTimePprof on illumos
Tobias Klauser [Wed, 24 Nov 2021 14:37:21 +0000 (15:37 +0100)]
runtime: skip TestTimePprof on illumos

On illumos nanotime calls libc, like on the other systems for which
TestTimePprof is skipped.

For #43118

Change-Id: I370d3f098a261185920cb1e3e3402d16200e301a
Reviewed-on: https://go-review.googlesource.com/c/go/+/366737
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
3 years agodoc/go1.18: add Clone doc
jiahua wang [Tue, 16 Nov 2021 07:36:37 +0000 (15:36 +0800)]
doc/go1.18: add Clone doc

For #47694

Change-Id: I3b135f6ff199d7a9746726b131fbe7dd97a8e95e
Reviewed-on: https://go-review.googlesource.com/c/go/+/364254
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Trust: Heschi Kreinick <heschi@google.com>

3 years agocmd/compile/internal/types2: produce empty type set for invalid ~T
Robert Griesemer [Tue, 23 Nov 2021 03:02:56 +0000 (19:02 -0800)]
cmd/compile/internal/types2: produce empty type set for invalid ~T

If ~T is not permitted because the underlying type of T is not the
same as T, there is no type that satisfies ~T. Besides reporting an
error, also ensure that the corresponding type set is empty.

For #49739.

Change-Id: I127f75f170902e7989f7fe7b352dabda9f72e2a5
Reviewed-on: https://go-review.googlesource.com/c/go/+/366278
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
3 years agocmd/compile/internal/types2: report types for mismatched call and return statements
Robert Griesemer [Wed, 17 Nov 2021 23:23:12 +0000 (15:23 -0800)]
cmd/compile/internal/types2: report types for mismatched call and return statements

Thanks to emmanuel@orijtech.com who wrote the initial version of
this change (CL 354490).

This change is following CL 354490 in idea but also contains various
simplifications, slightly improved printing of signature/type patterns,
adjustments for types2, and some fine-tuning of error positions.

Also adjusted several ERROR regexp patterns.

Fixes #48834.
Fixes #48835.

Change-Id: I31cf20c81753b1dc84836dbe83a39030ceb9db23
Reviewed-on: https://go-review.googlesource.com/c/go/+/364874
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
3 years agogo/types: print "nil" rather than "untyped nil"
Robert Griesemer [Tue, 23 Nov 2021 00:04:17 +0000 (16:04 -0800)]
go/types: print "nil" rather than "untyped nil"

This is a port of CL 366276 from types2 to go/types
with minor adjustments due to the slightly different
handling of nil in go/types.

It uses some more detailed error strings in stmt0.src;
the same changes are made to the corresponding types2
file.

For #48852.

Change-Id: I2cdf258799bcbe2d12bbadaf67b8b4504b356bd0
Reviewed-on: https://go-review.googlesource.com/c/go/+/366277
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
3 years agospec: type assertions and switches don't operate on type parameters
Robert Griesemer [Wed, 24 Nov 2021 04:56:33 +0000 (20:56 -0800)]
spec: type assertions and switches don't operate on type parameters

Change-Id: I11111b3617673be94508128489aed6488d518537
Reviewed-on: https://go-review.googlesource.com/c/go/+/366834
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
3 years agospec: adjust type identity rules for type parameters
Robert Griesemer [Wed, 24 Nov 2021 02:11:07 +0000 (18:11 -0800)]
spec: adjust type identity rules for type parameters

Change-Id: I5ffc7f26236487070447eaa0f6b14d1fab44c3c7
Reviewed-on: https://go-review.googlesource.com/c/go/+/366794
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
3 years agospec: add section on instantiation
Robert Griesemer [Sat, 20 Nov 2021 22:35:02 +0000 (14:35 -0800)]
spec: add section on instantiation

Change-Id: I2770da87b4c977b51dfa046f2f08283917675e1c
Reviewed-on: https://go-review.googlesource.com/c/go/+/365916
Trust: Robert Griesemer <gri@golang.org>
Trust: Dan Scales <danscales@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Dan Scales <danscales@google.com>
3 years agospec: adjust conversion rules for type parameters
Robert Griesemer [Sat, 20 Nov 2021 21:17:27 +0000 (13:17 -0800)]
spec: adjust conversion rules for type parameters

Change-Id: I7bfddf4be0d1d95419f312bb349ae2e16b74b795
Reviewed-on: https://go-review.googlesource.com/c/go/+/365915
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
3 years agospec: adjust assignability rules for type parameters
Robert Griesemer [Fri, 19 Nov 2021 00:11:10 +0000 (16:11 -0800)]
spec: adjust assignability rules for type parameters

Change-Id: I3c4d8bdb5e92ee7fdca9593fb043f94f467755e8
Reviewed-on: https://go-review.googlesource.com/c/go/+/365434
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
3 years agospec: adjust representability rules for type parameters
Robert Griesemer [Sat, 20 Nov 2021 21:29:02 +0000 (13:29 -0800)]
spec: adjust representability rules for type parameters

Change-Id: I4423a059527066c4418c195911f8184dfd3f5a15
Reviewed-on: https://go-review.googlesource.com/c/go/+/365914
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
3 years agospec: add definition of "specific types" of an interface
Robert Griesemer [Tue, 23 Nov 2021 20:02:40 +0000 (12:02 -0800)]
spec: add definition of "specific types" of an interface

The notion of specific types will be used to define rules for
assignability, convertability, etc. when type parameters are
involved.

Change-Id: Ic5c134261e2a9fe05cdf25efd342f052458ab5c8
Reviewed-on: https://go-review.googlesource.com/c/go/+/366754
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
3 years agocmd/go: fix bug in using the workfile flag with tests
Michael Matloob [Fri, 19 Nov 2021 21:09:52 +0000 (16:09 -0500)]
cmd/go: fix bug in using the workfile flag with tests

Tests do custom flag processing so we must process the workfile flag
after that happens.

Also fix an issue where errors weren't handled properly when the
workfile wasn't absolute (the go command should just exit), and where a
parse error was just dropped.

Fixes #48576

Change-Id: I3a94d8d3a515114b2c4cc0e73f63447df2fc6bc9
Reviewed-on: https://go-review.googlesource.com/c/go/+/366174
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>
3 years agodoc/go1.18: document that iOS 12 or newer is required
Dmitri Shuralyov [Wed, 24 Nov 2021 16:05:51 +0000 (11:05 -0500)]
doc/go1.18: document that iOS 12 or newer is required

For #47694.
Updates #49616.
Updates #48076.

Change-Id: I570564c3a54d3cd9cfc9b8267df9fbee3363b650
Reviewed-on: https://go-review.googlesource.com/c/go/+/366914
Trust: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
3 years agocmd/internal/objfile, debug/gosym: use the address of runtime.text as textStart
Cherry Mui [Tue, 23 Nov 2021 23:03:47 +0000 (18:03 -0500)]
cmd/internal/objfile, debug/gosym: use the address of runtime.text as textStart

Tools like objdump uses the pcln table to find the line number of
a given PC. For a PIE binary, at least in some cases such as on
macOS 12 with ld64-711, the table contains unrelocated address,
which does not match the address in the symbol table, causing the
lookup to fail.

In Go 1.18 the pcln table is essentually position independent,
except the start PC. Instead of reading the static content from
the table, use the PC of runtime.text from the symbol table.

While here, change the type of textStart to uint64. What matters
here is the word size of the target program, not the host, so it
shouldn't be uintptr.

Fixes #49700.

Change-Id: I517d79be7ba02dd4dd0275e75a11a136b08d76cd
Reviewed-on: https://go-review.googlesource.com/c/go/+/366695
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>
3 years agocmd/internal/obj/x86: modify the threshold of assert loop for span6
zhouguangyuan [Mon, 22 Nov 2021 15:39:52 +0000 (23:39 +0800)]
cmd/internal/obj/x86: modify the threshold of assert loop for span6

Fixes: #49716
Change-Id: I7ed73f874c2ee1ee3f31c9c4428ed484167ca803
Reviewed-on: https://go-review.googlesource.com/c/go/+/366094
Reviewed-by: Cherry Mui <cherryyz@google.com>
Trust: Heschi Kreinick <heschi@google.com>

3 years agocmd/compile/internal/inline: revise closure inl position fix
Than McIntosh [Tue, 23 Nov 2021 13:19:45 +0000 (08:19 -0500)]
cmd/compile/internal/inline: revise closure inl position fix

This patch revises the fix for issue 46234, fixing a bug that was
accidentally introduced by CL 320913. When inlining a chunk of code
with a closure expression, we want to avoid updating the source
positions in the function being closed over, but we do want to update
the position for the ClosureExpr itself (since it is part of the
function we are inlining). CL 320913 unintentionally did away with the
closure expr source position update; here we restore it again.

Updates #46234.
Fixes #49171.

Change-Id: Iaa51bc498e374b9e5a46fa0acd7db520edbbbfca
Reviewed-on: https://go-review.googlesource.com/c/go/+/366494
Trust: Than McIntosh <thanm@google.com>
Trust: Dan Scales <danscales@google.com>
Reviewed-by: Dan Scales <danscales@google.com>
3 years agoruntime: skip TestTimePprof if nanotime calls libc
Ian Lance Taylor [Wed, 24 Nov 2021 00:30:17 +0000 (16:30 -0800)]
runtime: skip TestTimePprof if nanotime calls libc

Fixes #43118

Change-Id: I499bf335904e2b72a2a8876d0368fff5e69aa7fa
Reviewed-on: https://go-review.googlesource.com/c/go/+/366759
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>

3 years agoruntime: run the right test in TestCgoExternalThreadSignal
Ian Lance Taylor [Tue, 23 Nov 2021 20:25:10 +0000 (12:25 -0800)]
runtime: run the right test in TestCgoExternalThreadSignal

The code was accidentally repeating the TestCgoExternalThreadSIGPROF test.

While we're here remove an obsolete skip on ppc64/linux.

Change-Id: Icdc4032a67aa80fbcfcd7c5c7ab8a6f23f321e2e
Reviewed-on: https://go-review.googlesource.com/c/go/+/366755
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>
3 years agoos/signal: reset SIGURG in TestSignal
Chaoqun Han [Tue, 23 Nov 2021 14:05:40 +0000 (22:05 +0800)]
os/signal: reset SIGURG in TestSignal

Accepting SIGURG signals could cause SIGURG to take up the entire
channel buffer.

Enhance the stability of test cases by:
1.  Stop accepting the SIGURG signal by adding  â€˜Reset(sys call.SIGURG)’
2.  Close the c1 chan by adding â€˜defer Stop(c1)’ (Another bug, NOT this bug)

Fixes #49724

Change-Id: I909a9993f0f6dd109c15e48a861683b87dfc4ab3
Reviewed-on: https://go-review.googlesource.com/c/go/+/366514
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Trust: Bryan C. Mills <bcmills@google.com>

3 years agocmd/compile: special packages must not have any path separators
Keith Randall [Fri, 19 Nov 2021 21:28:49 +0000 (13:28 -0800)]
cmd/compile: special packages must not have any path separators

We want to distinguish special compiler-generated package paths,
like go.shape, from user paths, like go.opentelemetry.io/otel/semconv.
The former have no slash in them.

Writing a test for this seems hard, as the dependency we'd need to
add would be non-hermetic. (Or it would need a new tricky run.go mode.)

This CL does fix the example in the issue.

Fixes #49606

Change-Id: I38f1b970b6dd31e0617763a27ff227e3afee74d5
Reviewed-on: https://go-review.googlesource.com/c/go/+/365834
Trust: Keith Randall <khr@golang.org>
Trust: Dan Scales <danscales@google.com>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Dan Scales <danscales@google.com>
3 years agoruntime: skip TestCgoCallbackGC on darwin-amd64-10_14 builder
Bryan C. Mills [Tue, 23 Nov 2021 15:39:07 +0000 (10:39 -0500)]
runtime: skip TestCgoCallbackGC on darwin-amd64-10_14 builder

This test occasionally fails due to a real bug on this platform.
Due to the age of the platform and the rarity of the failure, we do
not believe that the bug is worth working around.

Fixes #43926

Change-Id: Ia227c5afe81fc21b6630813228f976cc3a54013c
Reviewed-on: https://go-review.googlesource.com/c/go/+/366537
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>

3 years agomisc/reboot: skip TestRepeatBootstrap on short builders
Bryan C. Mills [Tue, 23 Nov 2021 15:54:49 +0000 (10:54 -0500)]
misc/reboot: skip TestRepeatBootstrap on short builders

This test is slow and resource-intensive, and will rarely catch
failures. It is important to run sometimes, but probably a waste of
time on smaller (and especially reverse) builders.
Rather than hard-coding a list of small builders, only run it on the
longtest builders.

Fixes #35233
Fixes #30892
Fixes #49753

Change-Id: I25a9702e1f541246ea200fd7c79414ca5f69edae
Reviewed-on: https://go-review.googlesource.com/c/go/+/366538
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
3 years agoruntime: ensure no GC is running in TestParallelRWMutexReaders
Michael Anthony Knyszek [Tue, 23 Nov 2021 14:30:56 +0000 (14:30 +0000)]
runtime: ensure no GC is running in TestParallelRWMutexReaders

Currently this test makes it clear that it's unsafe for a GC to run,
otherwise a deadlock could occur, so it calls SetGCPercent(-1). However,
a GC may be actively in progress, and SetGCPercent is not going to end
any in-progress GC. Call runtime.GC to block until at least the current
GC is over.

Updates #49680.

Change-Id: Ibdc7d378e8cf7e05270910e92effcad8c6874e59
Reviewed-on: https://go-review.googlesource.com/c/go/+/366534
Trust: Michael Knyszek <mknyszek@google.com>
Run-TryBot: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
3 years agocmd/compile/internal/types2: print "nil" rather than "untyped nil"
Robert Griesemer [Mon, 22 Nov 2021 21:53:21 +0000 (13:53 -0800)]
cmd/compile/internal/types2: print "nil" rather than "untyped nil"

When we have a typed nil, we already say so; thus it is sufficient
to use "nil" in all the other cases.

This is closer to (1.17) compiler behavior. In cases where the
1.17 compiler prints "untyped nil" (e.g., wrong uses of "copy"),
we already print a different message. We can do better in those
cases as well; will be addressed in a separate CL (see #49735).

Fixes #48852.

Change-Id: I9a7a72e0f99185b00f80040c5510a693b1ea80f6
Reviewed-on: https://go-review.googlesource.com/c/go/+/366276
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
3 years agocmd/go: work out VCS information once per repository
Daniel Martí [Thu, 18 Nov 2021 22:58:17 +0000 (22:58 +0000)]
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>

3 years agospec: fix Swap example (correctly swap type arguments and parameters)
Robert Griesemer [Mon, 22 Nov 2021 19:43:46 +0000 (11:43 -0800)]
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>
3 years agodoc/go1.18: document new overflow error for some untyped arguments to print/ln
Robert Griesemer [Mon, 22 Nov 2021 20:33:11 +0000 (12:33 -0800)]
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>
3 years agodoc/go1.18: document compiler change for "declared but not used" errors
Robert Griesemer [Mon, 22 Nov 2021 20:21:12 +0000 (12:21 -0800)]
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>
3 years agocmd/go: allow a package that ends with _test having an internal test package
Ryan Leung [Mon, 22 Nov 2021 02:41:07 +0000 (02:41 +0000)]
cmd/go: allow a package that ends with _test having an internal test package

Fixes #45477

Change-Id: I2f1ed281515ec40d31fd07ce9f4901777691bfa7
GitHub-Last-Rev: 7894d9400c95b8d84efe88f401fa75c3dd01921a
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>

3 years agocmd/go: correct an inaccuracy in the 'go help work' docs
Michael Matloob [Mon, 22 Nov 2021 20:37:29 +0000 (15:37 -0500)]
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>
3 years agoruntime: execute TestSpuriousWakeupsNeverHangSemasleep in parallel
Bryan C. Mills [Mon, 22 Nov 2021 19:37:41 +0000 (14:37 -0500)]
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>

3 years agoruntime: in TestSpuriousWakeupsNeverHangSemasleep, wait for the runtime to register...
Bryan C. Mills [Mon, 22 Nov 2021 19:30:40 +0000 (14:30 -0500)]
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>
3 years agogo/types, types2: substitute for type parameters in signatures when
Robert Findley [Mon, 22 Nov 2021 17:47:53 +0000 (12:47 -0500)]
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>

3 years agocmd/go: forward the MallocNanoZone variable to script tests
Bryan C. Mills [Mon, 22 Nov 2021 19:01:26 +0000 (14:01 -0500)]
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>
3 years agotesting: mention that TB also covers the new type F
Bharath Kumar Uppala [Sat, 20 Nov 2021 20:45:39 +0000 (02:15 +0530)]
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>

3 years agomisc/cgo/testcshared: skip TestGo2C2Go on Windows
Ian Lance Taylor [Mon, 22 Nov 2021 00:19:26 +0000 (16:19 -0800)]
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>
3 years agonet: allow more generous slop in Fluctuation tests
Bryan C. Mills [Mon, 22 Nov 2021 17:20:26 +0000 (12:20 -0500)]
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>
3 years agonet: diagnose unexpected nils in TestUnixAndUnixpacketServer
Bryan C. Mills [Mon, 22 Nov 2021 15:21:19 +0000 (10:21 -0500)]
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>
3 years agomisc/cgo/test: remove unnecessary forward declaration
Bryan C. Mills [Mon, 22 Nov 2021 14:50:47 +0000 (09:50 -0500)]
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>
3 years agocmd/go: report a helpful error when there are no modules in workspace
Michael Matloob [Fri, 19 Nov 2021 21:09:52 +0000 (16:09 -0500)]
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>
3 years agoRevert "cmd/go: temporarily skip TestScript/test_fuzz_minimize"
Bryan C. Mills [Mon, 22 Nov 2021 14:37:19 +0000 (14:37 +0000)]
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>
3 years agocmd/go: fix go work sync when there are zero workspace modules
Michael Matloob [Thu, 18 Nov 2021 19:48:26 +0000 (14:48 -0500)]
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>
3 years agoA+C: add Zhou Guangyuan (individual CLA)
zhouguangyuan [Fri, 19 Nov 2021 17:49:32 +0000 (01:49 +0800)]
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>
3 years agogo/types,types2: use allInteger to check type for shifted operand
zhouguangyuan [Sun, 21 Nov 2021 13:06:27 +0000 (21:06 +0800)]
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>

3 years agospec: add section on the structure of interfaces
Robert Griesemer [Fri, 19 Nov 2021 01:52:24 +0000 (17:52 -0800)]
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>
3 years agospec: add type parameter types
Robert Griesemer [Thu, 18 Nov 2021 23:33:19 +0000 (15:33 -0800)]
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>
3 years agospec: add type parameter lists
Robert Griesemer [Thu, 18 Nov 2021 20:16:39 +0000 (12:16 -0800)]
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>
3 years agotest: fix -G=0 mode for longtest builder
Dan Scales [Sat, 20 Nov 2021 01:52:41 +0000 (17:52 -0800)]
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>
3 years agocmd/compile: ensure generic function is loaded when it needs to be re-exported
Dan Scales [Fri, 19 Nov 2021 20:13:04 +0000 (12:13 -0800)]
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>
3 years agoruntime/cgo: add example of Handle with void* parameter
Alan Donovan [Wed, 17 Nov 2021 17:54:22 +0000 (12:54 -0500)]
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>

3 years agocmd/link: exit early when -d is used on libc platforms
Cherry Mui [Fri, 19 Nov 2021 21:36:03 +0000 (16:36 -0500)]
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>
3 years agocmd/compile: handle `any` as alias like `byte` and `rune`
Matthew Dempsky [Thu, 18 Nov 2021 21:43:04 +0000 (13:43 -0800)]
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>
3 years agonet: simplify deadline fluctuation tests
Bryan C. Mills [Thu, 18 Nov 2021 21:07:13 +0000 (16:07 -0500)]
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>

3 years agocrypto/x509/internal/macos: use APIs available on ios
Roland Shoemaker [Tue, 16 Nov 2021 20:33:03 +0000 (12:33 -0800)]
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>
3 years agodoc/go1.18: mention register ABI on ARM64 and PPC64
Cherry Mui [Fri, 12 Nov 2021 18:10:30 +0000 (13:10 -0500)]
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>
3 years ago[go] doc: document speedups to Trim[|Left|Right]
Jeremy Faller [Fri, 19 Nov 2021 20:11:22 +0000 (15:11 -0500)]
[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>
3 years ago[go] doc: add new bufio functionality
Jeremy Faller [Fri, 19 Nov 2021 18:56:24 +0000 (13:56 -0500)]
[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>
3 years agocmd/go: temporarily skip TestScript/test_fuzz_minimize
Bryan C. Mills [Fri, 19 Nov 2021 17:51:25 +0000 (12:51 -0500)]
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>
3 years agointernal/fuzz: fix chunk swap mutator
Roland Shoemaker [Thu, 18 Nov 2021 19:40:48 +0000 (11:40 -0800)]
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>
3 years agointernal/fuzz: compute correct number of mutations
Roland Shoemaker [Thu, 18 Nov 2021 21:30:55 +0000 (13:30 -0800)]
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>

3 years agocmd/compile: don't run ComputeAddrTaken on imported generic functions
Dan Scales [Thu, 18 Nov 2021 18:52:35 +0000 (10:52 -0800)]
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>
3 years agocmd/go/internal/test: add dep from test pkg build to real pkg build
Ian Lance Taylor [Thu, 18 Nov 2021 20:14:24 +0000 (12:14 -0800)]
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>
3 years agospec: various clarifications/fixes for method sets and interfaces
Robert Griesemer [Thu, 18 Nov 2021 18:02:08 +0000 (10:02 -0800)]
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>
3 years agonet: optimize ctxDone usage
Mikhail Faraponov [Tue, 16 Nov 2021 19:41:43 +0000 (19:41 +0000)]
net: optimize ctxDone usage

Change-Id: I6db6fcf0ebe36da77af062114b5264405f15fee8
GitHub-Last-Rev: 80a97262bb220bb3958c94016eadf385cdf915e8
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>

3 years agogo/types: add test for imported constraints pre-1.18
Robert Findley [Thu, 18 Nov 2021 01:22:32 +0000 (20:22 -0500)]
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>
3 years agogo/types: use "implements" rather than "satisfies" in error messages
Robert Findley [Thu, 18 Nov 2021 01:17:55 +0000 (20:17 -0500)]
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>
3 years agogo/types: remove unneccesary tests in implements and lookup
Robert Findley [Thu, 18 Nov 2021 01:04:14 +0000 (20:04 -0500)]
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>
3 years agogo/types: implement Checker.implements
Robert Findley [Thu, 18 Nov 2021 01:01:16 +0000 (20:01 -0500)]
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>
3 years agocmd/link: relocate dwarf examiner helper to separate package
Than McIntosh [Fri, 12 Nov 2021 18:20:07 +0000 (13:20 -0500)]
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>