]> Cypherpunks.ru repositories - gostls13.git/log
gostls13.git
15 months ago[release-branch.go1.20] go1.20 go1.20
Gopher Robot [Wed, 1 Feb 2023 18:43:23 +0000 (18:43 +0000)]
[release-branch.go1.20] go1.20

Change-Id: I156873d216ccb7d91e716b4348069df246b527b3
Reviewed-on: https://go-review.googlesource.com/c/go/+/464496
Run-TryBot: Gopher Robot <gobot@golang.org>
Auto-Submit: Gopher Robot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
16 months ago[release-branch.go1.20] internal/coverage/decodemeta: fix coding error in func litera...
Than McIntosh [Fri, 20 Jan 2023 19:03:43 +0000 (14:03 -0500)]
[release-branch.go1.20] internal/coverage/decodemeta: fix coding error in func literal handling

Fix a coding error in coverage meta-data decoding in the method
decodemeta.CoverageMetaDataDecoder.ReadFunc. The code was not
unconditionally assigning the "function literal" field of the
coverage.FuncDesc object passed in, resulting in bad values depending
on what the state of the field happened to be in the object.

Fixes #57942.

Change-Id: I6dfd7d7f7af6004f05c622f9a7116e9f6018cf4f
Reviewed-on: https://go-review.googlesource.com/c/go/+/462955
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
(cherry picked from commit 620399ef0d1390a8f7e7061a45d5304ed087889a)
Reviewed-on: https://go-review.googlesource.com/c/go/+/463418
Reviewed-by: Than McIntosh <thanm@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Auto-Submit: Matthew Dempsky <mdempsky@google.com>

16 months ago[release-branch.go1.20] runtime/coverage: avoid non-test coverage profiles in test...
Than McIntosh [Thu, 19 Jan 2023 15:16:07 +0000 (10:16 -0500)]
[release-branch.go1.20] runtime/coverage: avoid non-test coverage profiles in test report helper

When walking through the set of coverage data files generated from a
"go test -cover" run, it's possible to encounter pods (clumps of data
files) that were generated by a run from an instrumented Go tool (for
example, cmd/compile). Add a guard to the test reporting code to
ensure that it only processes files created by the currently running
test.

Fixes #57924.

Change-Id: I1bb7dce88305e1088162e3cb1df628486ecee1c1
Reviewed-on: https://go-review.googlesource.com/c/go/+/462756
Reviewed-by: David Chase <drchase@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Than McIntosh <thanm@google.com>
(cherry picked from commit cf70d37967b8447af8305e02ef534c4c5f42d49c)
Reviewed-on: https://go-review.googlesource.com/c/go/+/463417
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Auto-Submit: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
16 months ago[release-branch.go1.20] sync: document memory model for Swap/CompareAnd{Swap,Delete...
Changkun Ou [Wed, 28 Dec 2022 14:04:58 +0000 (15:04 +0100)]
[release-branch.go1.20] sync: document memory model for Swap/CompareAnd{Swap,Delete} in Map

CL 381316 documented the memory model of Map's APIs. However, the newly
introduced Swap, CompareAndSwap, and CompareAndDelete are missing from
this documentation as CL 399094 did not add this info.

This CL specifies the defined read/write operations of the new Map APIs.

For #51972

Change-Id: I519a04040a0b429a3f978823a183cd62e42c90ae
Reviewed-on: https://go-review.googlesource.com/c/go/+/459715
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Run-TryBot: Changkun Ou <mail@changkun.de>
Auto-Submit: Bryan Mills <bcmills@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
(cherry picked from commit f07910bd577f73b81e4f7117c7cfdf9cf7579028)
Reviewed-on: https://go-review.googlesource.com/c/go/+/463416
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Auto-Submit: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Changkun Ou <mail@changkun.de>
16 months ago[release-branch.go1.20] Revert "cmd/compile: teach prove about bitwise OR operation"
Keith Randall [Tue, 24 Jan 2023 16:11:06 +0000 (16:11 +0000)]
[release-branch.go1.20] Revert "cmd/compile: teach prove about bitwise OR operation"

This reverts commit 3680b5e9c4f42fcf9155aa42b3b344d1fbe19571.

Reason for revert: causes long compile times on certain functions. See issue #57959

Change-Id: Ie9e881ca8abbc79a46de2bfeaed0b9d6c416ed42
Reviewed-on: https://go-review.googlesource.com/c/go/+/463295
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
(cherry picked from commit a6ddb15f8f5955d93eeb2f674ec564ffd4530c18)
Reviewed-on: https://go-review.googlesource.com/c/go/+/463415
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Keith Randall <khr@google.com>
16 months ago[release-branch.go1.20] time: revert strict parsing of RFC 3339
Joe Tsai [Wed, 18 Jan 2023 18:22:54 +0000 (13:22 -0500)]
[release-branch.go1.20] time: revert strict parsing of RFC 3339

CL 444277 fixed Time.UnmarshalText and Time.UnmarshalJSON to properly
unmarshal timestamps according to RFC 3339 instead of according
to Go's bespoke time syntax that is a superset of RFC 3339.

However, this change seems to have broken an AWS S3 unit test
that relies on parsing timestamps with single digit hours.
It is unclear whether S3 emits these timestamps in production or
whether this is simply a testing artifact that has been cargo culted
across many code bases. Either way, disable strict parsing for now
and re-enable later with better GODEBUG support.

Updates #54580

Change-Id: Icced2c7f9a6b2fc06bbd9c7e90f90edce24c2306
Reviewed-on: https://go-review.googlesource.com/c/go/+/462286
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Joseph Tsai <joetsai@digital-static.net>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Russ Cox <rsc@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-on: https://go-review.googlesource.com/c/go/+/462675
Reviewed-by: Joseph Tsai <joetsai@digital-static.net>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
16 months ago[release-branch.go1.20] cmd: update x/tools to latest internal Go 1.20 branch
Russ Cox [Wed, 18 Jan 2023 15:37:04 +0000 (10:37 -0500)]
[release-branch.go1.20] cmd: update x/tools to latest internal Go 1.20 branch

Import x/tools as of CL 462596 (070db2996ebe, Jan 18 2022),
to bring in two vet analysis fixes (printf and loopclosure).

For #57911.
Fixes #57903.
Fixes #57904.

Change-Id: I82fe4e9bd56fb8e64394ee8618c155316942a517
Reviewed-on: https://go-review.googlesource.com/c/go/+/462555
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
Auto-Submit: Russ Cox <rsc@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-on: https://go-review.googlesource.com/c/go/+/462695
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
16 months ago[release-branch.go1.20] cmd/compile: fix unsafe.{SliceData,StringData} escape analysi...
Cuong Manh Le [Mon, 16 Jan 2023 18:29:02 +0000 (01:29 +0700)]
[release-branch.go1.20] cmd/compile: fix unsafe.{SliceData,StringData} escape analysis memory corruption

Updates #57823
Updates #57854

Change-Id: I54654d3ecb20b75afa9052c5c9db2072a86188d4
Reviewed-on: https://go-review.googlesource.com/c/go/+/461759
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/461760

16 months ago[release-branch.go1.20] cmd/compile: fix static init inlining for hidden node fields
Matthew Dempsky [Tue, 17 Jan 2023 18:59:25 +0000 (10:59 -0800)]
[release-branch.go1.20] cmd/compile: fix static init inlining for hidden node fields

Unified IR added several new IR fields for holding *runtime._type
expressions. To avoid throwing off any frontend semantics
(particularly inlining cost heuristics), they were marked as
`mknode:"-"` so that code wouldn't visit them.

Unfortunately, this has a bad interaction with the static init
inlining optimization, because the latter relies on ir.EditChildren to
substitute all parameters. This potentially includes dictionary
parameters, which can appear within the new RType fields.

This CL adds a new ir.EditChildrenWithHidden function that also edits
these fields, and switches staticinit to use it. Longer term, we
should unhide the RType fields so that ir.EditChildren visits them
normally, but that's scarier so late in the release cycle.

Updates #57778.
Updates #57854.

Change-Id: I98c1e8cf366156dc0c81a0cb79029cc5e59c476f
Reviewed-on: https://go-review.googlesource.com/c/go/+/461686
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
(cherry picked from commit 9f2fbedf010d59c3ecaa8c25b07a5f68fcb2e3d5)
Reviewed-on: https://go-review.googlesource.com/c/go/+/462535
Auto-Submit: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
16 months ago[release-branch.go1.20] all: merge master (9088c69) into release-branch.go1.20
Cherry Mui [Tue, 17 Jan 2023 18:45:09 +0000 (13:45 -0500)]
[release-branch.go1.20] all: merge master (9088c69) into release-branch.go1.20

Merge List:

+ 2023-01-17 9088c691da cmd/compile: ensure temp register mask isn't empty
+ 2023-01-17 c0799f7015 os: document that Rename is not atomic on non-Unix platforms
+ 2023-01-17 d74c31f0ba doc/go1.20: update cryptography release notes
+ 2023-01-17 8e19929436 strings: remove redundant symbols
+ 2023-01-17 6cb8c43b84 cmd/go: include coverage build flags for "go list"
+ 2023-01-17 02ed0e5e67 crypto/ed25519: improve Ed25519ctx docs and add example
+ 2023-01-17 f375b305c8 crypto/x509: clarify that CheckSignatureFrom and CheckSignature are low-level APIs
+ 2023-01-17 8409251e10 cmd/go: document GODEBUG=installgoroot=all
+ 2023-01-17 66689c7d46 doc/go1.20: remove mention of arena goexperiment
+ 2023-01-17 145dd38471 archive/tar, archive/zip: document ErrInsecurePath and GODEBUG setting
+ 2023-01-16 1c65b69bd1 runtime: fix performance regression in morestack_noctxt on ppc64
+ 2023-01-13 ebb572d82f Revert "internal/fsys: follow root symlink in fsys.Walk"
+ 2023-01-13 16cec4e7a0 doc/go1.20: mention build speed improvements
+ 2023-01-13 643f463186 cmd/cover: remove go.mod from testdata subdir

Change-Id: I4d56c9353d423f7e7169db7e30cb59515d422a56

16 months agocmd/compile: ensure temp register mask isn't empty
Keith Randall [Tue, 17 Jan 2023 17:35:21 +0000 (09:35 -0800)]
cmd/compile: ensure temp register mask isn't empty

We need to avoid nospill registers at this point in regalloc.
Make sure that we don't restrict our register set to avoid registers
desired by other instructions, if the resulting set includes only
nospill registers.

Fixes #57846

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

16 months agoos: document that Rename is not atomic on non-Unix platforms
Alan Donovan [Tue, 17 Jan 2023 16:30:48 +0000 (11:30 -0500)]
os: document that Rename is not atomic on non-Unix platforms

Windows provides no reliable way to rename files atomically.

The Plan 9 implementation of os.Rename performs a deletion
if the target exists.

Change-Id: Ife5f9c97b21f48c11e300cd76d8c7f715db09fd4
Reviewed-on: https://go-review.googlesource.com/c/go/+/462395
Auto-Submit: Alan Donovan <adonovan@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Alan Donovan <adonovan@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
16 months agodoc/go1.20: update cryptography release notes
Filippo Valsorda [Thu, 29 Dec 2022 14:52:37 +0000 (15:52 +0100)]
doc/go1.20: update cryptography release notes

Change-Id: I5d6d2bd5cbb246ea514e5adbe936fb31b92904af
Reviewed-on: https://go-review.googlesource.com/c/go/+/459978
Run-TryBot: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Filippo Valsorda <filippo@golang.org>

16 months agostrings: remove redundant symbols
fangguizhen [Tue, 17 Jan 2023 16:37:42 +0000 (16:37 +0000)]
strings: remove redundant symbols

Change-Id: Ie3fe0274288d6cb6303acdcec1340c480e5c0b20
GitHub-Last-Rev: ce9d44619e970b1319fbccf3aace1ddf719bcec1
GitHub-Pull-Request: golang/go#57848
Reviewed-on: https://go-review.googlesource.com/c/go/+/462277
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
16 months agocmd/go: include coverage build flags for "go list"
Than McIntosh [Fri, 13 Jan 2023 21:46:49 +0000 (16:46 -0500)]
cmd/go: include coverage build flags for "go list"

This patch ensures that the go command's "list" subcommand accepts
coverage-related build options, which were incorrectly left out when
"go build -cover" was rolled out. This is needed in order to do things
like check the staleness of an installed cover-instrumented target.

Fixes #57785.

Change-Id: I140732ff1e6b83cd9c453701bb8199b333fc0f2e
Reviewed-on: https://go-review.googlesource.com/c/go/+/462116
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

16 months agocrypto/ed25519: improve Ed25519ctx docs and add example
Filippo Valsorda [Thu, 29 Dec 2022 12:08:48 +0000 (13:08 +0100)]
crypto/ed25519: improve Ed25519ctx docs and add example

Change-Id: Ic215a90d1e1daa5805dbab1dc56480281e53b341
Reviewed-on: https://go-review.googlesource.com/c/go/+/459975
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Run-TryBot: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>

16 months agocrypto/x509: clarify that CheckSignatureFrom and CheckSignature are low-level APIs
Filippo Valsorda [Wed, 4 Jan 2023 20:51:50 +0000 (21:51 +0100)]
crypto/x509: clarify that CheckSignatureFrom and CheckSignature are low-level APIs

In particular, CheckSignatureFrom just can't check the path length
limit, because it might be enforced above the parent.

We don't need to document the supported signature algorithms for
CheckSignatureFrom, since we document at the constants in what contexts
they are allowed and not. That does leave CheckSignature ambiguous,
though, because that function doesn't have an explicit context.

Change-Id: I4c107440a93f60bc0de07df2b7efeb1a4a766da0
Reviewed-on: https://go-review.googlesource.com/c/go/+/460537
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Run-TryBot: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>

16 months agocmd/go: document GODEBUG=installgoroot=all
Russ Cox [Sat, 14 Jan 2023 20:08:49 +0000 (15:08 -0500)]
cmd/go: document GODEBUG=installgoroot=all

At the moment the only documentation is the release notes,
but everything mentioned in the release notes should have
proper documentation separate from them.

Change-Id: I9885962f6c6d947039b0be59b608385781479271
Reviewed-on: https://go-review.googlesource.com/c/go/+/462196
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
16 months agodoc/go1.20: remove mention of arena goexperiment
Russ Cox [Tue, 17 Jan 2023 14:21:43 +0000 (09:21 -0500)]
doc/go1.20: remove mention of arena goexperiment

The arena goexperiment contains code used inside Google in very
limited use cases that we will maintain, but the discussion on #51317
identified serious problems with the very idea of adding arenas to the
standard library. In particular the concept tends to infect many other
APIs in the name of efficiency, a bit like sync.Pool except more
publicly visible.

It is unclear when, if ever, we will pick up the idea and try to push
it forward into a public API, but it's not going to happen any time
soon, and we don't want users to start depending on it: it's a true
experiment and may be changed or deleted without warning.

The arena text in the release notes makes them seem more official
and supported than they really are, and we've already seen a couple
blog posts based on that erroneous belief. Delete the text to try to
set expectations better.

Change-Id: I4f6e328ac470a9cd410f5f722d0769ef62d5e5ba
Reviewed-on: https://go-review.googlesource.com/c/go/+/462355
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
Run-TryBot: Russ Cox <rsc@golang.org>
Auto-Submit: Russ Cox <rsc@golang.org>
Reviewed-by: Eli Bendersky <eliben@google.com>
16 months agoarchive/tar, archive/zip: document ErrInsecurePath and GODEBUG setting
Russ Cox [Sat, 14 Jan 2023 19:44:21 +0000 (14:44 -0500)]
archive/tar, archive/zip: document ErrInsecurePath and GODEBUG setting

These are mentioned in the release notes but not the actual doc comments.
Nothing should exist only in release notes.

Change-Id: I8d10f25a2c9b2677231929ba3f393af9034b777b
Reviewed-on: https://go-review.googlesource.com/c/go/+/462195
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

16 months agoruntime: fix performance regression in morestack_noctxt on ppc64
Archana R [Wed, 11 Jan 2023 17:45:28 +0000 (11:45 -0600)]
runtime: fix performance regression in morestack_noctxt on ppc64

In the fix for 54332 the MOVD R1, R1 instruction was added to
morestack_noctxt function to set the SPWRITE bit. However, the
instruction MOVD R1, R1 results in or r1,r1,r1 which is a special
instruction on ppc64 architecture as it changes the thread priority
and can negatively impact performance in some cases.
More details on such similar nops can be found in Power ISA v3.1
Book II on Power ISA Virtual Environment architecture in the chapter
on Program Priority Registers and Or instructions.
Replacing this by OR R0, R1 has the same affect on setting SPWRITE as
needed by the first fix but does not affect thread priority and
hence does not cause the degradation in performance

Hash65536-64           2.81GB/s ±10%  16.69GB/s ± 0%  +494.44%
Fixes #57741

Change-Id: Ib912e3716c6afd277994d6c1c5b2891f82225d50
Reviewed-on: https://go-review.googlesource.com/c/go/+/461597
Reviewed-by: Benny Siegert <bsiegert@gmail.com>
Reviewed-by: Lynn Boger <laboger@linux.vnet.ibm.com>
Auto-Submit: Benny Siegert <bsiegert@gmail.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Lynn Boger <laboger@linux.vnet.ibm.com>

16 months agoRevert "internal/fsys: follow root symlink in fsys.Walk"
Bryan Mills [Fri, 13 Jan 2023 20:20:31 +0000 (20:20 +0000)]
Revert "internal/fsys: follow root symlink in fsys.Walk"

This reverts CL 448360 and adds a regression test for #57754.

Reason for revert: broke 'go list' in Debian's distribution of the Go toolchain

Fixes #57754.
Updates #50807.

Change-Id: I3e8b9126294c55f21572774b549fb28f29eded0f
Reviewed-on: https://go-review.googlesource.com/c/go/+/461959
Reviewed-by: Russ Cox <rsc@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>

16 months agodoc/go1.20: mention build speed improvements
Austin Clements [Fri, 13 Jan 2023 16:40:13 +0000 (11:40 -0500)]
doc/go1.20: mention build speed improvements

For #49569.
For #54202.

Change-Id: Iac45338bc4e45617e8ac7425076cf4cd0af157a4
Reviewed-on: https://go-review.googlesource.com/c/go/+/461957
TryBot-Bypass: Austin Clements <austin@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
16 months agocmd/cover: remove go.mod from testdata subdir
Than McIntosh [Fri, 13 Jan 2023 15:31:21 +0000 (10:31 -0500)]
cmd/cover: remove go.mod from testdata subdir

Remove a superfluous go.mod file in one of the testdata subdirs; test
runs ok without it, no need for it to be there (can confuse tooling).

Change-Id: I3c43dd8ca557fdd32ce2f84cdb2427326a2dd35e
Reviewed-on: https://go-review.googlesource.com/c/go/+/461945
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Than McIntosh <thanm@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

16 months ago[release-branch.go1.20] go1.20rc3 go1.20rc3
Gopher Robot [Thu, 12 Jan 2023 16:47:17 +0000 (16:47 +0000)]
[release-branch.go1.20] go1.20rc3

Change-Id: I87007947c075e8b90dd74bdf164b59e81487f6de
Reviewed-on: https://go-review.googlesource.com/c/go/+/461836
Reviewed-by: Heschi Kreinick <heschi@google.com>
Auto-Submit: Gopher Robot <gobot@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Run-TryBot: Gopher Robot <gobot@golang.org>

16 months ago[release-branch.go1.20] all: merge master (245e95d) into release-branch.go1.20
Carlos Amedee [Wed, 11 Jan 2023 23:01:17 +0000 (18:01 -0500)]
[release-branch.go1.20] all: merge master (245e95d) into release-branch.go1.20

Merge List:

+ 2023-01-11 245e95dfab go/types, types2: don't look up fields or methods when expecting a type
+ 2023-01-11 18625d9bec runtime: fix incorrect comment
+ 2023-01-11 6ad27161f8 cmd/compile: better error message for when a type is in a constraint but not the type set
+ 2023-01-10 76d39ae349 cmd/link, runtime: Apple libc atfork workaround take 3
+ 2023-01-10 0a0de0fc42 runtime: revert use of __fork to work around Apple atfork bugs
+ 2023-01-10 82f09b75ca os/exec: avoid leaking an exec.Cmd in TestWaitInterrupt
+ 2023-01-09 0202ad0b3a cmd/compile: prevent IsNewObject from taking quadratic time
+ 2023-01-09 64519baf38 cmd/compile/internal/pgo: add hint to missing start_line error
+ 2023-01-09 376076f3c6 runtime: skip TestCgoPprofCallback in short mode, don't run in parallel
+ 2023-01-09 0bbd67e52f runtime/pprof: document possibility of empty stacks
+ 2023-01-09 d9f23cfe78 runtime/pprof: improve output of TestLabelSystemstack
+ 2023-01-09 8232a09e3e sync/atomic: fix the note of atomic.Store
+ 2023-01-09 841c3eb166 all: fix typos in go file comments
+ 2023-01-06 f721fa3be9 syscall: skip TestUseCgroupFD if cgroupfs not mounted
+ 2023-01-06 76ec919237 net: fix typo in hosts.go
+ 2023-01-06 660d4815ea cmd/compile: describe how Go maps to wasm implementation
+ 2023-01-05 119f679a3b crypto/tls: fix typo in cacheEntry godoc
+ 2023-01-05 d50ea217f6 cmd/cover: fix problems with "go test -covermode=atomic sync/atomic"
+ 2023-01-04 bae7d772e8 doc/go1.20: fix links to new strings functions
+ 2023-01-04 4e7c838483 crypto/internal/boring: add dev.boringcrypto README.md text
+ 2023-01-04 46e3d9d12a cmd/compile: use "satisfies" (not "implements") for constraint errors
+ 2023-01-04 79cdecc852 cmd/gofmt: fix a typo in a comment
+ 2023-01-03 9955a7e9bb README.vendor: minor updates
+ 2023-01-03 d03231d9ce doc/go1.20: fix http.ResponseController example
+ 2023-01-03 cdc73f0679 .github: suggest using private browsing in pkgsite template

Change-Id: I73be496aa4163ad1d3a6cc8114f1a612968d4b10

16 months agogo/types, types2: don't look up fields or methods when expecting a type
Robert Findley [Wed, 11 Jan 2023 19:41:03 +0000 (14:41 -0500)]
go/types, types2: don't look up fields or methods when expecting a type

As we have seen many times, the type checker must be careful to avoid
accessing named type information before the type is fully set up. We
need a more systematic solution to this problem, but for now avoid one
case that causes a crash: checking a selector expression on an
incomplete type when a type expression is expected.

For golang/go#57522

Change-Id: I7ed31b859cca263276e3a0647d1f1b49670023a9
Reviewed-on: https://go-review.googlesource.com/c/go/+/461577
Run-TryBot: Robert Findley <rfindley@google.com>
Auto-Submit: Robert Findley <rfindley@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@google.com>
16 months agoruntime: fix incorrect comment
zhengchaopu [Wed, 11 Jan 2023 08:31:27 +0000 (08:31 +0000)]
runtime: fix incorrect comment

Fix incorrect comment for the runtime package.

Change-Id: Iab889eff0e9c622afbed959d32b8b5f0ed0bfebf
GitHub-Last-Rev: e9587868db36d9dd466f52f7ffc5de09947a6b2f
GitHub-Pull-Request: golang/go#57731
Reviewed-on: https://go-review.googlesource.com/c/go/+/461498
Reviewed-by: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Keith Randall <khr@google.com>
16 months agocmd/compile: better error message for when a type is in a constraint but not the...
Robert Griesemer [Wed, 4 Jan 2023 01:05:53 +0000 (17:05 -0800)]
cmd/compile: better error message for when a type is in a constraint but not the type set

While at it, also remove the word "constraint" in the detail explanation
of an unsatisfied constraint.

Fixes #57500.

Change-Id: I55dae1694de2cfdb434aeba9d4a3530af7aca8f5
Reviewed-on: https://go-review.googlesource.com/c/go/+/460455
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@google.com>
16 months agocmd/link, runtime: Apple libc atfork workaround take 3
Russ Cox [Wed, 4 Jan 2023 14:21:14 +0000 (09:21 -0500)]
cmd/link, runtime: Apple libc atfork workaround take 3

CL 451735 worked around bugs in Apple's atfork handlers by calling
notify_is_valid_token and xpc_atfork_child at startup, so that init
code that wouldn't be safe in the child process would be warmed up in
the parent process instead, but xpc_atfork_child broke use of the xpc
library in Go programs, and xpc is internally used by various macOS
frameworks (#57263).

CL 459175 reverted that change, and then CL 459176 tried a new
approach: use __fork, which doesn't call any of the atfork handlers at all.
That worked, but an Apple engineer reviewing the change in private
email suggests that since __fork is not public API, it should be avoided.
The same engineer (with access to the source code for the xpc library)
suggests that the breakage in #57263 is caused by xpc_atfork_child
marking the library as unusable, expecting an imminent call to exec,
and that calling xpc_date_create_from_current instead would do the
necessary initialization without marking xpc as unusable.

CL 460475 reverted that change, to prepare for this one.

This CL goes back to the original “call functions to warm things up”
approach, replacing xpc_atfork_child with xpc_date_create_from_current.

The CL also updates cmd/link to use OS and SDK version 10.13.0 for
x86 macOS binaries, up from 10.9.0, also suggested by the Apple engineer.
Combined with the two warmup calls, this makes the fork hangs go away.
The minimum macOS version has been 10.13 High Sierra since Go 1.17,
so there should be no problem with writing that in the binaries too.

Fixes #33565.
Fixes #56784.
Fixes #57263.
Fixes #57577.

Change-Id: I20769d9daa1fe9ea930f8009481335f8a14dc21b
Reviewed-on: https://go-review.googlesource.com/c/go/+/460476
Auto-Submit: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
16 months agoruntime: revert use of __fork to work around Apple atfork bugs
Russ Cox [Wed, 4 Jan 2023 14:18:02 +0000 (09:18 -0500)]
runtime: revert use of __fork to work around Apple atfork bugs

An Apple engineer suggests that since __fork is not public API,
it would be better to use a different fix. With the benefit of source code,
they suggest using xpc_date_create_from_current instead of
xpc_atfork_child. The latter sets some flags that disable certain
functionality for the remainder of the process lifetime (expecting exec),
while the former should do the necessary setup.

Reverting the __fork fix in order to prepare a clean fix based
on CL 451735 using xpc_date_create_from_current.

This reverts commit c61d322d5f9e3fcffa4c523892af432dca030c12.

Change-Id: I2da293ff537237ffd2d40ad756d827c95c84635b
Reviewed-on: https://go-review.googlesource.com/c/go/+/460475
Auto-Submit: Russ Cox <rsc@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
16 months agoos/exec: avoid leaking an exec.Cmd in TestWaitInterrupt
Bryan C. Mills [Tue, 10 Jan 2023 16:29:25 +0000 (11:29 -0500)]
os/exec: avoid leaking an exec.Cmd in TestWaitInterrupt

In CL 436655 I added a GODEBUG setting to this test process to verify
that Wait is eventually called for every exec.Cmd before it becomes
unreachable. However, the cmdHang test helpers in
TestWaitInterrupt/Exit-hang and TestWaitInterrupt/SIGKILL-hang
intentially leak a subprocess in order to simulate a leaky third-party
program, as Go users might encounter in practical use.

To avoid tripping over the leak check, we call Wait on the leaked
subprocess in a background goroutine. Since we expect the process
running cmdHang to exit before its subprocess does, the call to Wait
should have no effect beyond suppressing the leak check.

Fixes #57596.
Updates #52580.
Updates #50436.

Change-Id: Ia4b88ea47fc6b605c27ca6d9d7669c874867a900
Reviewed-on: https://go-review.googlesource.com/c/go/+/460998
Run-TryBot: Bryan Mills <bcmills@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

16 months agocmd/compile: prevent IsNewObject from taking quadratic time
Keith Randall [Mon, 9 Jan 2023 17:49:32 +0000 (09:49 -0800)]
cmd/compile: prevent IsNewObject from taking quadratic time

As part of IsNewObject, we need to go from the SelectN[0] use of
a call to the SelectN[1] use of a call. The current code does this
by just looking through the block. If the block is very large,
this ends up taking quadratic time.

Instead, prepopulate a map from call -> SelectN[1] user of that call.
That lets us find the SelectN[1] user in constant time.

Fixes #57657

Change-Id: Ie2e0b660af5c080314f4f17ba2838510a1147f9e
Reviewed-on: https://go-review.googlesource.com/c/go/+/461080
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
16 months agocmd/compile/internal/pgo: add hint to missing start_line error
Michael Pratt [Mon, 9 Jan 2023 18:59:54 +0000 (13:59 -0500)]
cmd/compile/internal/pgo: add hint to missing start_line error

Profiles only began adding Function.start_line in 1.20. If it is
missing, add a hint to the error message that they may need to profile a
build of the application built with a newer version of the toolchain.

Technically profiles are not required to come from Go itself (e.g., they
could be converted from perf), but in practice they most likely are.

Fixes #57674.

Change-Id: I87eca126d3fed0cff94bbb8dd748bd4652f88b12
Reviewed-on: https://go-review.googlesource.com/c/go/+/461195
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Michael Pratt <mpratt@google.com>

16 months agoruntime: skip TestCgoPprofCallback in short mode, don't run in parallel
Ian Lance Taylor [Thu, 5 Jan 2023 02:03:46 +0000 (18:03 -0800)]
runtime: skip TestCgoPprofCallback in short mode, don't run in parallel

Fixes #54778

Change-Id: If9aef0c06b993ef2aedbeea9452297ee9f11fa06
Reviewed-on: https://go-review.googlesource.com/c/go/+/460461
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>

16 months agoruntime/pprof: document possibility of empty stacks
Austin Clements [Thu, 5 Jan 2023 14:08:25 +0000 (09:08 -0500)]
runtime/pprof: document possibility of empty stacks

I spent quite a while determining the cause of empty stacks in
profiles and reasoning out why this is okay. There isn't a great place
to record this knowledge, but a documentation comment on
appendLocsForStack is better than nothing.

Updates #51550.

Change-Id: I2eefc6ea31f1af885885c3d96199319f45edb4ce
Reviewed-on: https://go-review.googlesource.com/c/go/+/460695
Reviewed-by: Felix Geisendörfer <felix.geisendoerfer@datadoghq.com>
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
16 months agoruntime/pprof: improve output of TestLabelSystemstack
Austin Clements [Wed, 4 Jan 2023 17:31:23 +0000 (12:31 -0500)]
runtime/pprof: improve output of TestLabelSystemstack

The current output of TestLabelSystemstack is a bit cryptic. This CL
improves various messages and hopefully simplifies the logic in the
test.

Simplifying the logic leads to three changes in possible outcomes,
which I verified by running the logic before and after this change
through all 2^4 possibilities (https://go.dev/play/p/bnfb-OQCT4j):

1. If a sample both must be labeled and must not be labeled, the test
now reports that explicitly rather than giving other confusing output.

2. If a sample must not be labeled but is, the current logic will
print two identical error messages. The new logic prints only one.

3. If the test finds no frames at all that it recognizes, but the
sample is labeled, it will currently print a confusing "Sample labeled
got true want false" message. The new logic prints nothing. We've seen
this triggered by empty stacks in profiles.

Fixes #51550. This bug was caused by case 3 above, where it was
triggered by a profile label on an empty stack. It's valid for empty
stacks to appear in a profile if we sample a goroutine just as it's
exiting (and that goroutine may have a profile label), so the test
shouldn't fail in this case.

Change-Id: I1593ec4ac33eced5bb89572a3ba7623e56f2fb3d
Reviewed-on: https://go-review.googlesource.com/c/go/+/460516
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: Felix Geisendörfer <felix.geisendoerfer@datadoghq.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

16 months agosync/atomic: fix the note of atomic.Store
csuzhang [Mon, 9 Jan 2023 01:57:53 +0000 (01:57 +0000)]
sync/atomic: fix the note of atomic.Store

Change-Id: Id485d0f1e06febe97d1a770bc26c138d9613a7dd
GitHub-Last-Rev: e57dd3e1abb58031b3d8bec8beace1560faad397
GitHub-Pull-Request: golang/go#57679
Reviewed-on: https://go-review.googlesource.com/c/go/+/461076
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>

16 months agoall: fix typos in go file comments
Marcel Meyer [Sat, 7 Jan 2023 13:10:38 +0000 (13:10 +0000)]
all: fix typos in go file comments

These typos were found by executing grep, aspell, sort, and uniq in
a pipe and searching the resulting list manually for possible typos.

    grep -r --include '*.go' -E '^// .*$' . | aspell list | sort | uniq

Change-Id: I56281eda3b178968fbf104de1f71316c1feac64f
GitHub-Last-Rev: e91c7cee340fadfa32b0c1773e4e5cd1ca567638
GitHub-Pull-Request: golang/go#57669
Reviewed-on: https://go-review.googlesource.com/c/go/+/460767
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
16 months agosyscall: skip TestUseCgroupFD if cgroupfs not mounted
Shengjing Zhu [Thu, 5 Jan 2023 07:00:25 +0000 (15:00 +0800)]
syscall: skip TestUseCgroupFD if cgroupfs not mounted

When building in schroot (for building Debian package),
the cgroupfs is not mounted in schroot (only sysfs is mounted).

Change-Id: Ieddac7b2f334d58d832f5d84d81af812badf3720
Reviewed-on: https://go-review.googlesource.com/c/go/+/460539
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>

16 months agonet: fix typo in hosts.go
Ikko Eltociear Ashimine [Thu, 5 Jan 2023 18:05:31 +0000 (18:05 +0000)]
net: fix typo in hosts.go

cannonical -> canonical

Change-Id: I656ea210d8ef6eaa85245cb8f463f6b4fd67e1a2
GitHub-Last-Rev: 5a93045add2f2a6885b46377c784f665ab465cfd
GitHub-Pull-Request: golang/go#57633
Reviewed-on: https://go-review.googlesource.com/c/go/+/460756
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
16 months agocmd/compile: describe how Go maps to wasm implementation
Keith Randall [Tue, 6 Dec 2022 21:40:33 +0000 (13:40 -0800)]
cmd/compile: describe how Go maps to wasm implementation

Change-Id: Ie4d8e1ae9c4c6046d27a27a61ef1147bc0ff373c
Reviewed-on: https://go-review.googlesource.com/c/go/+/455715
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Richard Musiol <neelance@gmail.com>
Reviewed-by: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>

16 months agocrypto/tls: fix typo in cacheEntry godoc
Tobias Klauser [Thu, 5 Jan 2023 16:08:07 +0000 (17:08 +0100)]
crypto/tls: fix typo in cacheEntry godoc

Change-Id: Idcea184a5b0c205efd3c91c60b5d954424f37679
Reviewed-on: https://go-review.googlesource.com/c/go/+/460540
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>

16 months agocmd/cover: fix problems with "go test -covermode=atomic sync/atomic"
Than McIntosh [Thu, 22 Dec 2022 19:10:12 +0000 (14:10 -0500)]
cmd/cover: fix problems with "go test -covermode=atomic sync/atomic"

This patch fixes an elderly bug with "go test -covermode=atomic
sync/atomic". Change the cover tool to avoid adding an import of
sync/atomic when processing "sync/atomic" itself in atomic mode;
instead make direct calls to AddUint32/StoreUint32. In addition,
change the go command to avoid injecting an artificial import of
"sync/atomic" for sync/atomic itself.

Fixes #57445.

Change-Id: I8c8fbd0bcf26c8a8607d4806046f826296508c74
Reviewed-on: https://go-review.googlesource.com/c/go/+/459335
Run-TryBot: Than McIntosh <thanm@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

16 months agodoc/go1.20: fix links to new strings functions
Piers [Wed, 4 Jan 2023 16:45:22 +0000 (16:45 +0000)]
doc/go1.20: fix links to new strings functions

Links under strings package were linking to the bytes versions of the functions.

Change-Id: If6ebe37fede8e417f8683695783aa767bc01e9c7
GitHub-Last-Rev: 8849285122cb58c17b5979144649075861d8a134
GitHub-Pull-Request: golang/go#57579
Reviewed-on: https://go-review.googlesource.com/c/go/+/460458
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>

16 months agocrypto/internal/boring: add dev.boringcrypto README.md text
Russ Cox [Wed, 4 Jan 2023 15:09:30 +0000 (10:09 -0500)]
crypto/internal/boring: add dev.boringcrypto README.md text

Add the text from dev.boringcrypto's README making clear what
this code is and that it is unsupported.

Change-Id: Ie49e8ccff10436f5d27ed422f159b4899193c9a5
Reviewed-on: https://go-review.googlesource.com/c/go/+/460515
Reviewed-by: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
Run-TryBot: Russ Cox <rsc@golang.org>

16 months agocmd/compile: use "satisfies" (not "implements") for constraint errors
Robert Griesemer [Wed, 4 Jan 2023 00:01:49 +0000 (16:01 -0800)]
cmd/compile: use "satisfies" (not "implements") for constraint errors

Per the latest spec, we distinguish between interface implementation
and constraint satisfaction. Use the verb "satisfy" when reporting
an error about failing constraint satisfaction.

This CL only changes error messages. It has no impact on correct code.

Fixes #57564.

Change-Id: I6dfb3b2093c2e04fe5566628315fb5f6bd709f17
Reviewed-on: https://go-review.googlesource.com/c/go/+/460396
Reviewed-by: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Robert Griesemer <gri@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
16 months agocmd/gofmt: fix a typo in a comment
Roland Illig [Wed, 4 Jan 2023 06:59:03 +0000 (06:59 +0000)]
cmd/gofmt: fix a typo in a comment

Change-Id: I34b2b9f9b70e39c872d5edbbda4de0fe330211f5
GitHub-Last-Rev: 723e36e11ee011c54d3ffc8125d0477c8eed25a0
GitHub-Pull-Request: golang/go#57566
Reviewed-on: https://go-review.googlesource.com/c/go/+/460457
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
16 months ago[release-branch.go1.20] go1.20rc2 go1.20rc2
Gopher Robot [Wed, 4 Jan 2023 15:42:49 +0000 (15:42 +0000)]
[release-branch.go1.20] go1.20rc2

Change-Id: Ieb30cc96008bd705677e44983c68d4581706cc05
Reviewed-on: https://go-review.googlesource.com/c/go/+/460498
Auto-Submit: Gopher Robot <gobot@golang.org>
Run-TryBot: Gopher Robot <gobot@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
16 months agoREADME.vendor: minor updates
Ian Lance Taylor [Sat, 31 Dec 2022 21:11:35 +0000 (13:11 -0800)]
README.vendor: minor updates

Change-Id: Iaacc96e6302833019ebf7a82d5a1ae49f6ff1955
Reviewed-on: https://go-review.googlesource.com/c/go/+/460175
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

16 months agodoc/go1.20: fix http.ResponseController example
Alexander Yastrebov [Sat, 17 Dec 2022 12:47:53 +0000 (12:47 +0000)]
doc/go1.20: fix http.ResponseController example

Fixes #57162

Change-Id: I190810d702e503822265b12c56db69ec1093233c
GitHub-Last-Rev: e8b259d4b37523f1992fb92d99cbe068ab070eb2
GitHub-Pull-Request: golang/go#57385
Reviewed-on: https://go-review.googlesource.com/c/go/+/458275
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Matt Layher <mdlayher@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
16 months ago.github: suggest using private browsing in pkgsite template
Dan Peterson [Mon, 5 Sep 2022 17:18:40 +0000 (14:18 -0300)]
.github: suggest using private browsing in pkgsite template

I opened #54872 without considering my browser's extensions and one of
them ended up being the cause of my issue. This seems to be a common
error.

To help that, add a suggestion to use a private/incognito tab/window
to the pkgsite issue template when reproducing issues. This probably
would have been enough for me to figure things out before opening my
issue.

Updates #54872, #47213

Change-Id: Ic61a3462cb902c91554cf9432aaae1222c6a991e
Reviewed-on: https://go-review.googlesource.com/c/go/+/427962
Run-TryBot: Dan Peterson <danp@danp.net>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Hyang-Ah Hana Kim <hyangah@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
16 months ago[release-branch.go1.20] all: merge master (db36eca) into release-branch.go1.20
Heschi Kreinick [Tue, 3 Jan 2023 17:21:38 +0000 (12:21 -0500)]
[release-branch.go1.20] all: merge master (db36eca) into release-branch.go1.20

Merge List:

+ 2022-12-29 db36eca33c doc/go1.20: fix typos
+ 2022-12-29 642fd5f7ce go/types, types2: use strict comparability for type set intersection
+ 2022-12-28 9123221ccf misc/cgo/testsanitizers: run libfuzzer tests in temp directory
+ 2022-12-27 e870de9936 misc/cgo/testsanitizers: add libfuzzer tests
+ 2022-12-23 38cfb3be9d testing: rephrase the sentence about naming test files
+ 2022-12-23 1ba7341cb2 cmd/link, runtime: use a different section for Go libfuzzer counters
+ 2022-12-22 c61d322d5f runtime: call __fork instead of fork on darwin
+ 2022-12-22 6c9b661867 runtime: revert Apple libc atfork workaround
+ 2022-12-22 6d3139b203 misc/cgo/testshared: test build std in shared mode
+ 2022-12-22 de6abd7889 runtime/internal/startlinetest: work around shared buildmode linking issue
+ 2022-12-22 18baca6765 runtime/race: add build tag to internal amd64vN packages
+ 2022-12-22 13ed4f42f0 doc/go1.20: fix typo
+ 2022-12-21 fadd77c05b runtime/coverage: add missing file close in test support helper
+ 2022-12-21 c9a10d48a8 crypto/x509: return typed verification errors on macOS
+ 2022-12-21 2321abc5e9 archive/tar, archive/zip: revert documentation of ErrInsecurePath
+ 2022-12-21 458241f981 net/http/httputil: don't add X-Forwarded-{Host,Proto} after invoking Director funcs
+ 2022-12-21 58f6022eee syscall: don't use faccessat2 on android
+ 2022-12-21 78fc81070a net: use correct dns msg size
+ 2022-12-19 a5a4744250 os: reenable TestReaddirSmallSeek on windows
+ 2022-12-17 0b2ad1d815 cmd/compile: sign-extend the 2nd argument of the LoweredAtomicCas32 on loong64,mips64x,riscv64
+ 2022-12-16 8bcc490667 os/user,net: add -fno-stack-protector to CFLAGS
+ 2022-12-16 f4b42f5cb8 net/http: improve errors in TestCancelRequestWhenSharingConnection
+ 2022-12-16 24ac659a39 syscall, internal/poll: fall back to accept on linux-arm
+ 2022-12-16 3323dab1f4 os/exec: retry ETXTBSY errors in TestFindExecutableVsNoexec
+ 2022-12-15 628a1e7d3a doc/go1.20: fix typo
+ 2022-12-15 357ea85892 spec: fix typo
+ 2022-12-14 ea14d1b6e1 spec: document which recursive arrays and structs are valid/invalid
+ 2022-12-14 0b8add46ce doc/go1.20.html: pre-announce dropping Windows 7, 8, and friends
+ 2022-12-14 4f8bc6224b cmd/compile: desugar OCALLMETH->OCALLFUNC within devirtualization
+ 2022-12-14 5c682f94c6 spec: document illegal recursive type parameter lists
+ 2022-12-14 bd42aa86d3 spec: describe new semantics for comparable and constraint satisfaction
+ 2022-12-14 ffefcd360b spec: introduce notion of strict comparability
+ 2022-12-13 cb07765045 syscall: fix closing of reordered FDs in plan9 ForkExec
+ 2022-12-13 5ba98b9756 go/types, types2: report type mismatch error when conversion is impossible
+ 2022-12-13 61e2b8ec59 cmd/gc: test temp string comparison with all ops
+ 2022-12-12 b16e94d13d syscall: skip TestUseCgroupFD if cgroupfs mounted RO
+ 2022-12-12 27301e8247 syscall: fix shadowing bugs in forkAndExecInChild
+ 2022-12-12 6f7a95d25e sync: remove unused const
+ 2022-12-12 6b895d9eaa doc/go1.20: fix typo
+ 2022-12-12 c6ad9dc9b5 debug/buildinfo: check pointer size on buildinfo.Read
+ 2022-12-12 5dca7ed66f doc/go1.20: fix URL anchor
+ 2022-12-11 888047c310 cmd/compile: fix conditional move rule on PPC64
+ 2022-12-10 9b8750f53e os: skip size test in TestLstat if the file is a symlink
+ 2022-12-09 e8f78cb60c cmd/compile: fix conditional select rule
+ 2022-12-09 e76c87b191 doc: fix typo in 1.20 release notes
+ 2022-12-09 80f7484af7 os/user: zero-initialize C structs returned to Go
+ 2022-12-08 e738a2f19b go/types, types2: always rename type parameters during inference
+ 2022-12-08 8247b9f17a doc: fix typo
+ 2022-12-08 f368abb46e doc/go1.20: correct test binary -v flag value for test2json
+ 2022-12-08 7973b0e508 cmd/{go,cover,covdata}: fix 'package main' inconsistent handling
+ 2022-12-08 0aad4d3257 cmd/link: fix dynamic interpreter path for musl-based linux amd64
+ 2022-12-08 eaf0e3d465 runtime: remove arbitrary timeouts in finalizer tests
+ 2022-12-08 c8313d4fa8 cmd/go: deflake TestScript/test2json_interrupt
+ 2022-12-08 b9747e0e6b os/user: on AIX getpwuid_r seems to return -1 on overflow
+ 2022-12-07 9431237d77 internal/safefilepath: fix TestFromFS on Plan 9
+ 2022-12-07 7c7cd56870 cmd/go: in TestTerminalPassthrough, delay subprocess exit until the PTY has been read

Change-Id: I037343df0fe5b171b5f5726fcc55c01108d2563e

17 months agodoc/go1.20: fix typos
Xiao Cui [Thu, 29 Dec 2022 00:35:13 +0000 (19:35 -0500)]
doc/go1.20: fix typos

Change-Id: Ie2e583cba9e9bec7d642e323e77fb2d9b05dc7bc
Reviewed-on: https://go-review.googlesource.com/c/go/+/459780
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
17 months agogo/types, types2: use strict comparability for type set intersection
Robert Griesemer [Wed, 28 Dec 2022 22:21:50 +0000 (14:21 -0800)]
go/types, types2: use strict comparability for type set intersection

Fixes #57486.

Change-Id: I4b71199a724718886ce6d7a49e96a9ebdcbcf737
Reviewed-on: https://go-review.googlesource.com/c/go/+/459816
Run-TryBot: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>

17 months agomisc/cgo/testsanitizers: run libfuzzer tests in temp directory
Cherry Mui [Tue, 27 Dec 2022 22:29:28 +0000 (17:29 -0500)]
misc/cgo/testsanitizers: run libfuzzer tests in temp directory

The libFuzzer generated binary by default writes failure input
into the current directory. Set cmd.Dir to the temporary directory
so it won't write to GOROOT when running the test.

Change-Id: I3e4ce7e3f845be5c9f09511c36e7a9a396eafad2
Reviewed-on: https://go-review.googlesource.com/c/go/+/459556
Reviewed-by: Than McIntosh <thanm@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

17 months agomisc/cgo/testsanitizers: add libfuzzer tests
Cherry Mui [Tue, 27 Dec 2022 18:46:23 +0000 (13:46 -0500)]
misc/cgo/testsanitizers: add libfuzzer tests

Apparently we don't have tests for libfuzzer mode. Add some tests.

Updates #57449.

Change-Id: I813da3e71c6d6f15db31914b248db220b0b7041e
Reviewed-on: https://go-review.googlesource.com/c/go/+/459555
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>

17 months agotesting: rephrase the sentence about naming test files
Andrey Bozhko [Wed, 21 Dec 2022 22:24:05 +0000 (22:24 +0000)]
testing: rephrase the sentence about naming test files

This updates the explanation about
naming test files to be a little more clear.

Fixes #57389

Change-Id: I9b3a8e2dae5e3ad398b55624e183809b7d90864c
GitHub-Last-Rev: 9ff81b74b201ca032fd373424aa02a3fedaec008
GitHub-Pull-Request: golang/go#57399
Reviewed-on: https://go-review.googlesource.com/c/go/+/458435
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Fahad King <fahadking750@gmail.com>
Reviewed-by: Rob Pike <r@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: David Chase <drchase@google.com>
17 months agocmd/link, runtime: use a different section for Go libfuzzer counters
Cherry Mui [Wed, 21 Dec 2022 21:35:57 +0000 (16:35 -0500)]
cmd/link, runtime: use a different section for Go libfuzzer counters

Currently in libfuzzer mode, we put our counters in section
__sancov_cntrs. When linking with C/C++ code that also has fuzzer
counters, apparently the C linker combines our counters and their
counters and registers them together. But in the Go runtime we
also have code to register our counters. So the Go counters ended
up registered twice, causing problems.

Since we already have code to register our counters, put them in
a Go-specific section so it won't be combined with the C counters.

Fixes #57449.

Change-Id: If3d41735124e7e301572d4b7aecf7d057ac134c0
Reviewed-on: https://go-review.googlesource.com/c/go/+/459055
Reviewed-by: Nicolas Hillegeer <aktau@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Cherry Mui <cherryyz@google.com>

17 months agoruntime: call __fork instead of fork on darwin
Russ Cox [Thu, 22 Dec 2022 14:44:56 +0000 (09:44 -0500)]
runtime: call __fork instead of fork on darwin

Issues #33565 and #56784 were caused by hangs in the child process
after fork, while it ran atfork handlers that ran into slow paths that
didn't work in the child.

CL 451735 worked around those two issues by calling a couple functions
at startup to try to warm up those child paths. That mostly worked,
but it broke programs using cgo with certain macOS frameworks (#57263).

CL 459175 reverted CL 451735.

This CL introduces a different fix: bypass the atfork child handlers
entirely. For a general fork call where the child and parent are both
meant to keep executing the original program, atfork handlers can be
necessary to fix any state that would otherwise be tied to the parent
process. But Go only uses fork as preparation for exec, and it takes
care to limit what it attempts to do in the child between the fork and
exec. In particular it doesn't use any of the things that the macOS
atfork handlers are trying to fix up (malloc, xpc, others). So we can
use the low-level fork system call (__fork) instead of the
atfork-wrapped one.

The full list of functions that can be called in a child after fork in
exec_libc2.go is:

 - ptrace
 - setsid
 - setpgid
 - getpid
 - ioctl
 - chroot
 - setgroups
 - setgid
 - setuid
 - chdir
 - dup2
 - fcntl
 - close
 - execve
 - write
 - exit

I disassembled all of these while attached to a hung exec.test binary
and confirmed that nearly all of them are making direct kernel calls,
not using anything that the atfork handler needs to fix up.
The exceptions are ioctl, fcntl, and exit.

The ioctl and fcntl implementations do some extra work around the
kernel call but don't call any other functions, so they should still
be OK. (If not, we could use __ioctl and __fcntl instead, but without
a good reason, we should keep using the standard entry points.)

The exit implementation calls atexit handlers. That is almost
certainly inappropriate in a failed fork child, so this CL changes
that call to __exit on darwin. To avoid making unnecessary changes at
this point in the release cycle, this CL leaves OpenBSD calling plain
exit, even though that is probably a bug in the OpenBSD port
(filed #57446).

Fixes #33565.
Fixes #56784.
Fixes #57263.

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

17 months agoruntime: revert Apple libc atfork workaround
Russ Cox [Thu, 22 Dec 2022 14:21:03 +0000 (09:21 -0500)]
runtime: revert Apple libc atfork workaround

Revert CL 451735 (1f4394a0c926), which fixed #33565 and #56784
but also introduced #57263.

I have a different fix to apply instead. Since the first fix was
never backported, it will be easiest to backport the new fix
if the new fix is done in a separate CL from the revert.

Change-Id: I6c8ea3a46e542ee4702675bbc058e29ccd2723e0
Reviewed-on: https://go-review.googlesource.com/c/go/+/459175
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>

17 months agomisc/cgo/testshared: test build std in shared mode
Cherry Mui [Thu, 22 Dec 2022 04:31:48 +0000 (23:31 -0500)]
misc/cgo/testshared: test build std in shared mode

Test that "go install -buildmode=shared std" works.

For #57334.

Change-Id: I465a07cf2e9035995916ef9940b4c1eeba998099
Reviewed-on: https://go-review.googlesource.com/c/go/+/459056
Reviewed-by: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Tim Scharfenort <timscharfenort89@googlemail.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>

17 months agoruntime/internal/startlinetest: work around shared buildmode linking issue
Cherry Mui [Tue, 20 Dec 2022 22:26:18 +0000 (17:26 -0500)]
runtime/internal/startlinetest: work around shared buildmode linking issue

The runtime/internal/startlinetest package contains a call to a
function defined in runtime_test. Generally this is fine as this
package is only linked in for runtime_test. Except that for "go
install -buildmode=shared std", which include all packages in std,
including this test-only internal package. In this mode, the
caller is included in the linking but the callee is not, causing
linking error. Work around it by calling
runtime_test.callerStartLine via a function pointer. The function
pointer is only set in runtime_test. In the shared std build, the
function pointer will not be set, and this is fine.

Fixes #57334.

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

17 months agoruntime/race: add build tag to internal amd64vN packages
Cherry Mui [Tue, 20 Dec 2022 22:19:09 +0000 (17:19 -0500)]
runtime/race: add build tag to internal amd64vN packages

Only one of the runtime/race/internal/amd64vN packages should be
included in a build. Generally this is true because the
runtime/race package would import only one of them depending on
the build configuration. But for "go install -buildmode=shared std"
it includes all Go packages in std, which includes both, which
then causes link-time failure due to duplicated symbols. To avoid
this, we add build tags to the internal packages, so, depending on
the build configuation, only one package would contain buildable
go files therefore be included in the build.

For #57334.

Change-Id: I52ddc3a40e16c7d04b4dd861e9689918d27e8509
Reviewed-on: https://go-review.googlesource.com/c/go/+/458695
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Cherry Mui <cherryyz@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
17 months agodoc/go1.20: fix typo
Tobias Klauser [Wed, 21 Dec 2022 12:27:04 +0000 (13:27 +0100)]
doc/go1.20: fix typo

Change-Id: Ia0ce728ca18eefd835220b2076c4aa8ba00cda6d
Reviewed-on: https://go-review.googlesource.com/c/go/+/458815
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: David Chase <drchase@google.com>
17 months agoruntime/coverage: add missing file close in test support helper
Than McIntosh [Wed, 21 Dec 2022 16:03:16 +0000 (11:03 -0500)]
runtime/coverage: add missing file close in test support helper

The processPod() helper (invoked by processCoverTestDir, which is in
turn called by _testmain.go) was opening and reading counter data
files, but never closing them. Add a call to close the files after
they have been read.

Fixes #57407.

Change-Id: If9a489f92e4bab72c5b2df8697e14420a6f7b8f5
Reviewed-on: https://go-review.googlesource.com/c/go/+/458835
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

17 months agocrypto/x509: return typed verification errors on macOS
Roland Shoemaker [Tue, 22 Nov 2022 00:47:39 +0000 (16:47 -0800)]
crypto/x509: return typed verification errors on macOS

On macOS return the error code from SecTrustEvaluateWithError, and use
it to create typed errors that can be returned from Verify.

Fixes #56891

Change-Id: Ib597ce202abb60702f730e75da583894422e4c14
Reviewed-on: https://go-review.googlesource.com/c/go/+/452620
Run-TryBot: Roland Shoemaker <roland@golang.org>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
17 months agoarchive/tar, archive/zip: revert documentation of ErrInsecurePath
Damien Neil [Wed, 21 Dec 2022 17:50:48 +0000 (09:50 -0800)]
archive/tar, archive/zip: revert documentation of ErrInsecurePath

CL 452616 disables path security checks by default, enabling them
only when GODEBUG=tarinsecurepath=0 or GODEBUG=zipinsecurepath=0
is set. Remove now-obsolete documenation of the path checks.

For #55356

Change-Id: I4ae57534efe9e27368d5e67773a502dd0e56eff4
Reviewed-on: https://go-review.googlesource.com/c/go/+/458875
Reviewed-by: Russ Cox <rsc@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Damien Neil <dneil@google.com>

17 months agonet/http/httputil: don't add X-Forwarded-{Host,Proto} after invoking Director funcs
Damien Neil [Wed, 14 Dec 2022 17:55:06 +0000 (09:55 -0800)]
net/http/httputil: don't add X-Forwarded-{Host,Proto} after invoking Director funcs

This reverts CL 407414.

When forwarding an inbound request that contains an existing
X-Forwarded-Host or X-Forwarded-Proto header, a proxy might want
to preserve the header from the inbound request, replace it with
its own header, or not include any header at all.

CL 407414 replaces inbound X-Forwarded-{Host,Proto} headers by default,
and allows a Director func to disable sending these headers at all.
However, the Director hook API isn't sufficiently flexible to permit the
previous behavior of preserving inbound values unchanged.

The new Rewrite API does have this flexibility; users of Rewrite can
easily pick the exact behavior they want.

Revert the change to ReverseProxy when using a Director func.
Users who want a convenient way to set X-Forwarded-* headers to
reasonable values can migrate to Rewrite at their convenience,
and users depending on the current behavior will be unaffected.

For #50465.
Fixes #57132.

Change-Id: Ic42449c1bb525d6c9920bf721efbc519697f4f20
Reviewed-on: https://go-review.googlesource.com/c/go/+/457595
Run-TryBot: Damien Neil <dneil@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Roland Shoemaker <roland@golang.org>
17 months agosyscall: don't use faccessat2 on android
Michael Pratt [Tue, 20 Dec 2022 16:25:38 +0000 (11:25 -0500)]
syscall: don't use faccessat2 on android

The Android seccomp policy does not allow faccessat2, so attempting to
use it results in a SIGSYS. Avoid it and go straight to the fallback.

Fixes #57393.

Change-Id: I8d4e12a6f46cea5642d3b5b5a02c682529882f29
Reviewed-on: https://go-review.googlesource.com/c/go/+/458495
Reviewed-by: Austin Clements <austin@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Changkun Ou <mail@changkun.de>
Run-TryBot: Michael Pratt <mpratt@google.com>

17 months agonet: use correct dns msg size
Mateusz Poliwczak [Tue, 20 Dec 2022 15:24:06 +0000 (15:24 +0000)]
net: use correct dns msg size

Set bufSize to the actual dns message size, so that the p.Start (below) gets a fully valid dns message.

Change-Id: I585e8a3d71f88db93e09bd0dbbc0875ee6de9a97
GitHub-Last-Rev: 0967be35012d2e28366e6d47eee4968c7e8d5e4a
GitHub-Pull-Request: golang/go#57392
Reviewed-on: https://go-review.googlesource.com/c/go/+/458375
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
17 months agoos: reenable TestReaddirSmallSeek on windows
qmuntal [Mon, 19 Dec 2022 13:41:09 +0000 (14:41 +0100)]
os: reenable TestReaddirSmallSeek on windows

TestReaddirSmallSeek should have been reenabled as part of
CL 405275, but didn't. Do it now.

Updates #36019

Change-Id: I5676eee4e63675d30e9d48ac708e72bd036b6aee
Reviewed-on: https://go-review.googlesource.com/c/go/+/458336
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Quim Muntal <quimmuntal@gmail.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Reviewed-by: David Chase <drchase@google.com>
17 months agocmd/compile: sign-extend the 2nd argument of the LoweredAtomicCas32 on loong64,mips64...
Guoqi Chen [Sun, 18 Dec 2022 21:04:48 +0000 (05:04 +0800)]
cmd/compile: sign-extend the 2nd argument of the LoweredAtomicCas32 on loong64,mips64x,riscv64

The function LoweredAtomicCas32 is implemented using the LL-SC instruction pair
on loong64, mips64x, riscv64. However,the LL instruction on loong64, mips64x,
riscv64 is sign-extended, so it is necessary to sign-extend the 2nd parameter
"old" of the LoweredAtomicCas32, so that the instruction BNE after LL can get
the desired result.

The function prototype of LoweredAtomicCas32 in golang:
    func Cas32(ptr *uint32, old, new uint32) bool

When using an intrinsify implementation:
    case 1: (*ptr) <= 0x80000000 && old < 0x80000000
        E.g: (*ptr) = 0x7FFFFFFF, old = Rarg1= 0x7FFFFFFF

        After run the instruction "LL (Rarg0), Rtmp": Rtmp = 0x7FFFFFFF
        Rtmp ! = Rarg1(old) is false, the result we expect

    case 2: (*ptr) >= 0x80000000 && old >= 0x80000000
        E.g: (*ptr) = 0x80000000, old = Rarg1= 0x80000000

        After run the instruction "LL (Rarg0), Rtmp": Rtmp = 0xFFFFFFFF_80000000
        Rtmp ! = Rarg1(old) is true, which we do not expect

When using an non-intrinsify implementation:
    Because Rarg1 is loaded from the stack using sign-extended instructions
    ld.w, the situation described in Case 2 above does not occur

Benchmarks on linux/loong64:
name     old time/op  new time/op  delta
Cas      50.0ns ± 0%  50.1ns ± 0%   ~     (p=1.000 n=1+1)
Cas64    50.0ns ± 0%  50.1ns ± 0%   ~     (p=1.000 n=1+1)
Cas-4    56.0ns ± 0%  56.0ns ± 0%   ~     (p=1.000 n=1+1)
Cas64-4  56.0ns ± 0%  56.0ns ± 0%   ~     (p=1.000 n=1+1)

Benchmarks on Loongson 3A4000 (GOARCH=mips64le, 1.8GHz)
name     old time/op  new time/op  delta
Cas      70.4ns ± 0%  70.3ns ± 0%   ~     (p=1.000 n=1+1)
Cas64    70.7ns ± 0%  70.6ns ± 0%   ~     (p=1.000 n=1+1)
Cas-4    81.1ns ± 0%  80.8ns ± 0%   ~     (p=1.000 n=1+1)
Cas64-4  80.9ns ± 0%  80.9ns ± 0%   ~     (p=1.000 n=1+1)

Fixes #57282

Change-Id: I190a7fc648023b15fa392f7fdda5ac18c1561bac
Reviewed-on: https://go-review.googlesource.com/c/go/+/457135
Run-TryBot: Than McIntosh <thanm@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Wayne Zuo <wdvxdr@golangcn.org>
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: David Chase <drchase@google.com>
17 months agoos/user,net: add -fno-stack-protector to CFLAGS
Than McIntosh [Mon, 12 Dec 2022 15:53:17 +0000 (10:53 -0500)]
os/user,net: add -fno-stack-protector to CFLAGS

Some compilers default to having -fstack-protector on, which breaks
when using internal linking because the linker doesn't know how to
find the support functions.

Updates #52919.
Updates #54313.
Fixes #57261.

Change-Id: Iaae731851407af4521fff2dfefc5b7e3e92cf284
Reviewed-on: https://go-review.googlesource.com/c/go/+/456855
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
17 months agonet/http: improve errors in TestCancelRequestWhenSharingConnection
Damien Neil [Wed, 14 Dec 2022 23:49:58 +0000 (15:49 -0800)]
net/http: improve errors in TestCancelRequestWhenSharingConnection

Provide more information about why this test might be hanging waiting
for PutIdleConn to be called (#56587): If the round trip that should
result in PutIdleConn being invoked completes, report that to the
goroutine waiting for PutIdleConn.

For #56587

Change-Id: Ie476ea0ce4a48d2bda6b9b109f89d675a10e7e45
Reviewed-on: https://go-review.googlesource.com/c/go/+/457775
Auto-Submit: Damien Neil <dneil@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Damien Neil <dneil@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
17 months agosyscall, internal/poll: fall back to accept on linux-arm
Ian Lance Taylor [Thu, 15 Dec 2022 21:54:33 +0000 (13:54 -0800)]
syscall, internal/poll: fall back to accept on linux-arm

Our minimum Linux version is 2.6.32, and the accept4 system call was
introduced in 2.6.28, so we use accept4 everywhere. Unfortunately,
it turns out that the accept4 system call was only added to
linux-arm in 2.6.36, so for linux-arm only we need to try the accept4
system call and then fall back to accept if it doesn't work.

The code we use on linux-arm is the code we used in Go 1.17.
On non-arm platforms we continue using the simpler code introduced
in Go 1.18.

Adding accept4 to the ARM Linux kernel was:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=21d93e2e29722d7832f61cc56d73fb953ee6578e

Fixes #57333

Change-Id: I6680cb54dd4d3514a6887dda8906e6708c64459d
Reviewed-on: https://go-review.googlesource.com/c/go/+/457995
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

17 months agoos/exec: retry ETXTBSY errors in TestFindExecutableVsNoexec
Bryan C. Mills [Thu, 15 Dec 2022 22:09:00 +0000 (17:09 -0500)]
os/exec: retry ETXTBSY errors in TestFindExecutableVsNoexec

I made this test parallel in CL 439196, which exposed it to the
fork/exec race condition described in #22315. The ETXTBSY errors from
that race should resolve on their own, so we can simply retry the call
to get past them.

Fixes #56811.
Updates #22315.

Change-Id: I2c6aa405bf3a1769d69cf08bf661a9e7f86440b4
Reviewed-on: https://go-review.googlesource.com/c/go/+/458016
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

17 months agodoc/go1.20: fix typo
Robert Griesemer [Thu, 15 Dec 2022 17:10:20 +0000 (09:10 -0800)]
doc/go1.20: fix typo

Change-Id: Icddf980e533b86ca955660ad028f5ad04b6aecbe
Reviewed-on: https://go-review.googlesource.com/c/go/+/457916
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
TryBot-Bypass: Robert Griesemer <gri@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
17 months agospec: fix typo
Robert Griesemer [Thu, 15 Dec 2022 16:15:06 +0000 (08:15 -0800)]
spec: fix typo

Fixes #57323.

Change-Id: I77d3d747aa4746bb9a8cca0c0500ff8fa6ae33a3
Reviewed-on: https://go-review.googlesource.com/c/go/+/457915
Reviewed-by: Robert Griesemer <gri@google.com>
TryBot-Bypass: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
17 months agospec: document which recursive arrays and structs are valid/invalid
Robert Griesemer [Wed, 14 Dec 2022 05:16:09 +0000 (21:16 -0800)]
spec: document which recursive arrays and structs are valid/invalid

Fixes #5069.

Change-Id: I4bc0f52a9cd1e64a49846dffeb4be5cbecc29a96
Reviewed-on: https://go-review.googlesource.com/c/go/+/457342
TryBot-Bypass: Robert Griesemer <gri@google.com>
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
17 months agodoc/go1.20.html: pre-announce dropping Windows 7, 8, and friends
Heschi Kreinick [Wed, 14 Dec 2022 19:55:30 +0000 (14:55 -0500)]
doc/go1.20.html: pre-announce dropping Windows 7, 8, and friends

For #57003, #57004.

Change-Id: Ic1386a0ce83897411fbc68c83a9125af1cc11b54
Reviewed-on: https://go-review.googlesource.com/c/go/+/457695
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Heschi Kreinick <heschi@google.com>
Run-TryBot: Heschi Kreinick <heschi@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

17 months agocmd/compile: desugar OCALLMETH->OCALLFUNC within devirtualization
Matthew Dempsky [Wed, 14 Dec 2022 19:48:02 +0000 (11:48 -0800)]
cmd/compile: desugar OCALLMETH->OCALLFUNC within devirtualization

Devirtualization can turn OCALLINTER into OCALLMETH, but then we want
to actually desugar into OCALLFUNC instead for later phases. Just
needs a missing call to typecheck.FixMethodCall.

Fixes #57309.

Change-Id: I331fbd40804e1a370134ef17fa6dd501c0920ed3
Reviewed-on: https://go-review.googlesource.com/c/go/+/457715
Auto-Submit: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

17 months agospec: document illegal recursive type parameter lists
Robert Griesemer [Wed, 14 Dec 2022 01:41:19 +0000 (17:41 -0800)]
spec: document illegal recursive type parameter lists

Fixes #40882.

Change-Id: I90f99d75e6d66f857b6ab8789c6d436f85d20993
Reviewed-on: https://go-review.googlesource.com/c/go/+/457515
TryBot-Bypass: Robert Griesemer <gri@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
17 months agospec: describe new semantics for comparable and constraint satisfaction
Robert Griesemer [Tue, 13 Dec 2022 21:59:12 +0000 (13:59 -0800)]
spec: describe new semantics for comparable and constraint satisfaction

For #56548.
Fixes #57012.

Change-Id: I44f850522e52b1811025fb31bcef289da8f8089d
Reviewed-on: https://go-review.googlesource.com/c/go/+/457437
TryBot-Bypass: Robert Griesemer <gri@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
17 months agospec: introduce notion of strict comparability
Robert Griesemer [Tue, 13 Dec 2022 00:30:42 +0000 (16:30 -0800)]
spec: introduce notion of strict comparability

- Rephrase the notion of "comparability" from a property
  of values (operands) to a property of types and adjust
  dependent prose.
- Introduce the notion of "strict comparability".
- Fix the definitions of comparability for type interfaces
  and type parameters.
- Define the predeclared identifier "comparable" as stricly
  comparable.

These changes address existing problems in the spec as outlined
in the section on "Related spec issues" in issue #56548.

For #56548.

Change-Id: Ibc8c2f36d92857a5134eadc18358624803d3dd21
Reviewed-on: https://go-review.googlesource.com/c/go/+/457095
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Bypass: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
17 months agosyscall: fix closing of reordered FDs in plan9 ForkExec
miller [Tue, 13 Dec 2022 10:43:23 +0000 (10:43 +0000)]
syscall: fix closing of reordered FDs in plan9 ForkExec

After dup'ing file descriptors in syscall.ProcAttr.Files to pass
to the exec'ed process, the logic for closing the old descriptors
was incorrect and could close the new descriptor instead.

Fixes #57180

Change-Id: I7725f21a465ffba57050fe4e36f3d36ba181cfb2
Reviewed-on: https://go-review.googlesource.com/c/go/+/457115
Run-TryBot: David du Colombier <0intro@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Bryan Mills <bcmills@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: David du Colombier <0intro@gmail.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
17 months agogo/types, types2: report type mismatch error when conversion is impossible
Robert Griesemer [Mon, 12 Dec 2022 21:36:44 +0000 (13:36 -0800)]
go/types, types2: report type mismatch error when conversion is impossible

Rather than reporting an impossible conversion error when mixing an
untyped value with a pointer type in an operation, report a type
mismatch error. This fixes a regression in error quality compared
to pre-1.18.

For the fix, clean up the implementation of canMix, add documentation,
and give it a better name.

Adjust test case for corresponding error code bacause we now get a
better error message (and error code) for the old error code example.

Fixes #57160.

Change-Id: Ib96ce7cbc44db6905fa2f1c90a3769af609e101b
Reviewed-on: https://go-review.googlesource.com/c/go/+/457055
Reviewed-by: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@google.com>
17 months agocmd/gc: test temp string comparison with all ops
Oleg Zaytsev [Fri, 9 Dec 2022 12:05:34 +0000 (13:05 +0100)]
cmd/gc: test temp string comparison with all ops

The comment on `slicebytetostringtmp` mention that `==` operator does
not allocate []byte to string conversion, but the test was testing only
`==` and `!=` and the compiler actually optimizes all comparison
operators.

Also added a test for concatenation comparison, which also should not
allocate.

Change-Id: I6f4c5c4f238808138fa901732e1fd5b6ab25f725
Reviewed-on: https://go-review.googlesource.com/c/go/+/456415
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
17 months agosyscall: skip TestUseCgroupFD if cgroupfs mounted RO
Paul E. Murphy [Mon, 12 Dec 2022 15:31:59 +0000 (09:31 -0600)]
syscall: skip TestUseCgroupFD if cgroupfs mounted RO

The skipping logic should also trigger if /sys/fs/cgroup is
mounted read-only too. This is how it is mounted on the
ppc64le/p10 containers today.

Fixes #57262

Change-Id: Idc0ab050052ebf5777ac09f9519215b437b0ee7c
Reviewed-on: https://go-review.googlesource.com/c/go/+/456835
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
Run-TryBot: Paul Murphy <murp@ibm.com>

17 months agosyscall: fix shadowing bugs in forkAndExecInChild
Bryan C. Mills [Fri, 9 Dec 2022 17:25:22 +0000 (12:25 -0500)]
syscall: fix shadowing bugs in forkAndExecInChild

Fixes #57208.
Updates #23152.

Change-Id: Icc9a74aeb26f1b6f151162c5d6bf1b4d7cd54d0a
Reviewed-on: https://go-review.googlesource.com/c/go/+/456515
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Russ Cox <rsc@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>

17 months agosync: remove unused const
Changkun Ou [Fri, 9 Dec 2022 17:19:52 +0000 (18:19 +0100)]
sync: remove unused const

Change-Id: I4382b5317cf7f39a48005516ff6d437883c6fd07
Reviewed-on: https://go-review.googlesource.com/c/go/+/456495
Reviewed-by: Dominik Honnef <dominik@honnef.co>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Changkun Ou <mail@changkun.de>

17 months agodoc/go1.20: fix typo
Alexander Frolov [Fri, 9 Dec 2022 07:56:21 +0000 (07:56 +0000)]
doc/go1.20: fix typo

Change-Id: Id0319a9cc9acc549022fdcd6b7d71c7343afd245
GitHub-Last-Rev: 2b84d25763c3f8a03663d4ba75cefa4a372fefbd
GitHub-Pull-Request: golang/go#57187
Reviewed-on: https://go-review.googlesource.com/c/go/+/456395
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
17 months agodebug/buildinfo: check pointer size on buildinfo.Read
Nikola Jokic [Fri, 2 Dec 2022 16:42:48 +0000 (17:42 +0100)]
debug/buildinfo: check pointer size on buildinfo.Read

Previous implementation has a check on pointer size but only if ptrSize
is 4. but it does not check on ptrSize 8 causing the panic on read for
some inputs.

The explicit check for pointer size 8 is added and error is returned if
ptrSize is not 4 and not 8.

Fixes #57002

Change-Id: Id51de72bdef4da9955d086bfc2a5d735678ee2ac
Reviewed-on: https://go-review.googlesource.com/c/go/+/454616
Auto-Submit: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
17 months agodoc/go1.20: fix URL anchor
Shengyu Zhang [Thu, 8 Dec 2022 18:39:06 +0000 (18:39 +0000)]
doc/go1.20: fix URL anchor

The URL anchor was invalid. Add the missing "array_or_" part.

Change-Id: Ib27f4d0f21b0148bea8b63ef962ba0ea30166ed3
GitHub-Last-Rev: f8addc607812290ebbdbb1560f336f56390d0d8d
GitHub-Pull-Request: golang/go#57154
Reviewed-on: https://go-review.googlesource.com/c/go/+/456175
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>

17 months agocmd/compile: fix conditional move rule on PPC64
Keith Randall [Sat, 10 Dec 2022 03:49:53 +0000 (19:49 -0800)]
cmd/compile: fix conditional move rule on PPC64

Similar to CL 456556 but for ppc64 instead of arm64.

Change docs about how booleans are stored in registers for ppc64.
We now don't promise to keep the upper bits zeroed; they might be junk.

To test, I changed the boolean generation instructions (MOVBZload* and ISEL*
with boolean type) to OR in 0x100 to the result. all.bash still passed,
so I think nothing else is depending on the upper bits of booleans.

Update #57184

Change-Id: Ie66f8934a0dafa34d0a8c2a37324868d959a852c
Reviewed-on: https://go-review.googlesource.com/c/go/+/456437
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Keith Randall <khr@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: KAMPANAT THUMWONG (KONG PC) <1992kongpc.kth@gmail.com>
Run-TryBot: Archana Ravindar <aravind5@in.ibm.com>

17 months agoos: skip size test in TestLstat if the file is a symlink
Ian Lance Taylor [Fri, 9 Dec 2022 19:22:32 +0000 (11:22 -0800)]
os: skip size test in TestLstat if the file is a symlink

Tested by temporarily changing sysdir to use a directory where
the expected files were all symlinks. We should consider using
a different approach that doesn't rely on sysdir, but for now
do a minimal fix.

Fixes #57210

Change-Id: Ifb1becef03e014ceb48290ce13527b3e103c0e07
Reviewed-on: https://go-review.googlesource.com/c/go/+/456557
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>

17 months agocmd/compile: fix conditional select rule
Keith Randall [Fri, 9 Dec 2022 18:55:28 +0000 (10:55 -0800)]
cmd/compile: fix conditional select rule

ARM64 maintains booleans in the low byte of registers. Upper parts
of that register are junk.
This rule is using all 32 bits of a boolean-containing register, which
is wrong. Change the rule to only look at the low bit.

Fixes #57184

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

17 months agodoc: fix typo in 1.20 release notes
Than McIntosh [Thu, 8 Dec 2022 19:31:38 +0000 (14:31 -0500)]
doc: fix typo in 1.20 release notes

Fix typo.

Change-Id: Id3a78ac5d8ea429ba1685889cd1661aaca8572c5
Reviewed-on: https://go-review.googlesource.com/c/go/+/456238
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
17 months agoos/user: zero-initialize C structs returned to Go
Bryan C. Mills [Thu, 8 Dec 2022 15:47:03 +0000 (10:47 -0500)]
os/user: zero-initialize C structs returned to Go

In the wrappers for getgrnam_r and similar, the structs to be returned
are allocated on the C stack and may be uninitialized. If the call to
the wrapped C function returns an error (such as ERANGE), it may leave
the struct uninitialized, expecting that the caller will not read it.

However, when that struct is returned to Go, it may be read by the Go
garbage collector. If the uninitialized struct fields happen to
contain wild pointers, the Go garbage collector will throw an error.
(Prior to CL 449335, the Go runtime would not scan the struct fields
because they did not reside in Go memory.)

Fix this by always zeroing the struct before the C call.

Fixes #57170.

Change-Id: I241ae8e4added6f9a406dac37a7f6452341aa0cf
Reviewed-on: https://go-review.googlesource.com/c/go/+/456121
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>

17 months agogo/types, types2: always rename type parameters during inference
Robert Findley [Thu, 8 Dec 2022 15:03:03 +0000 (10:03 -0500)]
go/types, types2: always rename type parameters during inference

Type inference uses a trick of "renaming" type parameters in the type
parameter list to avoid cycles during unification. This separates the
identity of type parameters from type arguments. When this trick was
introduced in CL 385494, we restricted its application to scenarios
where inference is truly self-recursive: the type parameter list being
inferred was the same as the type parameter list of the outer function
declaration. Unfortunately, the heuristic used to determine
self-recursiveness was flawed: type-checking function literals clobbers
the type-checker environment, losing information about the outer
signature.

We could fix this by introducing yet more state into the type-checker
(e.g. a 'declSig' field that would hold the signature of the active
function declaration), but it is simpler to just avoid this optimization
and always perform type parameter renaming. We can always optimize
later.

This CL removes the check for true self-recursion, always performing the
renaming.

Fixes golang/go#57155

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