1
0
mirror of https://github.com/golang/go synced 2024-11-07 09:36:11 -07:00
Commit Graph

51306 Commits

Author SHA1 Message Date
Robert Griesemer
68da368a4e 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>
2021-11-29 19:24:34 +00:00
Robert Griesemer
37a5d720d4 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>
2021-11-29 19:24:26 +00:00
Ian Lance Taylor
4325c37d67 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>
2021-11-29 19:21:29 +00:00
Jason A. Donenfeld
a59ab29bf2 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>
2021-11-29 16:08:23 +00:00
Meng Zhuo
1ea4d3b911 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>
2021-11-29 00:58:50 +00:00
Bharath Kumar Uppala
78af02e8b5 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>
2021-11-29 00:57:09 +00:00
syumai
0fa53e41f1 spec: fix link for instantiations
This change corrects the link `Instantiantions` to `Instantiations` in the spec.

Change-Id: Ib0ed03420ae401d20af1ea723c5487018b2f462d
GitHub-Last-Rev: b84316c818
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>
2021-11-27 23:29:50 +00:00
tangxi666
9f2a075df9 cmd/go: fix a typo in mod_lazy_new_import.txt
x/y -> a/y

Change-Id: If24970623731098bb72345b8f4c8518b563bbec8
GitHub-Last-Rev: 8a35dddbc1
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>
2021-11-27 23:27:52 +00:00
sivchari
7e1260f62b testing: simplify fuzzResult.String to avoid unnecessarily using fmt.Sprintf
Change-Id: I16b6bfb6b0f02672c894b20845aa14d8dd1979b4
GitHub-Last-Rev: 75ab90123a
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>
2021-11-27 23:25:39 +00:00
Carlo Alberto Ferraris
a142d6587c doc: go1.18 release notes for CLs 323318/332771
Updates #47694

Change-Id: Ib76737996a701906117e096eb6d05b388576a874
GitHub-Last-Rev: 05b9649965
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>
2021-11-27 19:49:32 +00:00
Tobias Klauser
fad67f8a53 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>
2021-11-27 01:14:21 +00:00
Keith Randall
1d47a1184a 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>
2021-11-26 22:36:21 +00:00
Roi Martin
bf88adadac 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>
2021-11-26 20:49:40 +00:00
Jason A. Donenfeld
77038044ca 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>
2021-11-26 13:18:11 +00:00
sivchari
a0506bdf7c 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: dd1868f2ca
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>
2021-11-26 13:06:40 +00:00
Chaoqun Han
45bae64015 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>
2021-11-25 04:02:39 +00:00
Jason A. Donenfeld
f7e34e705c 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>
2021-11-25 00:07:28 +00:00
Jason A. Donenfeld
c58243aa8a 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>
2021-11-25 00:07:11 +00:00
Russ Cox
b2a5a3771f 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>
2021-11-25 00:02:52 +00:00
Robert Griesemer
b77f5f9667 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>
2021-11-24 21:11:45 +00:00
Robert Griesemer
8cdfe408bb 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>
2021-11-24 21:11:34 +00:00
Tobias Klauser
7e5331ac44 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>
2021-11-24 21:09:36 +00:00
jiahua wang
5527d7ff79 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>
2021-11-24 21:08:29 +00:00
Robert Griesemer
67dd9ee92c 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>
2021-11-24 20:59:14 +00:00
Robert Griesemer
c25bf0d959 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>
2021-11-24 20:57:46 +00:00
Robert Griesemer
9e7600d3fc 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>
2021-11-24 20:56:40 +00:00
Robert Griesemer
696515ee39 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>
2021-11-24 20:54:12 +00:00
Robert Griesemer
6ea17aa52c 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>
2021-11-24 20:54:07 +00:00
Robert Griesemer
a3b8f627c2 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>
2021-11-24 20:53:54 +00:00
Robert Griesemer
ce2a20af46 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>
2021-11-24 20:53:51 +00:00
Robert Griesemer
939480033a 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>
2021-11-24 20:53:45 +00:00
Robert Griesemer
003e7faf53 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>
2021-11-24 20:53:29 +00:00
Robert Griesemer
5d8c49a5a1 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>
2021-11-24 20:51:25 +00:00
Michael Matloob
4da06e7b00 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>
2021-11-24 19:11:35 +00:00
Dmitri Shuralyov
e883005d2a 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>
2021-11-24 18:59:20 +00:00
Cherry Mui
b38ab0ac5f 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>
2021-11-24 16:01:55 +00:00
zhouguangyuan
14f2b2a4c5 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>
2021-11-24 15:57:53 +00:00
Than McIntosh
465b402808 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>
2021-11-24 15:55:56 +00:00
Ian Lance Taylor
47db3bb443 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>
2021-11-24 05:36:54 +00:00
Ian Lance Taylor
1ac45e026b 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>
2021-11-23 21:59:51 +00:00
Chaoqun Han
e3eaedb5cf 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>
2021-11-23 21:39:32 +00:00
Keith Randall
0f64c21d90 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>
2021-11-23 19:31:05 +00:00
Bryan C. Mills
00045b76e5 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>
2021-11-23 17:30:32 +00:00
Bryan C. Mills
b90c6b99b3 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>
2021-11-23 16:52:38 +00:00
Michael Anthony Knyszek
066620f0d8 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>
2021-11-23 16:00:03 +00:00
Robert Griesemer
83bfed916b 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>
2021-11-22 23:51:43 +00:00
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