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

50537 Commits

Author SHA1 Message Date
Ian Lance Taylor
8c20584a82 bufio: document that NewWriter can return its argument
Fixes #49446

Change-Id: Ib0b53a7dd5d567a2dd0bdf29f53d276587b60afb
Reviewed-on: https://go-review.googlesource.com/c/go/+/361921
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2021-11-09 20:06:10 +00:00
Chaoqun Han
d3aedb72c6 cmd/compile: NewSelectorExpr use n.Pos instead of base.Pos
Fixes #49436

Change-Id: I4c8851e7aaee631d5eb22f2ef0aea5a25e936d87
Reviewed-on: https://go-review.googlesource.com/c/go/+/361917
Run-TryBot: Dan Scales <danscales@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Trust: David Chase <drchase@google.com>
2021-11-09 19:08:35 +00:00
Robert Findley
f59d36d2e3 go/types: make object test an external test
This is a port of CL 361409 to go/types.

Change-Id: I17ccf8a5b4ba715fd8a87ea2c1811700fb1157e3
Reviewed-on: https://go-review.googlesource.com/c/go/+/362538
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2021-11-09 19:01:30 +00:00
Robert Findley
526b2ef0ea go/types: check non-generic conversions first
This is a clean port of CL 361269 to go/types.

Change-Id: I2caaf08eabdf1707ae83ec1e628fd26f21b2b8e5
Reviewed-on: https://go-review.googlesource.com/c/go/+/362616
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2021-11-09 19:01:20 +00:00
Robert Findley
81f37a72ea go/types: minor cleanups in predicates.go
This is a clean port of CL 360956 to go/types.

Change-Id: Iac437e72bb760e7e90236a86e7473d6a440df081
Reviewed-on: https://go-review.googlesource.com/c/go/+/362615
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2021-11-09 19:01:06 +00:00
Clément Chigot
01103d533a cmd/link: fix GCC startfiles names on AIX
Since GCC version 11, the 64-bit version of GCC starting files are
now suffixed by "_64" instead of being stored without suffix under
"ppc64" multilib directory.

Change-Id: Ibe53521ed24d36e5f6282e3574849b9ae11a1e9a
Reviewed-on: https://go-review.googlesource.com/c/go/+/362594
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Ian Lance Taylor <iant@golang.org>
2021-11-09 18:37:32 +00:00
Carl Johnson
55e6e825d4 net/http: add MaxBytesHandler
Fixes #39567

Change-Id: I226089b678a6a13d7ce69f360a23fc5bd297d550
GitHub-Last-Rev: 6435fd5881
GitHub-Pull-Request: golang/go#48104
Reviewed-on: https://go-review.googlesource.com/c/go/+/346569
Trust: Damien Neil <dneil@google.com>
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Damien Neil <dneil@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
2021-11-09 18:23:16 +00:00
Russ Cox
36dbf7f7e6 cmd/go: add //go:embed all:pattern
When //go:embed d matches directory d, it embeds the directory
tree rooted at d, but it excludes files beginning with . and _,
as well as files having problematic names that will not be packaged
into modules (names such as .git and com1).

After long discussions on #42328 and #43854, we decided to keep
the behavior of excluding . and _ files by default, but to allow the pattern
prefix 'all:' to override this default. This CL implements that change.

Note that paths like .git and com1 are still excluded, as they must be,
since they will never be packed into a module.

Fixes #43854.

Change-Id: I4f3731e14ecffd4b691fda3a0890b460027fe209
Reviewed-on: https://go-review.googlesource.com/c/go/+/359413
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2021-11-09 18:03:59 +00:00
Michael Pratt
15a54d627c runtime: add upper half and carry bit with zero
https://golang.org/cl/246763 accidentally changed this from upper + 0 +
carry to upper + old vdsoSP + carry.

The old value of vdsoPC is usually zero, so this typically works.
However, the reentrant case will have a non-zero value, resulting in a
bogus returned time.

Fixes #49481

Change-Id: I0110b84277bf911804cb0ff8097aebf1b7eb100a
Reviewed-on: https://go-review.googlesource.com/c/go/+/362674
Trust: Michael Pratt <mpratt@google.com>
Run-TryBot: Michael Pratt <mpratt@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2021-11-09 17:18:08 +00:00
Michael Pratt
90f47dbba6 runtime/pprof: include labels in profile dump
For tests of pprof label support having the sample labels in the output
is needed for effective debugging.

For #48577

Change-Id: Ic7c5bc90cb33e8fb477f7db62d9b56a7a9d6ffa8
Reviewed-on: https://go-review.googlesource.com/c/go/+/362614
Trust: Michael Pratt <mpratt@google.com>
Run-TryBot: Michael Pratt <mpratt@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2021-11-09 17:02:38 +00:00
Robert Findley
34abc12b2a cmd/compile/internal/types2: roll-forward removal of asX converters
This CL reverts CL 361964, rolling forward the original CL 362254 with a
fix for re-entrant expansion via type hashing (compare patchsets 1 and
2).

Change-Id: I62869e50e919f42eb8d6fef5b0d7a5ec8960bd84
Reviewed-on: https://go-review.googlesource.com/c/go/+/362118
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
2021-11-09 16:55:47 +00:00
Dan Scales
47e3c4bc74 cmd/compile: disable doubleCheck and remove unused checkDictionary
In stencil.go, change doubleCheck to false, which will turn off some
double-checking code which isn't needed generally, now that we have lots
of tests of end-to-end runs.

Also, removed checkDictionary() which is unused and is unlikely to be
useful in the future.

Change-Id: I4e5acceab80f4904b174422bae21ca82cf04f943
Reviewed-on: https://go-review.googlesource.com/c/go/+/361923
Trust: Dan Scales <danscales@google.com>
Run-TryBot: Dan Scales <danscales@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
2021-11-09 16:38:42 +00:00
Robert Findley
2ade8ae325 go/types: rename is_X predicates back to isX (step 2 of 2)
This is a port of CL 361134 to go/types.

Change-Id: Ibac4365a85561b32a90b0118d48aa9302f227b2e
Reviewed-on: https://go-review.googlesource.com/c/go/+/362554
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2021-11-09 16:23:19 +00:00
Robert Findley
e90fd9a597 go/types: rename isX predicates to allX, add simple is_X (step 1 of 2)
This is a port of CL 360955 to go/types. Note that go/types and types2
differ in handling of untyped nil within both Checker.shift and
Checker.implicitTypeAndValue.

A missing comment was added to Checker.indexExpr.

Change-Id: Ia9149ff9c0af68213c579090902ab7989828ddd2
Reviewed-on: https://go-review.googlesource.com/c/go/+/362534
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2021-11-09 16:20:19 +00:00
Katie Hockman
2559a98a3c testing: remove package from fuzz crasher message
Fixes #48149

Change-Id: Iaf91d2c54fda809c7da90cdfb6d1d075f474c69b
Reviewed-on: https://go-review.googlesource.com/c/go/+/362116
Trust: Katie Hockman <katie@golang.org>
Run-TryBot: Katie Hockman <katie@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Julie Qiu <julie@golang.org>
2021-11-09 15:16:57 +00:00
Cuong Manh Le
b7529c3617 cmd/go: fix mod_get_direct
https://github.com/googleapis/google-cloud-go has changed the default
branch from master to main, causing mod_get_direct failed on longtest.

Change-Id: I8fe0356b2ff532d1fdedbcb1e1832d7335babaa0
Reviewed-on: https://go-review.googlesource.com/c/go/+/361965
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: Bryan C. Mills <bcmills@google.com>
2021-11-09 06:27:04 +00:00
Jason A. Donenfeld
6dcf83d882 runtime: revert recent Windows crashdump changes
Recent changes to runtime enabled crashdumps, which under some
circumstances apparently might result in memory being uploaded to
Microsoft. A change like this should go through the proper proposals
process where we can discuss how to gate it and what all of its
implications are.

This reverts CL 307372 and its cleanup CL 360617.

Change-Id: If2e74015899d746831da40546c82eacacdf739e1
Reviewed-on: https://go-review.googlesource.com/c/go/+/362454
Trust: Jason A. Donenfeld <Jason@zx2c4.com>
Run-TryBot: Jason A. Donenfeld <Jason@zx2c4.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-11-09 02:28:30 +00:00
Cuong Manh Le
5344dcae41 cmd/compile: remove unneeded "==" method in pre-defined "comparable" interface
Fixes #49421

Change-Id: Iecf3952346ecd278198c1000014a321e230f7fa7
Reviewed-on: https://go-review.googlesource.com/c/go/+/361962
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Trust: Dan Scales <danscales@google.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Dan Scales <danscales@google.com>
2021-11-09 00:08:42 +00:00
Cuong Manh Le
bee0c73900 cmd/compile: fix irgen mis-handling of ... argument when creating closure
When bulding formal arguments of newly created closure, irgen forgets to
set "..." field attribute, causing type mismatched between the closure
function and the ONAME node represents that closure function.

Fixes #49432

Change-Id: Ieddaa64980cdd3d8cea236a5a9de0204ee21ee39
Reviewed-on: https://go-review.googlesource.com/c/go/+/361961
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Trust: Dan Scales <danscales@google.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Dan Scales <danscales@google.com>
2021-11-09 00:08:09 +00:00
Bryan C. Mills
67e22941df Revert "cmd/go: add workspace pruning mode"
This reverts CL 357169.

Reason for revert: appears to be failing on longtest SlowBot.¹

¹https://storage.googleapis.com/go-build-log/a97c855b/linux-amd64-longtest_7c9857d4.log

Change-Id: I3b94395671db78ed5fb2fb1019e7199e4ffbd272
Reviewed-on: https://go-review.googlesource.com/c/go/+/362249
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
2021-11-08 22:05:00 +00:00
Matthew Dempsky
955f9f56bf test: add regress test for reported non-monomorphizable example
Fixes #48711.

Change-Id: I2ed1ef5267343d4b9f91da0618905098d178db90
Reviewed-on: https://go-review.googlesource.com/c/go/+/362394
Trust: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2021-11-08 21:52:47 +00:00
Michael Matloob
cc49178237 cmd/go: rename go mod initwork and editwork to go work init and edit
This brings the workspace related commands into their own namespace.

Fixes #48256

Change-Id: I9d5e3d4c45798913d742c532c1571006e6f9cc57
Reviewed-on: https://go-review.googlesource.com/c/go/+/357611
Trust: Michael Matloob <matloob@golang.org>
Run-TryBot: Michael Matloob <matloob@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2021-11-08 21:45:43 +00:00
Michael Matloob
0e39946e8d cmd/go: add workspace pruning mode
This change corrects a bug in the handling of module loading of
workspaces. Namely, there is an assumption by the module pruning code
that if a root module is selected then the packages of that module can
be resolved without loading the whole module graph. This is not true
in workspace mode because two workspace modules can require different
versions of a dependency. Worse, one workspace module can directly
require a depencency that is transitively required by another
workspace module, changing the version of that module loaded in the
fully expanded graph.

To correct this, a new 'workspace' pruning mode is added where the
roots are the workspace modules themselves, satisfying the assumption
made by the module pruning logic.

The rest of this change accounts for the new pruning mode where it's
used and correctly sets the requirements in this pruning mode.

Change-Id: I5d4d9877e492e196681f6ee9f8f18a08b4e95c61
Reviewed-on: https://go-review.googlesource.com/c/go/+/357169
Trust: Michael Matloob <matloob@golang.org>
Run-TryBot: Michael Matloob <matloob@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2021-11-08 21:30:25 +00:00
Damien Neil
ccea0b2fbe net/http: deflake TestTimeoutHandlerContextCanceled
Fixes #49448

Change-Id: Ie2acff7dedbca9bd1cc0b1b3dd0a01573c7befee
Reviewed-on: https://go-review.googlesource.com/c/go/+/361920
Trust: Damien Neil <dneil@google.com>
Run-TryBot: Damien Neil <dneil@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2021-11-08 21:28:37 +00:00
Cuong Manh Le
830b393bcd cmd/compile,cmd/go: fix long test builders
CL 361411 improved error message for go version requirement, but forgot
to update the test in cmd/go to match new error message. That causes
longtest builders failed.

This CL changes mod_vendor_goversion.txt to match compiler error, and
limit fixedbugs/issue49368.go to run with -G=3 only.

Updates #49368

Change-Id: I125fe0a8c2a1595066d39c03e97819e7a1274e0a
Reviewed-on: https://go-review.googlesource.com/c/go/+/361963
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: Robert Findley <rfindley@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2021-11-08 18:54:21 +00:00
Cuong Manh Le
5e6475598c cmd/compile: Revert "cmd/compile/internal/types2: remove most asX converters (cleanup)"
This reverts commit 759eaa22ad.

Reason to revert: break unified IR builder

Though the unified IR is not for go1.18, it's the only user of types2
lazy resolution APIs at this moment. And it consistently failed after
CL 362254 is the sign that the change was wrong somehow.

Change-Id: I6bfc3192904fe2129fd3c165f0df8761e8eb441c
Reviewed-on: https://go-review.googlesource.com/c/go/+/361964
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: Robert Findley <rfindley@google.com>
2021-11-08 18:06:16 +00:00
Roland Shoemaker
2e210b41ea crypto/x509: remove ios build tag restriction
Fixes #49435

Change-Id: I77ce12f447e727e7dc3b23de947357c27a268bd2
Reviewed-on: https://go-review.googlesource.com/c/go/+/362294
Trust: Roland Shoemaker <roland@golang.org>
Run-TryBot: Roland Shoemaker <roland@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2021-11-08 17:46:34 +00:00
Keith Randall
6a9d81174e internal/fmtsort: order channels in test in memory address order
Kind of a kludge, but it makes the test work reliably.

Fixes #49431

Change-Id: Ic2a075ba02f80ea7efcc1b3f0f5a43649e87c0d8
Reviewed-on: https://go-review.googlesource.com/c/go/+/361918
Trust: Keith Randall <khr@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
2021-11-08 17:30:10 +00:00
Michael Anthony Knyszek
7bda349c17 runtime: disable GC in TestPanicSystemstack's subprocess
TestPanicSystemstack spins up a subprocess that has 2 goroutines
deadlock on a runtime lock while on the system stack, with GOMAXPROCS=2.

Each goroutine is going to be running on a P, and then is going to wedge
itself up on that P.

If a GC is active and a worker starts executing (using a P), then it
could try to preempt a goroutine that is already blocked. It won't be
able to, so it'll just sit there forever trying to suspend it. At this
point there are no more Ps to execute the remaining goroutine that needs
to print something so the parent process can continue the test.

This change fixes this issue by disabling GCs in the child process. An
alternative fix could be to increase GOMAXPROCS in the child, but maybe
letting the GC be on (which assumes it'll always be able to *eventually*
suspend a G) is just asking for trouble.

Fixes #49388.

Change-Id: I405c9dad50e24e1e68f2c52a646538da15797fbe
Reviewed-on: https://go-review.googlesource.com/c/go/+/361897
Trust: Michael Knyszek <mknyszek@google.com>
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
2021-11-08 16:44:18 +00:00
Michael Anthony Knyszek
7ee3f1427b runtime: disable GC during debug call tests
Currently the debug call protocol implementation we use for testing is
riddled with write barriers, and called from a signal handler. This is
not safe, as write barriers need a P to execute.

Ideally this implementation would be rewritten to avoid the write
barriers, but it's not straightforward, and needs some thought. As a
temporary measure, disable GC during the debug call tests to avoid a
write barrier.

Note that this does not indicate a problem with real use of the debug
call protocol. Only our test implementation has this issue, because it
needs to get executed in a signal handler, normally a separate process
is interfacing with the protocol via process signals and ptrace (and the
like).

Fixes #49370.

Change-Id: Ic0fde5d0f4c64f9ecc9789b7dabb3954538fe0a8
Reviewed-on: https://go-review.googlesource.com/c/go/+/361896
Trust: Michael Knyszek <mknyszek@google.com>
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
2021-11-08 16:44:14 +00:00
Robert Griesemer
759eaa22ad cmd/compile/internal/types2: remove most asX converters (cleanup)
Make it explicit in the code where we call under.
The asNamed and asTypeParam converters need to
stay: asNamed does resolution if necessary, and
asTypeParam may or may not call under() depending
on the next CL.

Reviewed uses of asNamed and .(*Named) for correctness.
Removed unnecessary Named.resolve call in lookup.

Change-Id: I2acf176925e00bd1703a00230a779aa65a8f5a51
Reviewed-on: https://go-review.googlesource.com/c/go/+/362254
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2021-11-08 16:15:01 +00:00
Robert Griesemer
3e41b18a46 cmd/compile/internal/types2: use compiler version error when configured for compiler
Fixes #49368.

Change-Id: I7c7575ae8bb6271160747e3f1888b144c3ab24c4
Reviewed-on: https://go-review.googlesource.com/c/go/+/361411
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2021-11-08 16:14:55 +00:00
smasher164
ab31dbc05b doc/go1.18: strings,bytes: deprecate Title
Updates #48367.

Change-Id: Ib8fc6d9dd7c3c6a70fefe077615f51a71d9c42ed
Reviewed-on: https://go-review.googlesource.com/c/go/+/361899
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Dmitri Shuralyov <dmitshur@golang.org>
2021-11-08 14:49:56 +00:00
jiahua wang
9e6ad46bcc net/http: fix spelling in documentation
Change-Id: I8b0924300eafe27de98975512a78a6527a92e446
Reviewed-on: https://go-review.googlesource.com/c/go/+/354729
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Damien Neil <dneil@google.com>
2021-11-07 04:57:22 +00:00
Arran Walker
85493d53e3 archive/zip: don't read data descriptor early
Go 1.17 introduced an unnecessary change to when a zip's data descriptor
is read for file entries, how it is parsed and how the crc32 field is
used.

Before Go 1.17, the data descriptor was read immediately after a file
entry's content. This continuous read is a pattern existing applications
have come to rely upon (for example, where reads at specific offsets
might be translated to HTTP range requests).

In Go 1.17, all data descriptors are immediately read upon opening the
file. This results in scattered and non-continuous reads of the archive,
and depending on the underlying reader, might have severe performance
implications. In addition, an additional object is now initialized for
each entry, but is mostly redundant.

Previously, the crc32 field in the data descriptor would return an error
if it did not match the central directory's entry. This check has
seemingly been unintentionally removed. If the central directory crc32
is invalid and a data descriptor is present, no error is returned.

This change reverts to the previous handling of data descriptors, before
CL 312310.

Fixes #48374
Fixes #49089

Change-Id: I5df2878c4fcc9e500064e7175f3ab9727c82f100
Reviewed-on: https://go-review.googlesource.com/c/go/+/357489
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Dmitri Shuralyov <dmitshur@golang.org>
2021-11-07 04:56:11 +00:00
Robert Griesemer
61d789db3a cmd/compile/internal/types2: report error for incomplete struct composite literal type
Mark a struct as "complete" with a non-nil (but possibly zero length)
fields list. Add a test when type-checking struct composite literals,
the same way we do for other composite literal types.

Fixes #49276.

Change-Id: If44a3d790bf7032ddcd155af49bdc47b1cdff4fc
Reviewed-on: https://go-review.googlesource.com/c/go/+/361412
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2021-11-06 19:41:15 +00:00
Robert Griesemer
cfb3dc7710 cmd/compile/internal/types2: clearer object string for type parameters
- print "type parameter" rather than just "type"
- print the type bound rather than the underlying type
- added an object string test

Change-Id: Ibb572ff35b74f2c6ccb27641154f096770541130
Reviewed-on: https://go-review.googlesource.com/c/go/+/361401
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2021-11-06 19:41:14 +00:00
Robert Griesemer
7ca772a5bc cmd/compile/internal/types2: make object test an external test
Change-Id: I15c969a799404067f34f600da15b1a97d4857315
Reviewed-on: https://go-review.googlesource.com/c/go/+/361409
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2021-11-06 19:41:12 +00:00
Robert Griesemer
565f457e81 cmd/compile/internal/types2: always parse tests assuming generic code
We don't need to distinguish anymore as this is the new default.
This removes the need to prefix test package names with "generic_".

Change-Id: If9eaa0a5cffcd19deb529aca6798206f2d396ca1
Reviewed-on: https://go-review.googlesource.com/c/go/+/361408
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2021-11-06 19:41:10 +00:00
Roland Shoemaker
3544082f75 crypto/x509: verification with system and custom roots
Make system cert pools special, such that when one has extra roots
added to it we run verifications twice, once using the platform
verifier, if available, and once using the Go verifier, merging the
results.

This change re-enables SystemCertPool on Windows, but explicitly does
not return anything from CertPool.Subjects (which matches the behavior
of macOS). CertPool.Subjects is also marked deprecated.

Fixes #46287
Fixes #16736

Change-Id: Idc1843f715ae2b2d0108e55ab942c287181a340a
Reviewed-on: https://go-review.googlesource.com/c/go/+/353589
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Trust: Roland Shoemaker <roland@golang.org>
2021-11-06 16:43:43 +00:00
hanpro
4f083c7dcf cmd/compile: avoid adding LECall to the entry block when has opendefers
The openDeferRecord always insert vardef/varlive pairs into the entry block, it may destroy the mem chain when LECall's args are writing into the same block. So create a new block before that happens.

Fixes #49282

Change-Id: Ibda6c4a45d960dd412a641f5e02276f663c80785
Reviewed-on: https://go-review.googlesource.com/c/go/+/361410
Run-TryBot: Alberto Donizetti <alb.donizetti@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Alberto Donizetti <alb.donizetti@gmail.com>
Trust: Than McIntosh <thanm@google.com>
Reviewed-by: David Chase <drchase@google.com>
2021-11-06 13:10:06 +00:00
Tobias Klauser
f19e400180 all: remove more leftover // +build lines
CL 344955 and CL 359476 removed almost all // +build lines, but leaving
some assembly files and generating scripts. Also, some files were added
with // +build lines after CL 359476 was merged. Remove these or rename
files where more appropriate.

For #41184

Change-Id: I7eb85a498ed9788b42a636e775f261d755504ffa
Reviewed-on: https://go-review.googlesource.com/c/go/+/361480
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2021-11-06 10:24:44 +00:00
Roland Shoemaker
b74f2efc47 crypto/x509: use the platform verifier on iOS
Use the same certificate verification APIs on iOS as on macOS (they
share the same APIs, so we should be able to transparently use them
on both.)

Updates #46287
Fixes #38843

Change-Id: If70f99b0823dd5fa747c42ff4f20c3b625605327
Reviewed-on: https://go-review.googlesource.com/c/go/+/353403
Trust: Roland Shoemaker <roland@golang.org>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Run-TryBot: Roland Shoemaker <roland@golang.org>
2021-11-06 00:29:44 +00:00
Michael Anthony Knyszek
09e8de70c2 runtime: eliminate rendundant loads gcPercent
The previous change was an automated change that made gcPercent a
type-safe atomic variable. However, that introduced a lot of redundant
formal atomic loads of the variable. Remove them by only loading once in
each case, and reusing the value.

Change-Id: I49647135f423574f94506d456d1cc390150fad02
Reviewed-on: https://go-review.googlesource.com/c/go/+/357795
Trust: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
2021-11-05 22:57:08 +00:00
Michael Anthony Knyszek
2f71c86370 runtime: retype gcControllerState.gcPercent as atomic.Int32
[git-generate]
cd src/runtime
mv export_test.go export.go
GOROOT=$(dirname $(dirname $PWD)) rf '
  add gcControllerState.gcPercent \
// Initialized from GOGC. GOGC=off means no GC. \
gcPercent_ atomic.Int32
  ex {
    import "runtime/internal/atomic"

    var t gcControllerState
    var v, w int32
    var d int32

    t.gcPercent -> t.gcPercent_.Load()
    t.gcPercent = v -> t.gcPercent_.Store(v)
    atomic.Loadint32(&t.gcPercent) -> t.gcPercent_.Load()
    atomic.Storeint32(&t.gcPercent, v) -> t.gcPercent_.Store(v)
    atomic.Xaddint32(&t.gcPercent, d) -> t.gcPercent_.Add(d)
    atomic.Casint32(&t.gcPercent, v, w) -> t.gcPercent_.CompareAndSwap(v, w)
    atomic.Xchgint32(&t.gcPercent, v) -> t.gcPercent_.Swap(v)
  }
  rm gcControllerState.gcPercent
  mv gcControllerState.gcPercent_ gcControllerState.gcPercent
'
mv export.go export_test.go

Change-Id: I1aae34a3f782d096c6b6233bbf7986e67ce9c5f9
Reviewed-on: https://go-review.googlesource.com/c/go/+/357794
Trust: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
2021-11-05 22:56:55 +00:00
Josh Bleecher Snyder
e83a2047e0 net/netip: document the zero Addr
Fixes #49364

Change-Id: I3372f80723a4deae48ef106f88b0ad880cdd0e45
Reviewed-on: https://go-review.googlesource.com/c/go/+/361914
Trust: Josh Bleecher Snyder <josharian@gmail.com>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2021-11-05 22:55:56 +00:00
Dmitri Shuralyov
ba79c1e241 doc/go1.18: split bytes and strings packages
A small touchup after CL 361894.

For #47694.

Change-Id: Ifc161516f897f727195d21351a3c8eda7b6e327e
Reviewed-on: https://go-review.googlesource.com/c/go/+/361895
Trust: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Run-TryBot: Carlos Amedee <carlos@golang.org>
2021-11-05 22:54:47 +00:00
Josh Bleecher Snyder
3b7e376df8 net/netip: add tests for Addr.AsSlice
Change-Id: Ib88dd101b3bbdf4d2bfd79838994cfadef1b604d
Reviewed-on: https://go-review.googlesource.com/c/go/+/361915
Trust: Josh Bleecher Snyder <josharian@gmail.com>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
2021-11-05 22:53:55 +00:00
Jason A. Donenfeld
b07c41d2c1 net/netip: add IPv4Unspecified
There is IPv6Unspecified but there is not IPv4Unspecified, making for
inconsistent code. This commit adds the missing function.

Updates #49298.

Change-Id: Id2519b646323642f59fb1cc6ea8e335fdde16290
Reviewed-on: https://go-review.googlesource.com/c/go/+/361056
Trust: Jason A. Donenfeld <Jason@zx2c4.com>
Trust: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Jason A. Donenfeld <Jason@zx2c4.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2021-11-05 22:30:17 +00:00
Jason A. Donenfeld
87a3fc518a net/netip: reduce allocations in MarshalBinary
Addr's MarshalBinary required two allocations in the case of a zone
existing, and AddrPort and Prefix both required three. This refactors
things slightly so that each marshal function only needs a single
allocation.

Change-Id: I9bde9969fedc1cad64bebb607188c4287f6a0d01
Reviewed-on: https://go-review.googlesource.com/c/go/+/361054
Trust: Jason A. Donenfeld <Jason@zx2c4.com>
Run-TryBot: Jason A. Donenfeld <Jason@zx2c4.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2021-11-05 22:28:56 +00:00