]> Cypherpunks.ru repositories - gostls13.git/log
gostls13.git
2 years ago.github: remove duplicate security link
Dmitri Shuralyov [Fri, 7 Jan 2022 17:50:37 +0000 (17:50 +0000)]
.github: remove duplicate security link

Since a SECURITY.md file is present in the main Go repository,
GitHub already shows a "Report a security vulnerability" link
in the issue template list. Remove the duplicate custom link.

Fixes #49962.

Change-Id: Ifdf7e93b76ebd9258d907aa9cb4915c0dbc4f93e
Reviewed-on: https://go-review.googlesource.com/c/go/+/376357
Trust: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Julie Qiu <julie@golang.org>
2 years agotest/typeparam: adjust test preamble (fix longtests)
Robert Griesemer [Fri, 7 Jan 2022 04:06:40 +0000 (20:06 -0800)]
test/typeparam: adjust test preamble (fix longtests)

For #50481.

Change-Id: I27e6c6499d6abfea6e215d8aedbdd5074ff88291
Reviewed-on: https://go-review.googlesource.com/c/go/+/376216
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
2 years agospec: be more precise with rules on specific types
Robert Griesemer [Thu, 6 Jan 2022 05:37:04 +0000 (21:37 -0800)]
spec: be more precise with rules on specific types

Problem pointed out on golang-nuts mailing list.

Change-Id: If1c9b22e1ed7b4ec7ebcaadc80fa450333e6856c
Reviewed-on: https://go-review.googlesource.com/c/go/+/375799
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2 years agodoc/go1.18: point to spec in same directory for release notes
Robert Griesemer [Sat, 18 Dec 2021 01:17:41 +0000 (17:17 -0800)]
doc/go1.18: point to spec in same directory for release notes

The release notes explicitly refer to sections updated
for generics in the spec but then point to the old spec
which is very confusing for beta users.

For #47694

Change-Id: I5b555db3543cc32f088a8b267ec3f1195a52a812
Reviewed-on: https://go-review.googlesource.com/c/go/+/373174
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2 years agotest/typeparam: adjust test preamble (fix longtests)
Robert Griesemer [Fri, 7 Jan 2022 02:23:01 +0000 (18:23 -0800)]
test/typeparam: adjust test preamble (fix longtests)

For #50317.

Change-Id: I24ccf333c380283a36b573ef8fc3e7fcd71bd17f
Reviewed-on: https://go-review.googlesource.com/c/go/+/376215
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Dan Scales <danscales@google.com>
Trust: Dan Scales <danscales@google.com>

2 years agotest/typeparam: adjust test preamble (fix longtests)
Robert Griesemer [Fri, 7 Jan 2022 00:50:49 +0000 (16:50 -0800)]
test/typeparam: adjust test preamble (fix longtests)

For #50417.

Change-Id: Ic55727c454ec342354f7fbffd22aa350e0d392c2
Reviewed-on: https://go-review.googlesource.com/c/go/+/376174
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Dan Scales <danscales@google.com>
Trust: Dan Scales <danscales@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

2 years agomath/big: fix spurious race in Rat.Denom, Float.SetRat
Russ Cox [Thu, 6 Jan 2022 17:20:14 +0000 (12:20 -0500)]
math/big: fix spurious race in Rat.Denom, Float.SetRat

Rat maintains the invariant that x.b.neg is always false,
but Rat.Denom was writing x.b.neg = false itself too.
That makes Rat.Denom a writing operation, when it should
be a read-only operation. That in turn makes it unsafe to
use from multiple goroutines, which is highly unexpected.
Make it read-only and therefore race-free again.

Fixes #50473.

Change-Id: I97b87913954511e5200c0665d16b9ed63422e505
Reviewed-on: https://go-review.googlesource.com/c/go/+/375935
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2 years agogo/types, types2: disallow multiple blank type parameters
Robert Griesemer [Thu, 6 Jan 2022 22:10:45 +0000 (14:10 -0800)]
go/types, types2: disallow multiple blank type parameters

Work-around for #50481: report an error for multiple
blank type parameters. It's always possible to use
non-blank names in those cases.

We expect to lift this restriction for 1.19.

For #50481.

Change-Id: Ifdd2d91340aac1da3387f7d80d46e44f5997c2a8
Reviewed-on: https://go-review.googlesource.com/c/go/+/376058
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
Trust: Dan Scales <danscales@google.com>
Reviewed-by: Dan Scales <danscales@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

2 years agocmd/compile: report type parameter error for methods only once
Robert Griesemer [Thu, 6 Jan 2022 18:58:30 +0000 (10:58 -0800)]
cmd/compile: report type parameter error for methods only once

Move switch to enable method type parameters entirely
to the parser, by adding the mode AllowMethodTypeParams.
Ensure that the error messages are consistent.
Remove unnecessary code in the type checker.

Fixes #50317.

Change-Id: I4f3958722400bdb919efa4c494b85cf62f4002bb
Reviewed-on: https://go-review.googlesource.com/c/go/+/376054
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

2 years agotesting: fix deadlock with t.Parallel in testing seed corpus
Katie Hockman [Wed, 22 Dec 2021 15:34:55 +0000 (10:34 -0500)]
testing: fix deadlock with t.Parallel in testing seed corpus

The c.startParallel channel on the testContext is stuck
in t.Parallel() because c.running starts at 1 for the main
fuzz parent test, and is causing a deadlock because it is
never released. It would normally be released by tRunner,
but needs to instead be released by fRunner instead for fuzz
tests.

Fixes #50217

Change-Id: I2d010e9adddfd8e8321ff2f9dd2e43daf46c128f
Reviewed-on: https://go-review.googlesource.com/c/go/+/374054
Reviewed-by: Roland Shoemaker <roland@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
Trust: Katie Hockman <katie@golang.org>
Run-TryBot: Katie Hockman <katie@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>

2 years agogo/types, types2: implement field access for struct structural constraints
Robert Griesemer [Wed, 5 Jan 2022 23:46:31 +0000 (15:46 -0800)]
go/types, types2: implement field access for struct structural constraints

This change implements field the access p.f where the type of p
is a type parameter with a structural constraint that is a struct
with a field f. This is only the fix for the type checker. The
compiler will need a separate CL.

This makes the behavior consistent with the fact that we can
write struct composite literals for type parameters with a
struct structural type.

For #50417.
For #50233.

Change-Id: I87d07e016f97cbf19c45cde19165eae3ec0bad2b
Reviewed-on: https://go-review.googlesource.com/c/go/+/375795
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2 years agogo/types, types2: remove unused code in lookupFieldOrMethod
Robert Griesemer [Wed, 5 Jan 2022 05:01:21 +0000 (21:01 -0800)]
go/types, types2: remove unused code in lookupFieldOrMethod

The underlying type of a type parameter is an interface,
so we don't need a special case for type parameters anymore.
Simply share the (identical) code for interfaces.

Adjust code in types.NewMethodSet accordingly.

No functional difference.
Preparation for fix of issues below.

For #50233.
For #50417.

Change-Id: Ib2deadd12f89e6918dec224b4ce35583001c3101
Reviewed-on: https://go-review.googlesource.com/c/go/+/375514
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2 years agogo/types, types2: ensure that signature type bounds are interfaces
Robert Griesemer [Wed, 5 Jan 2022 20:25:43 +0000 (12:25 -0800)]
go/types, types2: ensure that signature type bounds are interfaces

Do this by running verification for instantiated signatures
later, after the delayed type parameter set-up had a chance
to wrap type bounds in implicit interfaces where needed.

Fixes #50450

Change-Id: If3ff7dc0be6af14af854830bfddb81112ac575cb
Reviewed-on: https://go-review.googlesource.com/c/go/+/375737
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2 years agotime: skip TestTimerModifiedEarlier on plan9/arm
Bryan C. Mills [Thu, 6 Jan 2022 16:59:09 +0000 (11:59 -0500)]
time: skip TestTimerModifiedEarlier on plan9/arm

This test is observed to be flaky on the plan9-arm builder.
Skip it on that platform until it can be diagnosed and fixed.

For #50470

Change-Id: If626af426d856c377e00ac5baaca52899456556e
Reviewed-on: https://go-review.googlesource.com/c/go/+/375934
Trust: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2 years agotest: add test of incorrect gofrontend error
Ian Lance Taylor [Thu, 6 Jan 2022 04:22:15 +0000 (20:22 -0800)]
test: add test of incorrect gofrontend error

For #50439

Change-Id: Ifad6e6f8de42121c695b5a4dc56e0f6606e2917e
Reviewed-on: https://go-review.googlesource.com/c/go/+/375796
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
Trust: Than McIntosh <thanm@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2 years agogo/types, types2: eagerly check that constraints are not type params
Robert Findley [Thu, 23 Dec 2021 15:33:17 +0000 (10:33 -0500)]
go/types, types2: eagerly check that constraints are not type params

As a result of the change to the underlying of a type parameter to be
its constraint interface, we had couple inaccuracies that combined to
cause an infinite recursion when type checking the invalid type
parameter list [A A].
 - We deferred tpar.iface() using check.later twice: once in
   newTypeParam, and then again at the end of collectTypeParams.
 - We deferred the check that type parameter constraints are not type
   parameters, even though this is unnecessary: the constraint type is
   known.

With these inaccuracies, tpar.iface() was executing before our guard
against using type parameters as constraints, causing an infinite
recursion through under().

Fix this by eagerly checking whether the constraint is a type
parameter, and marking it invalid if so. Also remove the unnecessary
calls to tpar.iface() at the end of collectTypeParams, as this will
already have been scheduled by newTypeParam.

Fixes #50321

Change-Id: I4eecbecf21656615867cb94be65b520e9e795bd1
Reviewed-on: https://go-review.googlesource.com/c/go/+/374294
Reviewed-by: Robert Griesemer <gri@golang.org>
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

2 years agocmd/compile/internal/types2: better error message for invalid range clause
Robert Griesemer [Tue, 4 Jan 2022 23:13:33 +0000 (15:13 -0800)]
cmd/compile/internal/types2: better error message for invalid range clause

Fixes #50372.

Change-Id: I8e4c0020dae42744cce016433e398e0b884bb044
Reviewed-on: https://go-review.googlesource.com/c/go/+/375475
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2 years agonet: synchronize instead of sleeping in TestDialParallelSpuriousConnection
Bryan C. Mills [Wed, 5 Jan 2022 16:13:27 +0000 (11:13 -0500)]
net: synchronize instead of sleeping in TestDialParallelSpuriousConnection

The arbitrary sleep in this test is empirically not always long enough
on slower builders. However, we know the exact number of connections
that should be dialed: we can wait on that number in the dial hook
instead.

Fixes #34495

Change-Id: I538244ceb75a80271a724304b993309482bd5b41
Reviewed-on: https://go-review.googlesource.com/c/go/+/375694
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>

2 years agoruntime: crash on netbsd-arm64 when setcontext fails
Benny Siegert [Thu, 6 Jan 2022 11:27:57 +0000 (11:27 +0000)]
runtime: crash on netbsd-arm64 when setcontext fails

Instead of exiting with status 16962 when we fail to call SYS_setcontext
in sigreturn, reference a null pointer and crash. Hopefully, this will
enable grabbing a core dump to debug.

Updates #42422

Change-Id: If02c14a0a37084351f3f00db3dc9766cb68ae4b8
Reviewed-on: https://go-review.googlesource.com/c/go/+/375834
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Trust: Benny Siegert <bsiegert@gmail.com>

2 years agodoc: improve documentation for GOAMD64
Ulrich Kunitz [Wed, 15 Dec 2021 10:37:36 +0000 (11:37 +0100)]
doc: improve documentation for GOAMD64

The change clarifies in the release notes for go1.18 that the variable
is for compilation and references the microarchitecture description in
the Go Wiki,
https://golang.org/wiki/MinimumRequirements#amd64,
and references the same information in the output of go help
environment.

Fixes #50174

Change-Id: I6a7d5a06f48463a810c96cc9c76fe66113d5147c
Reviewed-on: https://go-review.googlesource.com/c/go/+/372194
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>

2 years agocmd/go: add fuzzing coverage test
Roland Shoemaker [Wed, 5 Jan 2022 20:25:28 +0000 (12:25 -0800)]
cmd/go: add fuzzing coverage test

Adds a test script for fuzzing coverage instrumentation.

Fixes #48654

Change-Id: Ieea7b4146bd5581baae869441cc1c652dd7485f5
Reviewed-on: https://go-review.googlesource.com/c/go/+/375736
Trust: Katie Hockman <katie@golang.org>
Reviewed-by: Katie Hockman <katie@golang.org>
Trust: Roland Shoemaker <roland@golang.org>
Run-TryBot: Roland Shoemaker <roland@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>

2 years agonet/http: skip TestClientTimeout_h{1,2} on windows/arm and windows/arm64
Bryan C. Mills [Wed, 5 Jan 2022 19:20:30 +0000 (14:20 -0500)]
net/http: skip TestClientTimeout_h{1,2} on windows/arm and windows/arm64

These tests are empirically flaky on the windows/arm and windows/arm64
builders, with a consistent (but rare) failure mode.

This change skips the test if that particular failure mode is
encountered on those platforms; the skip can be removed if and when
someone has the time to pin down the root cause.

For #43120

Change-Id: Ie3a9a06bf47e3a907c7b07441acc1494a4631135
Reviewed-on: https://go-review.googlesource.com/c/go/+/375635
Trust: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

2 years agoruntime: ensure that asmsyscall6 follow AIX stack convention
Clément Chigot [Fri, 17 Dec 2021 10:03:21 +0000 (11:03 +0100)]
runtime: ensure that asmsyscall6 follow AIX stack convention

The function asmsyscall6 must follow AIX stack layout. It means
that its first local variable must be stored after its arguments
area, ie after offset 112.

Fixes #50185

Change-Id: I897731ddd2a9faad8218443a4c2f4b204ad7e173
Reviewed-on: https://go-review.googlesource.com/c/go/+/373074
Trust: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2 years agosrc/runtime: mark asanread and asanwrite functions as NOSPLIT
fanzha02 [Thu, 30 Dec 2021 03:09:42 +0000 (11:09 +0800)]
src/runtime: mark asanread and asanwrite functions as NOSPLIT

The asan runtime functions may run on stacks that cannot grow, and
they do not have large local variables, so it is safe to mark them
as NOSPLIT.

Add test case.

Fixes #50391

Change-Id: Iadcbf1ae0c837d9b64da5be208c7f424e6ba11de
Reviewed-on: https://go-review.googlesource.com/c/go/+/374398
Trust: Emmanuel Odeke <emmanuel@orijtech.com>
Trust: Fannie Zhang <Fannie.Zhang@arm.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2 years agonet: do not panic on nil IPNet.String()
Jason A. Donenfeld [Tue, 4 Jan 2022 23:16:40 +0000 (00:16 +0100)]
net: do not panic on nil IPNet.String()

The code looks like it was already trying to avoid this but missed a
spot.

Fixes #50271.

Change-Id: I450adac3f618b9535b61a28e6a160eacc351d47c
Reviewed-on: https://go-review.googlesource.com/c/go/+/373075
Trust: Jason Donenfeld <Jason@zx2c4.com>
Run-TryBot: Jason Donenfeld <Jason@zx2c4.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2 years agocmd/compile: save selector/inst info for generic method/function calls
Dan Scales [Tue, 21 Dec 2021 15:59:16 +0000 (07:59 -0800)]
cmd/compile: save selector/inst info for generic method/function calls

In the dict info, we need to save the SelectorExpr of a generic method
call when making its sub-dictionary entry. The generic method call will
eventually be transformed into a function call on the method shape
instantiation, so we may not always have the selector info available
when we need it to create a dictionary. We use this SelectorExpr as
needed if the relevant call node has already been transformed.

Similarly, we save the InstExpr of generic function calls, since the
InstExpr will be dropped when the function call is transformed to a call
to a shape instantiation. We use this InstExpr if the relevant function
call has already been transformed.

Added an extra generic function Some2 and a call to it from Some that
exercises the generic function case. The existing test already tests the
method call case.

Fixes #50264

Change-Id: I2c7c7d79a8e33ca36a5e88e64e913c57500c97f9
Reviewed-on: https://go-review.googlesource.com/c/go/+/373754
Reviewed-by: Keith Randall <khr@golang.org>
Trust: Dan Scales <danscales@google.com>
Run-TryBot: Dan Scales <danscales@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

2 years agocmd/compile: pop instantiations of local types when leaving scope
Dan Scales [Thu, 16 Dec 2021 02:42:00 +0000 (18:42 -0800)]
cmd/compile: pop instantiations of local types when leaving scope

Since we use existing instantiations from the symbol table when possible
(to make sure each instantiation is unique), we need to pop
instantiations of local types when leaving the containing scope.
g.stmts() now pushes and pops scope, and we do a Pushdcl() in g.typ0()
when creating an instantiation of a local type.

Non-instantiated local types (generic or not) are translated directly
from types2, so they don't need to be pushed/popped. We don't export
function bodies with local types, so there is no issue during import.

We still don't support local types in generic functions/methods.

Fixes #50177

Change-Id: If2d2fe71aec003d13f0338565c7a0da2c9580a14
Reviewed-on: https://go-review.googlesource.com/c/go/+/372654
Reviewed-by: Keith Randall <khr@golang.org>
Trust: Dan Scales <danscales@google.com>
Run-TryBot: Dan Scales <danscales@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

2 years agodoc/go1.18: mention new cmd/go fuzzing flags
Ian Lance Taylor [Thu, 23 Dec 2021 23:57:54 +0000 (15:57 -0800)]
doc/go1.18: mention new cmd/go fuzzing flags

For #47694

Change-Id: I00da9bd39700e938ec492daa71aba2035d911a06
Reviewed-on: https://go-review.googlesource.com/c/go/+/374354
Trust: Ian Lance Taylor <iant@golang.org>
Trust: Katie Hockman <katie@golang.org>
Reviewed-by: Katie Hockman <katie@golang.org>
2 years agogo/doc: handle generic receiver strings
Jonathan Amsterdam [Sat, 18 Dec 2021 12:28:16 +0000 (07:28 -0500)]
go/doc: handle generic receiver strings

A receiver expression for a type with parameters may be an IndexExpr
or IndexListExpr in addition to an Ident or StarExpr. Add cases to
recvString to account for the new types.

Add tests that compare the fields of Func, and the fields of Type that
hold Funcs. These fields weren't previously tested.

Change-Id: Ia2cef51c85113422e0c5745c77dddcd53507ee51
Reviewed-on: https://go-review.googlesource.com/c/go/+/375095
Trust: Jonathan Amsterdam <jba@google.com>
Run-TryBot: Jonathan Amsterdam <jba@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2 years agogo/doc: use subtests
Jonathan Amsterdam [Fri, 17 Dec 2021 15:30:51 +0000 (10:30 -0500)]
go/doc: use subtests

Change the Test function to use sub-tests for each doc mode and
package.

This will allow more fine-grained test execution.

Change-Id: Ie3dda5791bda2781a60776886dd39fd18e670e24
Reviewed-on: https://go-review.googlesource.com/c/go/+/375094
Trust: Jonathan Amsterdam <jba@google.com>
Run-TryBot: Jonathan Amsterdam <jba@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2 years agoos: simplify ios checks in tests
Tobias Klauser [Thu, 30 Dec 2021 13:06:30 +0000 (14:06 +0100)]
os: simplify ios checks in tests

Go 1.16 renamed the iOS port from darwin/arm64 to ios/arm64 and
darwin/arm64 was repurposed for the macOS ARM64 port (see
https://golang.org/doc/go1.16#darwin).

Change tests to only use GOOS=ios to detect special cases for iOS and
stop treating darwin/arm64 as iOS.

Change-Id: I6a19f16fa9ec159ab1386aeb8fe912585e457171
Reviewed-on: https://go-review.googlesource.com/c/go/+/374399
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2 years agoos: enable TestMkdirAllWithSymlink on darwin/arm64
Tobias Klauser [Tue, 21 Dec 2021 12:20:20 +0000 (13:20 +0100)]
os: enable TestMkdirAllWithSymlink on darwin/arm64

Go 1.16 renamed the iOS port from darwin/arm64 to ios/arm64 and
darwin/arm64 was repurposed for the macOS ARM64 port (see
https://golang.org/doc/go1.16#darwin).

TestMkdirAllWithSymlink ought to run on darwin/arm64, so enable it on
that platform.

For #45696

Change-Id: I2cad6b1dfddf215e6b6cd262bbd22251f48f3d8c
Reviewed-on: https://go-review.googlesource.com/c/go/+/373359
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
2 years agomisc/cgo/testsanitizers: accept compilers that don't report location
Ian Lance Taylor [Wed, 29 Dec 2021 19:19:13 +0000 (11:19 -0800)]
misc/cgo/testsanitizers: accept compilers that don't report location

It appears that GCC before version 10 doesn't report file/line
location for asan errors.

Change-Id: I03ee24180ba365636596aa2384961df7ce6ed71f
Reviewed-on: https://go-review.googlesource.com/c/go/+/374874
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

2 years agomisc/cgo/testsanitizers: don't fail asan test if no symbolizer
Ian Lance Taylor [Wed, 29 Dec 2021 18:02:27 +0000 (10:02 -0800)]
misc/cgo/testsanitizers: don't fail asan test if no symbolizer

Change-Id: Ic05c641bda3cc8f5292921c9b0c0d3df34f3bc48
Reviewed-on: https://go-review.googlesource.com/c/go/+/374794
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2 years agoruntime: fix the issue that the -asan option cannot print where the error occurred
fanzha02 [Mon, 27 Dec 2021 08:38:48 +0000 (16:38 +0800)]
runtime: fix the issue that the -asan option cannot print where the error occurred

The current -asan option does not print where the error occurred. The
reason is that the current implementation calls incorrect asan runtime
functions, which do not pass sp and pc where asan runtime functions are
called, and report the stack trace from the native code. But asan runtime
functions are called from cgo on a separated stack, so it cannot dump the
Go stack trace correctly.

The correct asan runtime function we should call is __asan_report_error,
which will pass sp and pc, and report where the error occurred correctly.

This patch fixes this issue.

Add the test cases.

Fixes #50362

Change-Id: I12ee1d46c7ae069ddef3d23f2fe86e112db60045
Reviewed-on: https://go-review.googlesource.com/c/go/+/374395
Trust: Fannie Zhang <Fannie.Zhang@arm.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2 years agoruntime: invalid negative frequency while tracing
Meng Zhuo [Fri, 17 Dec 2021 06:15:42 +0000 (14:15 +0800)]
runtime: invalid negative frequency while tracing

The riscv64 Hifive Unmatched is the only platform that
failed on testcase TestAnalyzeAnnotations occasionally
after CL 332954 had merged. The failure happens when
ticks per second (freq) is over 1e12 which causing the timestamps
of two events are same.

There are 2 reasons causing big frequency:
1. RDCYCLE is HART based according to the riscv manual which makes
   negative ticks delta
2. negative float64 -> uint64 is undefined and "lucky" negative float
   is too big to handle for trace

For #46737

Change-Id: I1f3c1ac31aae249969000c719c32aaf5a66d29a5
Reviewed-on: https://go-review.googlesource.com/c/go/+/373034
Trust: Zhuo Meng <mzh@golangcn.org>
Run-TryBot: Zhuo Meng <mzh@golangcn.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2 years agodoc/go1.18: add section for runtime/debug changes
Ian Lance Taylor [Tue, 21 Dec 2021 21:58:15 +0000 (13:58 -0800)]
doc/go1.18: add section for runtime/debug changes

For #37475
For #47694

Change-Id: If8c1f1b756daf32648110f1a669b2ea60f797a24
Reviewed-on: https://go-review.googlesource.com/c/go/+/373875
Trust: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
2 years agodoc/go1.18: mention debug/plan9obj.ErrNoSymbols
Ian Lance Taylor [Tue, 21 Dec 2021 19:59:19 +0000 (11:59 -0800)]
doc/go1.18: mention debug/plan9obj.ErrNoSymbols

For #47694
For #48052

Change-Id: I136be9b498033309d876099aae16bad330555416
Reviewed-on: https://go-review.googlesource.com/c/go/+/373774
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2 years agocmd/go: remove MallocNanoZone environment variable workaround
Cherry Mui [Thu, 23 Dec 2021 18:09:02 +0000 (13:09 -0500)]
cmd/go: remove MallocNanoZone environment variable workaround

We added a workaround in runtime/race. This should not be
necessary now.

Updates #49138.

Change-Id: Ia2010e4acc95c4ddf5f463ab2919401d893c0bac
Reviewed-on: https://go-review.googlesource.com/c/go/+/374314
Trust: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>

2 years agocmd/compile/internal/ir: fix a typo in node.go
zhangjian [Thu, 23 Dec 2021 14:21:41 +0000 (14:21 +0000)]
cmd/compile/internal/ir: fix a typo in node.go

README.md -> HACKING.md

Change-Id: I63909b86b2e6f8d9a34622f5d2b05048c79cd698
GitHub-Last-Rev: afaab8f05eff1d66c796909ccf9912e0f4e99754
GitHub-Pull-Request: golang/go#50326
Reviewed-on: https://go-review.googlesource.com/c/go/+/374274
Run-TryBot: Dan Scales <danscales@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dan Scales <danscales@google.com>
Trust: Dan Scales <danscales@google.com>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
2 years agodoc/go1.18: fix broken HTML in net/http.MaxBytesHandler
Carl Johnson [Wed, 22 Dec 2021 04:23:26 +0000 (04:23 +0000)]
doc/go1.18: fix broken HTML in net/http.MaxBytesHandler

For #47694

Sorry about that! I guess the autocompleter in VSCode auto-closed the paragraph and I didn't notice.

Change-Id: I1e834e47deb708cd5285d26201a442305f8c3b24
GitHub-Last-Rev: ab8873155191072efd51270c85fc6feaed318cdc
GitHub-Pull-Request: golang/go#50305
Reviewed-on: https://go-review.googlesource.com/c/go/+/374014
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Dmitri Shuralyov <dmitshur@golang.org>

2 years agoruntime: handle stray profiling signal better
Cherry Mui [Wed, 22 Dec 2021 16:43:06 +0000 (11:43 -0500)]
runtime: handle stray profiling signal better

In c-archive mode, when we turn off profiling, we  restore the
previous handler for SIGPROF, and ignore SIGPROF signals if no
handler was installed. So if a pending signal lands after we
remove the Go signal handler, it will not kill the program.

In the current code there is a small window, where we can still
receive signals but we are set to not handling the signal. If a
signal lands in this window (possibly on another thread), it will
see that we are not handling this signal and no previous handler
installed, and kill the program. To avoid this race, we set the
previous handler to SIG_IGN (ignoring the signal) when turning on
profiling. So when turning off profiling we'll ignore the signal
even if a stray signal lands in the small window.

Fixes #43828.

Change-Id: I304bc85a93ca0e63b0c0d8e902b097bfdc8e3f1d
Reviewed-on: https://go-review.googlesource.com/c/go/+/374074
Trust: Cherry Mui <cherryyz@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2 years agodoc/go1.18: list new net/netip and net functions and methods
Ian Lance Taylor [Tue, 21 Dec 2021 20:23:53 +0000 (12:23 -0800)]
doc/go1.18: list new net/netip and net functions and methods

For #46518
For #47694

Change-Id: I4848556674baf85ceec350645d9eddcd83f1b2e0
Reviewed-on: https://go-review.googlesource.com/c/go/+/373834
Trust: Ian Lance Taylor <iant@golang.org>
Trust: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2 years agodoc/go1.18: mention testing.F in testing package section
Ian Lance Taylor [Tue, 21 Dec 2021 22:33:47 +0000 (14:33 -0800)]
doc/go1.18: mention testing.F in testing package section

For #47694

Change-Id: I27d88d864319bd8dbabfa6675a6abf2f74c50717
Reviewed-on: https://go-review.googlesource.com/c/go/+/373914
Trust: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Katie Hockman <katie@golang.org>
Trust: Katie Hockman <katie@golang.org>

2 years agodoc/go1.18: document {text,html}/template {break,continue} commands
Ian Lance Taylor [Tue, 21 Dec 2021 22:44:27 +0000 (14:44 -0800)]
doc/go1.18: document {text,html}/template {break,continue} commands

For #20531
For #47694

Change-Id: Iaefaa0a8982eabf59cd6a53120c8af9124d60d1a
Reviewed-on: https://go-review.googlesource.com/c/go/+/373915
Trust: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
2 years agodoc/go1.18: add net/http.MaxBytesHandler
Carl Johnson [Sat, 18 Dec 2021 02:54:22 +0000 (02:54 +0000)]
doc/go1.18: add net/http.MaxBytesHandler

For #47694

Change-Id: Ifab2c2720ec2ccef175a0e14a95f8df0437eb009
GitHub-Last-Rev: f3c2f12c7b6472610428cff5cad2a4497c47150e
GitHub-Pull-Request: golang/go#50250
Reviewed-on: https://go-review.googlesource.com/c/go/+/373015
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
2 years agoos: enable TestPipeThreads on FreeBSD
Tobias Klauser [Tue, 21 Dec 2021 12:13:01 +0000 (13:13 +0100)]
os: enable TestPipeThreads on FreeBSD

This test works on FreeBSD since CL 165801 was submitted.

Updates #19093

Change-Id: I45ffeb403c1de4385cdb21b9647f21976061e1ea
Reviewed-on: https://go-review.googlesource.com/c/go/+/373358
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2 years agodoc/go1.18: mention new go/types/Config.Context field
Ian Lance Taylor [Tue, 21 Dec 2021 20:04:57 +0000 (12:04 -0800)]
doc/go1.18: mention new go/types/Config.Context field

For #47694
For #47916

Change-Id: Ieeffaf161da744adfdb4da8aac58a64c109ebcab
Reviewed-on: https://go-review.googlesource.com/c/go/+/373775
Trust: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2 years agoall: update vendored golang.org/x/crypto for cryptobyte fix
Filippo Valsorda [Tue, 21 Dec 2021 16:49:38 +0000 (11:49 -0500)]
all: update vendored golang.org/x/crypto for cryptobyte fix

Fixes #49678

Change-Id: I47dd959a787180a67856e60dfa6eba3ddd045972
Reviewed-on: https://go-review.googlesource.com/c/go/+/373360
Run-TryBot: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Trust: Filippo Valsorda <filippo@golang.org>

2 years agodoc/go1.18: mention new debug/elf.R_PPC64_RELATIVE constant
Ian Lance Taylor [Thu, 16 Dec 2021 00:30:15 +0000 (16:30 -0800)]
doc/go1.18: mention new debug/elf.R_PPC64_RELATIVE constant

For #47694

Change-Id: I9f4838100741d3ba13e9374e70466fa405c6e4d2
Reviewed-on: https://go-review.googlesource.com/c/go/+/372634
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
2 years agocmd/link: use SHT_INIT_ARRAY for .init_array section
Ian Lance Taylor [Tue, 21 Dec 2021 18:00:23 +0000 (10:00 -0800)]
cmd/link: use SHT_INIT_ARRAY for .init_array section

Fixes #50295

Change-Id: If55ebcd5f2af724da7c9c744458a56d21a7ddde7
Reviewed-on: https://go-review.googlesource.com/c/go/+/373734
Trust: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2 years agoreflect: update relative path in comment
Jing维 [Mon, 20 Dec 2021 00:36:55 +0000 (00:36 +0000)]
reflect: update relative path in comment

Fix it to avoid misunderstanding.

Change-Id: I2a09cb9edfa8077c5c0c35e07000c0c7dc72755e
GitHub-Last-Rev: ae49d512eb7f58421ff2d3b9a8b04500a96ac831
GitHub-Pull-Request: golang/go#50260
Reviewed-on: https://go-review.googlesource.com/c/go/+/373334
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
2 years agonet/http: fix link to ResponseWriter trailer example
Reilly Watson [Mon, 20 Dec 2021 21:31:45 +0000 (16:31 -0500)]
net/http: fix link to ResponseWriter trailer example

The links to this example were using an underscore separator
instead of a hyphen, and incorrect casing.

Fixes #50279

Change-Id: I35d76a8a78cd708b7505ff1a70f7dacddaf43efd
Reviewed-on: https://go-review.googlesource.com/c/go/+/373514
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
2 years agoruntime: typo fix cyle -> cycle
“kinggo” [Mon, 20 Dec 2021 05:54:27 +0000 (05:54 +0000)]
runtime: typo fix cyle -> cycle

Change-Id: I213fa8aa9b9c2537a189677394ddd30c62312518
GitHub-Last-Rev: ccafdee9440b06232cdfca83099bf0aeff62a4c0
GitHub-Pull-Request: golang/go#50268
Reviewed-on: https://go-review.googlesource.com/c/go/+/373336
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Zhuo Meng <mzh@golangcn.org>
2 years agoruntime: check the correct environment variable in TestCgoCallbackGC
Cherry Mui [Tue, 21 Dec 2021 00:08:14 +0000 (19:08 -0500)]
runtime: check the correct environment variable in TestCgoCallbackGC

The test checks RUNTIME_TESTING_SHORT, whereas the test runner
actually set RUNTIME_TEST_SHORT. Check the correct one.

Updates #32023.

Change-Id: Ie8ab00e1f5b8c02112a9aa1ee0e56028185c8a44
Reviewed-on: https://go-review.googlesource.com/c/go/+/373614
Trust: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2 years agonet/netip: add a fuzz test
Andrew LeFevre [Thu, 16 Dec 2021 05:25:09 +0000 (05:25 +0000)]
net/netip: add a fuzz test

This is a pretty straight port of the fuzz test at https://github.com/inetaf/netaddr.

The MarshalText methods of netip.Addr and net.IP, the Is* methods of netip.Addr
and net.IP and the MarshalText and String methods of netip.Addr are also
checked to ensure that they behave the same way.

Fixes #49367

Change-Id: I44abb01f2a7af45f39597992a1fc7ff0305728fa
GitHub-Last-Rev: c2323b0ae119b804a58b810ad7f0e2bb1b3a38ac
GitHub-Pull-Request: golang/go#50108
Reviewed-on: https://go-review.googlesource.com/c/go/+/371055
Trust: Matt Layher <mdlayher@gmail.com>
Trust: Katie Hockman <katie@golang.org>
Reviewed-by: Katie Hockman <katie@golang.org>
2 years agocmd/doc: don't log on constraint type elements
Ian Lance Taylor [Sat, 18 Dec 2021 23:54:38 +0000 (15:54 -0800)]
cmd/doc: don't log on constraint type elements

Fixes #50256

Change-Id: I2327a0b28f8173c801ed2946bec8083967667027
Reviewed-on: https://go-review.googlesource.com/c/go/+/373314
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2 years agoall: fix spelling errors found by misspell
Dan Kortschak [Mon, 20 Dec 2021 07:17:42 +0000 (17:47 +1030)]
all: fix spelling errors found by misspell

Change-Id: Icedd0c3d49259d5aee249ecb33374e9b78e0c275
Reviewed-on: https://go-review.googlesource.com/c/go/+/373376
Reviewed-by: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2 years agocmd/internal/obj/riscv: mark stack bounds check prologue nonpreemptible
Cherry Mui [Mon, 20 Dec 2021 17:45:04 +0000 (12:45 -0500)]
cmd/internal/obj/riscv: mark stack bounds check prologue nonpreemptible

This is similar to CL 207350, for RISCV64.

May fix #50263.
Updates #35470.

Change-Id: I0d39e195e8254d65fa1aca1cdf1fc553aa8b7cba
Reviewed-on: https://go-review.googlesource.com/c/go/+/373434
Trust: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
Reviewed-by: David Chase <drchase@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

2 years agogo/types: better error message when using comparable in union
Robert Griesemer [Fri, 17 Dec 2021 00:28:38 +0000 (16:28 -0800)]
go/types: better error message when using comparable in union

This is a port of CL 372674 from types2 to go/types with
minor adjustments for error handling.

For #49602.

Change-Id: I726081325a2ff2d5690d11ddc8a830bbcbd8ab33
Reviewed-on: https://go-review.googlesource.com/c/go/+/372954
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2 years agogo/types, types2: delay "does not satisfy comparable" error until needed
Robert Griesemer [Thu, 16 Dec 2021 00:13:05 +0000 (16:13 -0800)]
go/types, types2: delay "does not satisfy comparable" error until needed

Fixes #49112.

Change-Id: I8effbca7bcbb257b18fd4d3d1914fd10d4afaaae
Reviewed-on: https://go-review.googlesource.com/c/go/+/372594
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2 years agoruntime: mgc.go typo fix: becuse -> because
clamyang [Sun, 19 Dec 2021 03:03:38 +0000 (03:03 +0000)]
runtime: mgc.go typo fix: becuse -> because

Change-Id: I5019d5b9520e47a99a6136f615b6c9468073cc3c
GitHub-Last-Rev: 1a5392925a0c4e9b2915620fee3efa79ae14af20
GitHub-Pull-Request: golang/go#50239
Reviewed-on: https://go-review.googlesource.com/c/go/+/373055
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Trust: Brad Fitzpatrick <bradfitz@golang.org>

2 years agocmd/link: force eager binding when using plugins on darwin
Cherry Mui [Thu, 16 Dec 2021 19:33:13 +0000 (14:33 -0500)]
cmd/link: force eager binding when using plugins on darwin

When building/using plugins on darwin, we need to use flat
namespace so the same symbol from the main executable and the
plugin can be resolved to the same address. Apparently, when using
flat namespace the dynamic linker can hang at forkExec when
resolving a lazy binding. Work around it by forcing early bindings.

Fixes #38824.

Change-Id: I983aa0a0960b15bf3f7871382e8231ee244655f4
Reviewed-on: https://go-review.googlesource.com/c/go/+/372798
Trust: Cherry Mui <cherryyz@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

2 years agodoc/go1.18: document union element restriction
Ian Lance Taylor [Fri, 17 Dec 2021 01:54:27 +0000 (17:54 -0800)]
doc/go1.18: document union element restriction

For #47694

Change-Id: I9af871a4a45b002e72629904011aac8f076617f1
Reviewed-on: https://go-review.googlesource.com/c/go/+/372974
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2 years agospec: describe constraint parsing ambiguity and work-around more precisely
Robert Griesemer [Thu, 16 Dec 2021 18:25:07 +0000 (10:25 -0800)]
spec: describe constraint parsing ambiguity and work-around more precisely

The new description matches the implementation (CL 370774).

Also, in the section on type constraints, use "defines" instead of
"determines" because the constraint interface defines the type set
which is precisely the set of acceptable type arguments.

For #49482.

Change-Id: I6f30f49100e8ba8bec0a0f1b450f88cae54312eb
Reviewed-on: https://go-review.googlesource.com/c/go/+/372874
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2 years agospec: clarify that comparable cannot be a union element
Robert Griesemer [Thu, 16 Dec 2021 04:03:11 +0000 (20:03 -0800)]
spec: clarify that comparable cannot be a union element

For #49602.

Change-Id: I0d3ff8f087dffb3409918494147fd1dceff7514d
Reviewed-on: https://go-review.googlesource.com/c/go/+/372694
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2 years agonet: lengthen arbitrary SetDeadline timeout by a few orders of magnitude
Bryan C. Mills [Thu, 16 Dec 2021 17:32:39 +0000 (12:32 -0500)]
net: lengthen arbitrary SetDeadline timeout by a few orders of magnitude

The "someTimeout" constant in the net test is “just to test that
net.Conn implementations don't explode when their SetFooDeadline
methods are called”. It was set to 10 seconds, which is short enough
that it could actually matter on some platforms.

Since the point of the constant is just to make sure methods don't
explode, we should set it to be at least a couple of orders of
magnitude longer than the test: then it is guaranteed not to have any
unintended side-effects.

Fixes #50227

Change-Id: If97ae7bef5e7f16b336d09ccc37f5ea2ea7e70b3
Reviewed-on: https://go-review.googlesource.com/c/go/+/372796
Trust: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2 years agoos/exec: skip TestContextCancel on netbsd/arm64
Bryan C. Mills [Thu, 16 Dec 2021 15:40:47 +0000 (10:40 -0500)]
os/exec: skip TestContextCancel on netbsd/arm64

For #42061

Change-Id: I3b4c774ad9e375d4bfef1cfb4336c35ed30a6430
Reviewed-on: https://go-review.googlesource.com/c/go/+/372795
Trust: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2 years agogo/types, types2: use compiler error message for undefined operators
Robert Griesemer [Thu, 16 Dec 2021 18:50:34 +0000 (10:50 -0800)]
go/types, types2: use compiler error message for undefined operators

For #48712.

Change-Id: I1596fe8688f093e0e92cf5b8d5501aac8631324e
Reviewed-on: https://go-review.googlesource.com/c/go/+/372894
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

2 years agocmd/compile/internal/types2: better error message when using comparable in union
Robert Griesemer [Thu, 16 Dec 2021 03:50:33 +0000 (19:50 -0800)]
cmd/compile/internal/types2: better error message when using comparable in union

Fixes #49602.

Change-Id: I3499f8a485a2c8ec8afc74c5ef7b20d42c943a05
Reviewed-on: https://go-review.googlesource.com/c/go/+/372674
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

2 years agocmd/compile/internal/syntax: fix parsing of type parameter lists
Robert Griesemer [Thu, 9 Dec 2021 04:32:29 +0000 (20:32 -0800)]
cmd/compile/internal/syntax: fix parsing of type parameter lists

The parser cannot distinguish a type parameter list of the form

[P *T ] or
[P (T)]

where T is not a type literal from an array length specification
P*T (product) or P(T) (constant-valued function call) and thus
interprets these forms as the start of array types.

This ambiguity must be resolved explicitly by placing *T inside
an interface, adding a trailing comma, or by leaving parentheses
away where possible.

This CL adjusts the parser such that these forms are
interpreted as (the beginning) of type parameter lists
if the token after P*T or P(T) is a comma, or if T is
a type literal.

This CL also adjusts the printer to print a comma if
necessary to avoid this ambiguity, and adds additional
printer tests.

Fixes #49482

Change-Id: I36328e2a7d9439c39ba0349837c445542549e84e
Reviewed-on: https://go-review.googlesource.com/c/go/+/370774
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

2 years agocmd/go: update go work docs
Michael Matloob [Wed, 15 Dec 2021 20:07:22 +0000 (15:07 -0500)]
cmd/go: update go work docs

Change-Id: If28cc02a5a6f9bf2c7f2550de77ca0b31c1b35ee
Reviewed-on: https://go-review.googlesource.com/c/go/+/372494
Trust: Michael Matloob <matloob@golang.org>
Run-TryBot: Michael Matloob <matloob@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
2 years agocmd/compile: only avoid escaping package paths for "go.shape"
Dan Scales [Thu, 16 Dec 2021 21:24:40 +0000 (13:24 -0800)]
cmd/compile: only avoid escaping package paths for "go.shape"

We have code that intends to avoid escaping the package path for
built-in packages. But it is hard to determine which packages are
built-in from a general rule, and we really only want to avoid escaping
for the "go.shape" package (since that gives ugly shape type names). So,
fix the code to only avoid escaping the package path specifically for
the "go.shape" package.

Fixes #50200

Change-Id: Ibaedd7690b99a173007c608c5dfa783ef82b326d
Reviewed-on: https://go-review.googlesource.com/c/go/+/372934
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>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2 years agocmd/go/internal/vcs: prevent Git signatures from breaking commit time parsing
Andre Marianiello [Tue, 14 Dec 2021 22:50:28 +0000 (22:50 +0000)]
cmd/go/internal/vcs: prevent Git signatures from breaking commit time parsing

When a user has showSignature=true set in their Git config and the
commit in question has a signature, the git-show command will output
information about that signature. When this happens, the logic that
tries to parsing a timestamp from the git-show output chokes on this
signature information and the build stamping fails. This change prevents
commit signature information from being displayed even if
showSignature=true, preventing this issue.

Change-Id: I98d0a6fdd1e90dd1b91e0394713b6eb286a69d1a
GitHub-Last-Rev: 610706e23e33a037b9abede2ba0a926c0f336814
GitHub-Pull-Request: golang/go#49790
Reviewed-on: https://go-review.googlesource.com/c/go/+/367034
Trust: Cherry Mui <cherryyz@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

2 years agomisc/cgo/testcarchive: log command output more consistently
Bryan C. Mills [Fri, 3 Dec 2021 15:33:02 +0000 (10:33 -0500)]
misc/cgo/testcarchive: log command output more consistently

Also check that executables exist immediately after building them
in parallel tests.

The parallel tests in this package occasionally fail with
"no such file or directory", implying that either the build
command failed to actually write out the binary or something
concurrently deleted it.

This is purely a shot in the dark, but I'm hoping that perhaps
the stderr output from one of these commands will shed some
light on the underlying failure mode.

For #49693

Change-Id: I2e768190c56053550879b89a3ac88c027d4741dd
Reviewed-on: https://go-review.googlesource.com/c/go/+/369034
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>

2 years agonet/http/pprof: skip TestDeltaProfile on openbsd/arm
Bryan C. Mills [Thu, 16 Dec 2021 15:22:37 +0000 (10:22 -0500)]
net/http/pprof: skip TestDeltaProfile on openbsd/arm

It is observed to be flaky on the only openbsd/arm builder.
Skipping on that platform until someone can investigate.

For #50218

Change-Id: Id3a6dc12b93b3cec67870d8d81bd608c4589c952
Reviewed-on: https://go-review.googlesource.com/c/go/+/372794
Trust: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

2 years agocmd/go: add missing cgo condition in TestScript/mod_list_compiled_concurrent
Bryan C. Mills [Thu, 16 Dec 2021 20:15:32 +0000 (15:15 -0500)]
cmd/go: add missing cgo condition in TestScript/mod_list_compiled_concurrent

Updates #50205

Change-Id: I60d2e32c2cd84599f4a0126e4da4f1d61bd29b51
Reviewed-on: https://go-review.googlesource.com/c/go/+/372799
Trust: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2 years agocmd/go: examine dependencies of main modules in workspace mode
Michael Matloob [Thu, 9 Dec 2021 19:52:49 +0000 (14:52 -0500)]
cmd/go: examine dependencies of main modules in workspace mode

To make sure that we properly pull in everything in all, because
different main modules can interfere with each others' pruning.

Fixes #49763
Change-Id: I0756993d8ae9919ccb27ec460d579d348c38ec3b
Reviewed-on: https://go-review.googlesource.com/c/go/+/370663
Trust: Michael Matloob <matloob@golang.org>
Run-TryBot: Michael Matloob <matloob@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

2 years agoreflect: fix name of type parameter
zhouguangyuan [Thu, 16 Dec 2021 14:18:26 +0000 (22:18 +0800)]
reflect: fix name of type parameter

Fixes #50208

Change-Id: Ib0aff56341adb98ff6831c5badd1603ebf002b79
Reviewed-on: https://go-review.googlesource.com/c/go/+/372774
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Trust: Cherry Mui <cherryyz@google.com>

2 years agocmd/compile: don't re-typecheck while importing
Keith Randall [Tue, 14 Dec 2021 04:11:07 +0000 (20:11 -0800)]
cmd/compile: don't re-typecheck while importing

The imported code is already typechecked. NodAddrAt typechecks its
argument, which is unnecessary here and leads to errors when
typechecking unexported field references in other packages' code.

Mark the node is question as already typechecked, so we don't
retypecheck it.

Fixes #50148

Change-Id: I9789e3e7dd4d58ec095675e27b1c98389f7a0c44
Reviewed-on: https://go-review.googlesource.com/c/go/+/371554
Trust: Keith Randall <khr@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
Trust: Dan Scales <danscales@google.com>
Reviewed-by: Dan Scales <danscales@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

2 years agocmd/compile: upgrade ssa to do (int or float) -> complex
Keith Randall [Wed, 15 Dec 2021 21:04:54 +0000 (13:04 -0800)]
cmd/compile: upgrade ssa to do (int or float) -> complex

Generic instantiations can produce conversions from constant
literal ints or floats to complex values. We could constant literals
during instantiation, but it is just as easy to upgrade the code
generator to do the conversions.

Fixes #50193

Change-Id: I24bdc09226c8e868f6282e0e4057ba6c3ad5c41a
Reviewed-on: https://go-review.googlesource.com/c/go/+/372514
Trust: Keith Randall <khr@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
Trust: Dan Scales <danscales@google.com>
Reviewed-by: Dan Scales <danscales@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

2 years agotest: add simpler test for issue 50109
Dan Scales [Mon, 13 Dec 2021 23:10:31 +0000 (15:10 -0800)]
test: add simpler test for issue 50109

Thanks to the simpler test case for issue 50109. I'm keeping the old
test case in place, since it's not too complex, and may be useful for
testing other things as well.

Updates #50109

Change-Id: I80cdbd1da473d0cc4dcbd68e45bab7ddb6f9263e
Reviewed-on: https://go-review.googlesource.com/c/go/+/371515
Trust: Dan Scales <danscales@google.com>
Run-TryBot: Dan Scales <danscales@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: roger peppe <rogpeppe@gmail.com>
2 years agonet: increase timing slop in TimeoutFluctuation tests on NetBSD and OpenBSD
Bryan C. Mills [Wed, 15 Dec 2021 15:46:11 +0000 (10:46 -0500)]
net: increase timing slop in TimeoutFluctuation tests on NetBSD and OpenBSD

Decrease the slop everywhere else, since NetBSD and OpenBSD seem to be
the only ones that miss by that much.

For #50189
Updates #36108

Change-Id: I22ac39cc7c254e40358fcd933b5a6016629602c3
Reviewed-on: https://go-review.googlesource.com/c/go/+/372215
Trust: Bryan Mills <bcmills@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2 years agonet: skip Lookup tests of external hosts on builders with flaky networks
Bryan C. Mills [Wed, 15 Dec 2021 16:39:18 +0000 (11:39 -0500)]
net: skip Lookup tests of external hosts on builders with flaky networks

For #50191

Change-Id: Ic1059127e756d69ea9b75cf5805669ec43fedd5c
Reviewed-on: https://go-review.googlesource.com/c/go/+/372216
Trust: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2 years agocmd/compile/internal/types2: record types for union subexpressions
Robert Griesemer [Wed, 15 Dec 2021 19:42:58 +0000 (11:42 -0800)]
cmd/compile/internal/types2: record types for union subexpressions

This is a port of CL 371757 from go/types to types2, with
minor adjustments for different error handling and AST.

It also names the added API test cases more consistently.
The same renaming was applied to the respective go/types
file.

Updates #50093

Change-Id: Iaa132106a197a207f831525432e62e9d452b17c9
Reviewed-on: https://go-review.googlesource.com/c/go/+/372475
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2 years agocmd/compile/internal/types2: externalize union type sets
Robert Griesemer [Wed, 15 Dec 2021 19:24:56 +0000 (11:24 -0800)]
cmd/compile/internal/types2: externalize union type sets

This is a port of CL 371756 from go/types to types2 with
minor adjustments due to different error handling or AST.

Updates #50093

Change-Id: Iab6a4634f8fc917bf99df439d31098624085f52a
Reviewed-on: https://go-review.googlesource.com/c/go/+/372474
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2 years agocmd/compile: correct type identity comparison with "any"
Cherry Mui [Wed, 15 Dec 2021 17:34:34 +0000 (12:34 -0500)]
cmd/compile: correct type identity comparison with "any"

The builtin "any" type should only be identical to an unnamed empty
interface type, not a defined empty interface type.

Fixes #50169.

Change-Id: Ie5bb88868497cb795de1fd0276133ba9812edfe4
Reviewed-on: https://go-review.googlesource.com/c/go/+/372217
Trust: Cherry Mui <cherryyz@google.com>
Trust: Dan Scales <danscales@google.com>
Reviewed-by: Dan Scales <danscales@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

2 years agomisc/cgo/testshared: increase size limit in size check
Jakub Čajka [Mon, 13 Dec 2021 14:57:25 +0000 (15:57 +0100)]
misc/cgo/testshared: increase size limit in size check

Recently in Fedora we switched binutils ld's separate-code on. This
led to increased size of binaries, especially on 64k aligned arches.
For example trivial test binary size grew from 80k to 211k on ppc64le
tripping the size check(RHBZ#2030308). Therefore adjusting the size limit.

Change-Id: Ic722d90c338739c0b285f40b12ba4d675e9626a2
Reviewed-on: https://go-review.googlesource.com/c/go/+/371634
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2 years agomisc/cgo/testshared: pass -x flag only to commands supporting it
Jakub Čajka [Mon, 13 Dec 2021 12:28:15 +0000 (13:28 +0100)]
misc/cgo/testshared: pass -x flag only to commands supporting it

Running testshared with the -testx flag leads to:

./testshared.test -testx -testwork
+ mkdir -p /tmp/shared_test125221103
shared_test.go:79: executing go env -x GOROOT failed exit status 2:
flag provided but not defined: -x
usage: go env [-json] [-u] [-w] [var ...]
Run 'go help env' for details.
panic: executing go env -x GOROOT failed exit status 2:
flag provided but not defined: -x
usage: go env [-json] [-u] [-w] [var ...]
Run 'go help env' for details.

Change-Id: Id299979487c021e9ad1d57f5f7088d935830a6a3
Reviewed-on: https://go-review.googlesource.com/c/go/+/371614
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Cherry Mui <cherryyz@google.com>

2 years agoall: fix typo in comment
ichxxx [Wed, 15 Dec 2021 18:52:21 +0000 (18:52 +0000)]
all: fix typo in comment

Remove duplicate 'the'

Change-Id: I3ed81c8d9c488662387e45580a3bcd462448ba44
GitHub-Last-Rev: 86443993b9b58c6fce4e09e283604c32ccc44cec
GitHub-Pull-Request: golang/go#50017
Reviewed-on: https://go-review.googlesource.com/c/go/+/372394
Reviewed-by: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2 years agodoc/go1.18: discuss embedded build info compatibility
Hana [Wed, 15 Dec 2021 13:40:30 +0000 (08:40 -0500)]
doc/go1.18: discuss embedded build info compatibility

Fixes #50085

Change-Id: I9be8ddb983fb4fe598becbb0b93bb5b7e1f8438f
Reviewed-on: https://go-review.googlesource.com/c/go/+/372214
Trust: Hyang-Ah Hana Kim <hyangah@gmail.com>
Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
2 years agonet: eliminate arbitrary timeout in TestVariousDeadlines
Bryan C. Mills [Tue, 14 Dec 2021 22:07:24 +0000 (17:07 -0500)]
net: eliminate arbitrary timeout in TestVariousDeadlines

When we set a timeout, we don't actually have a guarantee one how long
the OS will take to notice it. Moreover, if the test deadlocks
completely (for example, due to a deadline never taking effect), it
would be more useful to get a full goroutine dump instead of the current
"client stuck in Dial+Copy" failure message.

For #37883
For #41863

Change-Id: I9f712ef1c620f97a5ab69baac45deb71134b99bc
Reviewed-on: https://go-review.googlesource.com/c/go/+/371994
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>

2 years agodoc/go1.18: mention that embedding a type parameter is forbidden
Ian Lance Taylor [Wed, 15 Dec 2021 00:09:36 +0000 (16:09 -0800)]
doc/go1.18: mention that embedding a type parameter is forbidden

For #47694

Change-Id: Ibf38eabcb78abc563fcf77e2b566175a18c06fa3
Reviewed-on: https://go-review.googlesource.com/c/go/+/372114
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>

2 years agoruntime/cgo: fix signature of crosscall_amd64 in comment
MoZhonghua [Fri, 12 Nov 2021 08:08:25 +0000 (08:08 +0000)]
runtime/cgo: fix signature of crosscall_amd64 in comment

In CL 289192, crosscall_amd64() was changed to recieve 3
arguments, but the comment was not updated.

Change-Id: Iba36c27aa5189e50f3fcc2a50291fecb2ef722c1
GitHub-Last-Rev: e7c041f00c562fdfeec84f1f3ea341713dcc7bf5
GitHub-Pull-Request: golang/go#49539
Reviewed-on: https://go-review.googlesource.com/c/go/+/363442
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2 years agodoc/go1.18: fix an unclosed anchor
Brad Fitzpatrick [Tue, 14 Dec 2021 23:39:14 +0000 (15:39 -0800)]
doc/go1.18: fix an unclosed anchor

Change-Id: I432bcc6ff917d008598b2f37c6e826f588a3d6d6
Reviewed-on: https://go-review.googlesource.com/c/go/+/372074
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Trust: Brad Fitzpatrick <bradfitz@golang.org>

2 years agodoc: fix typo in 1.18 release notes for package testing
Olivier Mengué [Tue, 14 Dec 2021 22:05:03 +0000 (23:05 +0100)]
doc: fix typo in 1.18 release notes for package testing

In release notes for Go 1.18, fix typo in changes for package testing to
correctly document the change in CL 343883.

Change-Id: I40d92858ed3f74554a094466c06771f83dd81942
Reviewed-on: https://go-review.googlesource.com/c/go/+/371616
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Cherry Mui <cherryyz@google.com>

2 years agogo/types: record types for union subexpressions
Robert Findley [Tue, 14 Dec 2021 17:48:31 +0000 (12:48 -0500)]
go/types: record types for union subexpressions

Prior to unions, unary and binary expressions always had a recorded
type. Preserve this by recording a type for all unary and binary
expressions encountered while parsing a union type.

Updates #50093

Change-Id: I5ba20f37854760596350d91ea325dc98e67e115a
Reviewed-on: https://go-review.googlesource.com/c/go/+/371757
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>

2 years agogo/types: externalize union type sets
Robert Findley [Tue, 14 Dec 2021 16:33:10 +0000 (11:33 -0500)]
go/types: externalize union type sets

Move calculated type sets for unions into a map, rather than storing
them on the Union type.

Type sets for unions only matter during calculation of interface type
sets, and to a lesser extent inside of Identical. The latter should not
be encountered during type checking, as Identical uses the precomputed
interface type set when comparing interfaces, and unions do not arise
outside of interface types.

Removing the tset field from Union potentially frees up memory, and
eliminates a source of races via calls to NewUnion and Identical. It
also sets the stage for recording Unions for every subexpression of
union terms, which preserves an existing invariant that BinaryExprs and
UnaryExprs should have a recorded type.

Updates #50093

Change-Id: I5956fa59be6b0907c3a71faeba9fa5dd8aae0d65
Reviewed-on: https://go-review.googlesource.com/c/go/+/371756
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>

2 years agodoc/go1.18: add caution about use of generics in production
Ian Lance Taylor [Tue, 14 Dec 2021 21:27:57 +0000 (13:27 -0800)]
doc/go1.18: add caution about use of generics in production

Per https://groups.google.com/g/golang-dev/c/iuB22_G9Kbo/m/7B1jd1I3BQAJ.

For #47694

Change-Id: I033cdadb2067e432f7c307d1546b4c5d0cfd5d8c
Reviewed-on: https://go-review.googlesource.com/c/go/+/371954
Trust: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2 years agodoc/go1.18: move debug/buildinfo to core library section
Cherry Mui [Tue, 14 Dec 2021 21:15:30 +0000 (16:15 -0500)]
doc/go1.18: move debug/buildinfo to core library section

It is a new package and seems a major change.

Updates #47694.

Change-Id: If854e494e28bcd1e79c99e59119755b9cb6793d6
Reviewed-on: https://go-review.googlesource.com/c/go/+/371816
Trust: Cherry Mui <cherryyz@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>