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

51270 Commits

Author SHA1 Message Date
Robert Griesemer
fa88ba1e8a doc/go1.18: add documentation for changes to go/ast
Updates #47694

Change-Id: Ied26f6345df2c8640d4be5132a05db3897b59009
Reviewed-on: https://go-review.googlesource.com/c/go/+/369096
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2021-12-04 01:07:28 +00:00
Robert Griesemer
821bf04f2a doc/go1.18: add documentation for changes to go/token
Updates #47694

Change-Id: I232fb20b3a77409b84c15f9ec1586e480f0f6390
Reviewed-on: https://go-review.googlesource.com/c/go/+/369095
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2021-12-04 01:07:21 +00:00
Robert Griesemer
ba83aa7caa doc/go1.18: add documentation for changes to go/constant
Updates #47694

Change-Id: I2ce5aaa4493259790712a8a49e5b03472c8a7400
Reviewed-on: https://go-review.googlesource.com/c/go/+/369094
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2021-12-04 01:07:10 +00:00
Keith Randall
9ae0b35fad test: add test of select inside generic function
Make sure that we can import/export selects for generics.

Change-Id: Ibf36e98fc574ce9275820aa426b3e6703b0aae6d
Reviewed-on: https://go-review.googlesource.com/c/go/+/369101
Trust: Keith Randall <khr@golang.org>
Trust: Dan Scales <danscales@google.com>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dan Scales <danscales@google.com>
2021-12-03 22:57:02 +00:00
Hossein Zolfi
d20a0bfc8a doc/go1.18: change github.com/golang/go/issues to golang.org/issue
Updates #47694

Change-Id: I84547ff995e2a302cf229fefefd28a7220a17028
Reviewed-on: https://go-review.googlesource.com/c/go/+/369016
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Trust: Austin Clements <austin@google.com>
2021-12-03 21:25:05 +00:00
Austin Clements
b3e1fbff4d cmd/compile/abi-internal: mention SSE restriction on Plan 9
Change-Id: I2be08b88b5147cf37ac55b7472d63503739c9f05
Reviewed-on: https://go-review.googlesource.com/c/go/+/369156
Trust: Austin Clements <austin@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2021-12-03 21:23:11 +00:00
Austin Clements
ebe99189fc doc/go1.18: catch up with runtime/compiler commits and API changes
For #47694.

Change-Id: I21b1af1807d4da2fb2f4d9b961d44a21d715d7d2
Reviewed-on: https://go-review.googlesource.com/c/go/+/369155
Trust: Austin Clements <austin@google.com>
Trust: Jeremy Faller <jeremy@golang.org>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
2021-12-03 21:23:09 +00:00
Sean Liao
c4a8550421 .github: use multiple issue templates
There are currently multiple issue templates floating around for
different projects, these can sometimes be hard to find.

Fixes #29839

Change-Id: I6600b6f78842736d81d35e6a64247d00706d9e0e
Reviewed-on: https://go-review.googlesource.com/c/go/+/366736
Trust: Russ Cox <rsc@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
2021-12-03 18:27:20 +00:00
Katie Hockman
deb988a286 doc/go1.18: mention fuzzing in the release notes
Also make a few small formatting fixes.

Change-Id: Iad99d030312393af3b6533f2cd00f09aea0f2a7d
Reviewed-on: https://go-review.googlesource.com/c/go/+/369074
Trust: Katie Hockman <katie@golang.org>
Run-TryBot: Katie Hockman <katie@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2021-12-03 18:09:19 +00:00
Austin Clements
d921bb21df doc/go1.18: reorganize runtime/compiler a little
For #47694.

Change-Id: Iedf85f522f7c79ae0a61b4fc1f2f092cf7b613df
Reviewed-on: https://go-review.googlesource.com/c/go/+/368696
Trust: Austin Clements <austin@google.com>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
2021-12-03 17:13:03 +00:00
Dan Scales
29483b3dae test: re-enable a bunch of tests with types2
Enable a bunch of types2-related error tests to run successfully, so
they no longer have to be disabled in run.go.

 - directive.go: split it into directive.go and directive2.go, since the
   possible errors are now split across the parser and noder2, so they
   can't all be reported in one file.

 - linkname2.go: similarly, split it into linkname2.go and linkname3.go
   for the same reason.

 - issue16428.go, issue17645.go, issue47201.dir/bo.go: handle slightly
   different wording by types2

 - issue5609.go: handle slight different error (array length must be
   integer vs. array bound too large).

 - float_lit3.go: handle slightly different wording (overflows
   float vs cannot convert to float)

I purposely didn't try to fix tests yet where there are extra or missing
errors on different lines, since that is not easy to make work for both
-G=3 and -G=0. In a later change, will flip to make the types2 version
match correctly, vs. the -G=0 version.

Change-Id: I6079ff258e3b90146335b9995764e3b1b56cda59
Reviewed-on: https://go-review.googlesource.com/c/go/+/368455
Trust: Dan Scales <danscales@google.com>
Run-TryBot: Dan Scales <danscales@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2021-12-03 16:24:32 +00:00
Felix Geisendörfer
9b0de0854d runtime: fix missing pprof labels
Use gp.m.curg instead of the gp when recording cpu profiler stack
traces. This ensures profiler labels are captured when systemstack or similar
is executing on behalf of the current goroutine.

After this there are still rare cases of samples containing the labelHog
function, so more work might be needed. This patch should fix ~99% of the
problem.

Also change testCPUProfile interface a little to allow the new test to
re-run with a longer duration if it fails during a -short run.

Fixes #48577.

Change-Id: I3dbc9fd5af3c513544e822acaa43055b2e00dfa9
Reviewed-on: https://go-review.googlesource.com/c/go/+/367200
Trust: Michael Pratt <mpratt@google.com>
Trust: Bryan Mills <bcmills@google.com>
Run-TryBot: Michael Pratt <mpratt@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
2021-12-03 16:11:38 +00:00
Bryan C. Mills
a174638a5c os: test that LookupEnv reports all keys found in Environ
For #49886

Change-Id: Ie3a7f12a0d30ec719caf375e7be30cc4a5796c3f
Reviewed-on: https://go-review.googlesource.com/c/go/+/367850
Trust: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
2021-12-03 14:28:11 +00:00
Ian Lance Taylor
098599003b builtin: document "any" and "comparable"
Fixes #49927

Change-Id: I8b34cf13b3bc6338309f005648ca3ee6852927f0
Reviewed-on: https://go-review.googlesource.com/c/go/+/368954
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
2021-12-03 01:09:21 +00:00
Cherry Mui
8da66a35ca cmd/compile: set PPC64's MAXWIDTH as other architectures
PPC64's MAXWIDTH is set as 1<<60 whereas on other 64-bit
architetures it is set as 1<<50. Set to 1<<50 for consistency. The
toolchain cannot handle such large program anyway.

May fix PPC64 build.

Change-Id: Ic3972a089b2f14a96e4ded57ef218d763c924a6a
Reviewed-on: https://go-review.googlesource.com/c/go/+/368955
Trust: Cherry Mui <cherryyz@google.com>
Trust: Dan Scales <danscales@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dan Scales <danscales@google.com>
2021-12-03 00:46:20 +00:00
Cherry Mui
5f6552018d runtime/race: rebuild darwin syso to work around macOS 12 malloc reserved address
On macOS 12 a new malloc implementation (nano) is used by default,
and apparently it reserves address range
0x600000000000-0x600020000000, which conflicts with the address
range that TSAN uses for Go. Work around the issue by changing the
address range slightly.

The actual change is made on LLVM at https://reviews.llvm.org/D114825 .
This CL includes syso's built with the patch applied.

Fixes #49138.

Change-Id: I7b367d6e042b0db39a691c71601c98e4f8728a70
Reviewed-on: https://go-review.googlesource.com/c/go/+/367916
Trust: Cherry Mui <cherryyz@google.com>
Reviewed-by: Austin Clements <austin@google.com>
2021-12-02 23:34:26 +00:00
Ian Lance Taylor
8835343280 doc/go1.18: mention new -asan option
For #44853
For #47694

Change-Id: Ia76246218b1361d8bdf510bbfc5178c83cdd3eec
Reviewed-on: https://go-review.googlesource.com/c/go/+/368834
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2021-12-02 23:02:33 +00:00
Shang Jian Ding
fd4b391849 crypto/x509: fix comments on certDirectories
CL 205237 allowed SSL_CERT_DIR to be a colon delimited list of
directories. In the case that SSL_CERT_DIR is unset, the change
also made certDirectories to all be loaded rather than stopping
after successfully reading at least one file from a directory.
This update fixes code comments on the certDirectories package
level variables to reflect current behavior.

Fixes #48808

Change-Id: Id92f875545272fc6205d9955d03ea7bf844f15eb
Reviewed-on: https://go-review.googlesource.com/c/go/+/354140
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
Reviewed-by: Katie Hockman <katie@golang.org>
Run-TryBot: Emmanuel Odeke <emmanuel@orijtech.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Trust: Katie Hockman <katie@golang.org>
2021-12-02 22:53:18 +00:00
Jeremy Faller
06dbf6121a doc/go1.18: remove some TODOs for changes we aren't mentioning
Updates #47694

Change-Id: I8fdbded4aaf974425ee317a1cdd940a5ac88c0b3
Reviewed-on: https://go-review.googlesource.com/c/go/+/368794
Trust: Jeremy Faller <jeremy@golang.org>
Run-TryBot: Jeremy Faller <jeremy@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-12-02 22:06:27 +00:00
Jeremy Faller
48e4284e55 doc/go1.18: add docs on FieldByIndexErr
From:
https://go-review.googlesource.com/c/go/+/357962/

Updates #47694

Change-Id: I2d43dcbd28c03457b55eada26e87f7710a113b0c
Reviewed-on: https://go-review.googlesource.com/c/go/+/368364
Trust: Jeremy Faller <jeremy@golang.org>
Run-TryBot: Jeremy Faller <jeremy@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-12-02 22:06:10 +00:00
Jeremy Faller
e533b5793f doc/go1.18: add docs on new reflect.Value methods
From:

https://go-review.googlesource.com/c/go/+/352131/

Updates #47694

Change-Id: I7c7811c49900049f5ef7fc906fe25d2ffd73c7b9
Reviewed-on: https://go-review.googlesource.com/c/go/+/368363
Trust: Jeremy Faller <jeremy@golang.org>
Run-TryBot: Jeremy Faller <jeremy@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Fabio Falzoi <fabio.falzoi84@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
2021-12-02 22:05:56 +00:00
Jeremy Faller
f9b2733e3a doc/go1.18: add docs on MapIter.Reset
From:

https://go-review.googlesource.com/c/go/+/321891

Updates #47694

Change-Id: I2cdd5d9f3da62a5690cd2ef921ed48957c602d64
Reviewed-on: https://go-review.googlesource.com/c/go/+/368360
Trust: Jeremy Faller <jeremy@golang.org>
Run-TryBot: Jeremy Faller <jeremy@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-12-02 22:05:01 +00:00
Jeremy Faller
bcb98f126b doc/go1.18: add docs on User.GroupIds
Cobbled up some release notes from:

https://go-review.googlesource.com/c/go/+/330753/

Updates #47694

Change-Id: I249e4b96b7d51185b07c11a734505677e9e36315
Reviewed-on: https://go-review.googlesource.com/c/go/+/368358
Trust: Jeremy Faller <jeremy@golang.org>
Run-TryBot: Jeremy Faller <jeremy@golang.org>
Reviewed-by: Kirill Kolyshkin <kolyshkin@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
2021-12-02 22:04:50 +00:00
Jeremy Faller
c8c89d20ce doc/go1.18: add docs on Cookie.Valid
Updates #47694

Change-Id: Ibf3e25fbccf82e4abd7bd76b2ea6ceb4b05d4664
Reviewed-on: https://go-review.googlesource.com/c/go/+/368357
Trust: Jeremy Faller <jeremy@golang.org>
Run-TryBot: Jeremy Faller <jeremy@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-12-02 22:04:23 +00:00
Jeremy Faller
25f06cb71f doc/go1.18: add deprecation note for net.Error.Temporary
Updates #47694

Change-Id: Ia25ad49f688efa3d60d83290095648711704b478
Reviewed-on: https://go-review.googlesource.com/c/go/+/368316
Trust: Jeremy Faller <jeremy@golang.org>
Run-TryBot: Jeremy Faller <jeremy@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-12-02 22:03:54 +00:00
Jeremy Faller
94e22fa03e doc/go1.18: add Conn.NetConn documentation to crypto/tls section
Updates #47694

Change-Id: Iead44baa8b2a06ecf7b92d343ed9117f0fc0793e
Reviewed-on: https://go-review.googlesource.com/c/go/+/368315
Trust: Jeremy Faller <jeremy@golang.org>
Trust: Katie Hockman <katie@golang.org>
Run-TryBot: Jeremy Faller <jeremy@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Katie Hockman <katie@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Agniva De Sarker <agniva.quicksilver@gmail.com>
2021-12-02 22:03:34 +00:00
Jeremy Faller
d3bf627bc1 doc/go1.18: add constraints package documentation
Updates #47694

Change-Id: I3239023dad194c317e271e6093eff2cfbed1a4b9
Reviewed-on: https://go-review.googlesource.com/c/go/+/368314
Trust: Jeremy Faller <jeremy@golang.org>
Run-TryBot: Jeremy Faller <jeremy@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-12-02 22:03:11 +00:00
Jeremy Faller
d514411625 doc/go1.18: add information on new pacer.
This is based off Michael's notes.

Updates #47694

Change-Id: I6e7944f85b776e8481829a2fafd177a49557c6ca
Reviewed-on: https://go-review.googlesource.com/c/go/+/368156
Trust: Jeremy Faller <jeremy@golang.org>
Run-TryBot: Jeremy Faller <jeremy@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2021-12-02 22:02:54 +00:00
Dan Scales
bbe1be5c19 cmd/compile: report channel size errors correctly for -G=3
First, we need to set base.Pos in varDecl() and typeDecl(), so it will
be correct if we need to report type size errors while converting types.
Changed error calls in types/sizes.go to use Errorf, not ErrorfAt, since
we want to use base.Pos (which will set from t.Pos(), if that is
available).

Second, we need to add an extra call CalcSize(t1.Elem()) in the
TCHANARGS case of CalcSize(). We can use CalcSize() rather than
CheckSize(), since we know the top-level recursive type will have been
calculated by the time we process the fake TCHANARGS type. In -G=0 mode,
the size of the channel element has often been calculated because of
some other processing (but not in the case of #49767). But in -G=3 mode,
we just calculate sizes during the single noder2 pass, so we are more
likely to have not gotten to calculating the size of the element yet,
depending on the order of processing of the deferredTypeStack.

Fixes the tests fixedbugs/issue{42058a,42058b}.go that were
disabled for -G=3 mode.

Had to add exceptions in stdlib_test.go for go/types and types2, because
the types2 typechecker does not know about type size limits.

Fixes #49814
Fixes #49771
Updates #49767

Change-Id: I77d058e8ceff68a58c4c386a8cf46799c54b04c3
Reviewed-on: https://go-review.googlesource.com/c/go/+/367955
Trust: Dan Scales <danscales@google.com>
Run-TryBot: Dan Scales <danscales@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2021-12-02 20:49:56 +00:00
Jeremy Faller
3c6295d272 doc/go1.18: add short-circuit evaluation for text/template
This description is based on https://golang.org/cl/321490.

Updates #47694

Change-Id: I48656cd487d2fccf0b0d3390f350f1bc6f2b0080
Reviewed-on: https://go-review.googlesource.com/c/go/+/365738
Trust: Jeremy Faller <jeremy@golang.org>
Trust: Dmitri Shuralyov <dmitshur@golang.org>
Run-TryBot: Jeremy Faller <jeremy@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2021-12-02 20:45:47 +00:00
Robert Findley
469f030dca all: update vendored golang.org/x/tools
Update the vendored x/tools to pick up CL 364678, which updates vet
analyzers following a change to the underlying of type parameters.

This also pulls in significant changes to the typeutil package to
support new constructs in typeutil.Map, but this is not used by vet.

The following commands were used:

  go get -d golang.org/x/tools@e212aff8fd146c44ddb0167c1dfbd5531d6c9213
  go mod tidy
  go mod vendor

Fixes #49855

Change-Id: I3ffc59f3693710c83b81d390999aeabc8043723b
Reviewed-on: https://go-review.googlesource.com/c/go/+/368774
Trust: Robert Findley <rfindley@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
2021-12-02 20:21:16 +00:00
Michael Anthony Knyszek
c5c1955077 runtime: break out new minimum heap size into a goexperiment
The new minimum heap of 512 KiB has been the cause of some build
slowdown (~1%) and microbenchmark slowdown (usually ~0%, up to ~50%)
because of two reasons:
1. Applications with lots of small short-lived processes execute many
   more GC cycles.
2. Applications with heaps <4 MiB GC up to 8x more often.

In many ways these consequences are inevitable given how GOGC works,
however we need to investigate more as to whether the apparent slowdowns
are indeed unavoidable or if the GC has issues scaling down, which it's
too late for for this release.

Given that this release is already huge, it's OK to push this back.
We'll take a closer look at it next cycle, so place block it behind a
new goexperiment to allow users and ourselves to easily experiment with
it.

Fixes #49744.
Updates #44167.

Change-Id: Ibad51f7873de7517490c89802f3c593834e77ff0
Reviewed-on: https://go-review.googlesource.com/c/go/+/368137
Trust: Michael Knyszek <mknyszek@google.com>
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: David Chase <drchase@google.com>
2021-12-02 18:02:46 +00:00
Changkun Ou
36be0beb05 misc/ios: bump min version
For #48076

Change-Id: I5edaa43af82c3478555c309a001a3d1b16de3d64
Reviewed-on: https://go-review.googlesource.com/c/go/+/368615
Run-TryBot: Cherry Mui <cherryyz@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Roland Shoemaker <roland@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
2021-12-02 16:48:07 +00:00
Austin Clements
28ec0fdeb5 runtime: print errno on clock_gettime failure on OpenBSD
For #49532.

Change-Id: I5afc64c987f0519903128550a7dac3a0f5e592cf
Reviewed-on: https://go-review.googlesource.com/c/go/+/368334
Trust: Austin Clements <austin@google.com>
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: Joel Sing <joel@sing.id.au>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2021-12-02 15:48:58 +00:00
Dan Scales
d34051bf16 cmd/compile: fix case where g.curDecl should be saved/restored
When we set g.curDecl for the type params created during fillinMethods
for an instantiated type, we need to save/restore its value, because
fillinMethods() may be called while processing a typeDecl. We want the
value of g.curDecl to continue to be correct for type params created in
the typeDecl. Because of ordering issues, not restoring g.curDecl
happens to cause problems (which don't always show up visibly) exactly
when a type param is not actually used in a type declaration.

Cleared g.curDecl to "" at the later points in typeDecl() and
funcDecl(). This allows adding asserts that g.curDecl is always empty
("") when we set it in typeDecl() and funcDecl(), and always non-empty
when we use it in typ0().

Fixes #49893

Change-Id: Ic2fb1df791585bd257f2b86ffaae0453c31705c5
Reviewed-on: https://go-review.googlesource.com/c/go/+/368454
Trust: Dan Scales <danscales@google.com>
Run-TryBot: Dan Scales <danscales@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2021-12-02 07:04:05 +00:00
Bryan C. Mills
1b2930d70c net: remove arbitrary deadlines in PacketConn tests
When TestPacketConn was added (in CL 6501057) it included arbitrary
100ms deadlines. Those deadlines were arbitrarily increased to 500ms
in CL 4922.

If the test is actually provoking a deadlock, allowing it to deadlock
will give us a more useful goroutine dump. Otherwise, the deadlines
don't seem all that useful — they appear to increase code coverage,
but have no effect on the test in the typical case, and can only
cause flakes on particularly-slow machines.

For #43627

Change-Id: I83de5217c54c743b83adddf51d4f6f2bd5b91732
Reviewed-on: https://go-review.googlesource.com/c/go/+/368215
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-12-02 05:26:57 +00:00
Bryan C. Mills
00dbcb33f8 os/exec: in TestContextCancel, dump goroutines on failure
If this test fails, we want to know exactly what the os/exec
goroutines are doing. Panicking gives us a goroutine dump,
whereas t.Fatal does not.

While we're here, use exponential backoff instead of a hard-coded 1ms
sleep. We want to give the OS enough time to actually terminate the
subprocess.

For #42061

Change-Id: I3d50a71ac314853c68a935218e7f97ce18b08b5b
Reviewed-on: https://go-review.googlesource.com/c/go/+/368317
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-12-02 05:25:23 +00:00
Cherry Mui
c3a7fb2074 doc/go1.18: mention stack trace change
For #47694.

Change-Id: I06cac88d5328c8c0e38212ad801d70bc36cdfc6f
Reviewed-on: https://go-review.googlesource.com/c/go/+/368234
Trust: Cherry Mui <cherryyz@google.com>
Reviewed-by: Austin Clements <austin@google.com>
2021-12-01 22:20:39 +00:00
Robert Findley
0103fd2b8b gcimporters: allow reusing empty interfaces on the RHS of type decls
We guard against caching or reusing interfaces on the RHS of a type
declaration, because for such interfaces the base type is used as the
interface method receiver type. However, we don't need to do this for
empty interfaces. By refining our guard, we can allow importing the
predeclared 'any' type on the RHS of a type declaration.

Update tests to add more coverage for importing generic export data.
Some accomodation had to be made for the unified builder, which does not
yet fully support generics in export data.

Fixes #49888

Change-Id: I51f329de464fc7309f95991b839ab55868c2924f
Reviewed-on: https://go-review.googlesource.com/c/go/+/367851
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-12-01 19:00:50 +00:00
Baokun Lee
6c4bf8fb8a cmd/go/internal/modfetch: remove legacy code
ReadFileRevs function is no longer used.

Change-Id: Ibac6319dca4cf8010195e7c2fb502655494fb728
Reviewed-on: https://go-review.googlesource.com/c/go/+/367756
Run-TryBot: Baokun Lee <bk@golangcn.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Baokun Lee <bk@golangcn.org>
2021-12-01 18:48:35 +00:00
Austin Clements
08ecdf7c2e runtime: fix racy allgs access on weak memory architectures
Currently, markroot is very clever about accessing the allgs slice to
find stack roots. Unfortunately, on weak memory architectures, it's a
little too clever and can sometimes read a nil g, causing a fatal
panic.

Specifically, gcMarkRootPrepare snapshots the length of allgs during
STW and then markroot accesses allgs up to this length during
concurrent marking. During concurrent marking, allgadd can append to
allgs *without synchronizing with markroot*, but the argument is that
the markroot access should be safe because allgs only grows
monotonically and existing entries in allgs never change.

This reasoning is insufficient on weak memory architectures. Suppose
thread 1 calls allgadd during concurrent marking and that allgs is
already at capacity. On thread 1, append will allocate a new slice
that initially consists of all nils, then copy the old backing store
to the new slice (write A), then allgadd will publish the new slice to
the allgs global (write B). Meanwhile, on thread 2, markroot reads the
allgs slice base pointer (read A), computes an offset from that base
pointer, and reads the value at that offset (read B). On a weak memory
machine, thread 2 can observe write B *before* write A. If the order
of events from thread 2's perspective is write B, read A, read B,
write A, then markroot on thread 2 will read a nil g and then panic.

Fix this by taking a snapshot of the allgs slice header in
gcMarkRootPrepare while the world is stopped and using that snapshot
as the list of stack roots in markroot. This eliminates all read/write
concurrency around the access in markroot.

Alternatively, we could make markroot use the atomicAllGs API to
atomically access the allgs list, but in my opinion it's much less
subtle to just eliminate all of the interesting concurrency around the
allgs access.

Fixes #49686.
Fixes #48845.
Fixes #43824.
(These are all just different paths to the same ultimate issue.)

Change-Id: I472b4934a637bbe88c8a080a280aa30212acf984
Reviewed-on: https://go-review.googlesource.com/c/go/+/368134
Trust: Austin Clements <austin@google.com>
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2021-12-01 17:13:34 +00:00
Bryan C. Mills
8ebb8c9ecb runtime: give the subprocess more time in TestSpuriousWakeupsNeverHangSemasleep
Issue #27250 reproduced readily enough to keep the subprocess hung
indefinitely when it occurred, so the timeout does not need to be
short to maintain test fidelity. On the other hand, on heavily loaded
systems it might take a while for the kernel to actually start the
subprocess, and it might also take a while for control flow to return
to the test after the subprocess exits.

We can reduce noise from this test in two ways:

1. Measure the timeout from closer to when the subprocess actually
starts sleeping, instead of when we started creating the subprocess.

2. Use a longer timeout, since it doesn't actually need to be short.

Fixes #38921
Updates #27250

Change-Id: I01c11ae82d0cdc6e7def2da6544b4d07201b35e8
Reviewed-on: https://go-review.googlesource.com/c/go/+/367849
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2021-12-01 17:01:41 +00:00
Rhys Hiltner
2c5d2083e4 runtime: fix riscv64 sigaction mask field offset
The Linux kernel for riscv64 does not include an sa_restorer field on
its sigaction struct, and expects sa_mask to come immediately after the
sa_flags field. Arrange the fields of the sigaction struct that are
known to the kernel so they appear at the correct byte offsets, and so
they agree with the output of "go tool cgo -godefs".

Follow the example set by the mips/mipsle port to leave the sa_restorer
field in place, but at an offset where it won't hurt anything.

Fixes #49709

Change-Id: I9bb0d7dbd7439d07e3a204461c7d790f33fd4977
Reviewed-on: https://go-review.googlesource.com/c/go/+/367635
Run-TryBot: Rhys Hiltner <rhys@justin.tv>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Joel Sing <joel@sing.id.au>
Trust: Ian Lance Taylor <iant@golang.org>
2021-12-01 16:55:04 +00:00
Cherry Mui
029dfbcc83 net: do not use sendfile on iOS
Apparently, on the iOS builder sendfile causes a SIGSYS signal
(instead of returning ENOSYS). Disabling it for now so we can
make progress on iOS. We can revisit if sendfile is actually
broken on iOS and whether it is beneficial.

Updates #49616.

Change-Id: I3883fad0ce35e3f0aa352301eb499a1afa0225a1
Reviewed-on: https://go-review.googlesource.com/c/go/+/368054
Trust: Cherry Mui <cherryyz@google.com>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Changkun Ou <mail@changkun.de>
Reviewed-by: Roland Shoemaker <roland@golang.org>
2021-12-01 15:58:46 +00:00
Bryan C. Mills
ab7905540b cmd/go/internal/modload: fix up main-module checks from CL 334932
Some critical Version == "" checks were missing in mvs.go, causing
mvs.Req to fail to retain requirements provided by older versions of
main modules.

A few checks also ought to be rotated to put the less expensive
string-equality checks before the more expensive map lookups.

Fixes #48511

Change-Id: Ib8de9d49a6413660792c003866bfcf9ab7f82ee2
Reviewed-on: https://go-review.googlesource.com/c/go/+/368136
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2021-12-01 15:43:08 +00:00
Cuong Manh Le
0e1d553b4d cmd/compile: fix identical to recognize any and interface{}
Currently, identical handles any and interface{} by checking against
Types[TINTER]. This is not always true, since when two generated
interface{} types may not use the same *Type instance.

Instead, we must check whether Type is empty interface or not.

Fixes #49875

Change-Id: I28fe4fc0100041a01bb03da795cfe8232b515fc4
Reviewed-on: https://go-review.googlesource.com/c/go/+/367754
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2021-12-01 10:19:34 +00:00
Tobias Klauser
a412b5f0d8 runtime: skip TestSignalIgnoreSIGTRAP on all OpenBSD builders
TestSignalIgnoreSIGTRAP is flaky on OpenBSD and the cause is suspected
to be a kernel bug. This test is currently only skipped on the previous
OpenBSD 6.2 and 6.4 builders for #17496. In the meantime the OpenBSD
builders were upgraded to more recent OpenBSD versions (currently 6.8
and 7.0). It seems the issue is still present in these OpenBSD versions
and there is no obvious workaround in Go. Thus, skip the flaky test on
OpenBSD in general.

Updates #17496
Updates #49725

Change-Id: I3577d287dcfaad7a81679db2e71540854fce065a
Reviewed-on: https://go-review.googlesource.com/c/go/+/367115
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>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2021-12-01 06:03:27 +00:00
Paul E. Murphy
7ccbcc9056 misc/cgo/test: further reduce likeliness of hang in Test9400
As suggested by #49680, a GC could be in-progress when we
disable GC. Force a GC after we pause to ensure we don't
hang in this case.

For #49695

Change-Id: I4fc4c06ef2ac174217c3dcf7d58c7669226e2d24
Reviewed-on: https://go-review.googlesource.com/c/go/+/367874
Run-TryBot: Paul Murphy <murp@ibm.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Paul Murphy <murp@ibm.com>
2021-11-30 20:04:58 +00:00
Chaoqun Han
5f63f168da runtime: add invalidptr=0 for TestGcZombieReporting
pointers in zombies slice may cross-span, add invalidptr=0 for avoiding the badPointer check

Fixes #49613

Change-Id: Ifb1931922170e87e799e2e6081dc85dab3890205
Reviewed-on: https://go-review.googlesource.com/c/go/+/367044
Trust: Emmanuel Odeke <emmanuel@orijtech.com>
Run-TryBot: Emmanuel Odeke <emmanuel@orijtech.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
2021-11-30 18:49:39 +00:00
Russ Cox
931d80ec17 cmd/go: adjust BuildInfo.Settings
Make Settings more closely align with command-line flags
and environment variables.

- Change command-line flags to begin with -

- Change syntax of build lines to use Key=Value instead of Key<tab>Value.

- Change CGO_ENABLED to 0/1, matching environment variable,
  instead of false/true.

- Add GOOS and GOARCH.
  These are technically redundant, in that they can be extracted
  from the binary in other ways most of the time, but not always:
  GOOS=ios and GOOS=darwin may produce binaries that are
  difficult to tell apart. In any case, it's a lot easier to have them
  directly in the settings list than derive them from other parts
  of the binary.

- Add GOEXPERIMENT.
  These could be inferred from the tags list, but the experiments
  are being removed from the tags list.

- Change the tags list to match the -tags command-line argument.

- Add msan and race, echoing the -msan and -race arguments
  (always 'true' when present, omitted when false).

- Add GO$GOARCH when set.

Change-Id: Icb59ef4faa5c22407eadd94147b7e53cf4344ce6
Reviewed-on: https://go-review.googlesource.com/c/go/+/358539
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2021-11-30 18:09:02 +00:00