]> Cypherpunks.ru repositories - gostls13.git/log
gostls13.git
18 months agolib/time: update to 2022g/2022g
Russ Cox [Tue, 6 Dec 2022 04:07:54 +0000 (23:07 -0500)]
lib/time: update to 2022g/2022g

Commit generated by update.bash.

For #22487.

Change-Id: I6a995a3baea7c511b9bd5155f81d8b8e2cdff09d
Reviewed-on: https://go-review.googlesource.com/c/go/+/455356
Reviewed-by: Heschi Kreinick <heschi@google.com>
Run-TryBot: Russ Cox <rsc@golang.org>
Auto-Submit: Russ Cox <rsc@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>

18 months agoos, net/http: avoid escapes from os.DirFS and http.Dir on Windows
Damien Neil [Thu, 10 Nov 2022 20:16:27 +0000 (12:16 -0800)]
os, net/http: avoid escapes from os.DirFS and http.Dir on Windows

Do not permit access to Windows reserved device names (NUL, COM1, etc.)
via os.DirFS and http.Dir filesystems.

Avoid escapes from os.DirFS(`\`) on Windows. DirFS would join the
the root to the relative path with a path separator, making
os.DirFS(`\`).Open(`/foo/bar`) open the path `\\foo\bar`, which is
a UNC name. Not only does this not open the intended file, but permits
reference to any file on the system rather than only files on the
current drive.

Make os.DirFS("") invalid, with all file access failing. Previously,
a root of "" was interpreted as "/", which is surprising and probably
unintentional.

Fixes CVE-2022-41720
Fixes #56694

Change-Id: I275b5fa391e6ad7404309ea98ccc97405942e0f0
Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/1663834
Reviewed-by: Tatiana Bradley <tatianabradley@google.com>
Reviewed-by: Julie Qiu <julieqiu@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/455362
Reviewed-by: Michael Pratt <mpratt@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Jenny Rakoczy <jenny@golang.org>
Reviewed-on: https://go-review.googlesource.com/c/go/+/455716
Reviewed-by: Jenny Rakoczy <jenny@golang.org>
Run-TryBot: Damien Neil <dneil@google.com>

18 months agoRevert "runtime/pprof: unskip TestTimeVDSO on Android"
Cherry Mui [Tue, 6 Dec 2022 21:47:29 +0000 (21:47 +0000)]
Revert "runtime/pprof: unskip TestTimeVDSO on Android"

This reverts CL 455358, commit 98da0fb43fb481a25b3b4399cd9f517fe94d9f3f.

Reason for revert: still failing https://build.golang.org/log/c9f13a76069f523b5b4a37a75ec52b30a1f3427a

Change-Id: I8246d233c4fb86781b882f19dea82065cc21bc26
Reviewed-on: https://go-review.googlesource.com/c/go/+/455696
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
18 months agocmd/go: unskip TestScript/build_issue48319 on Windows
Bryan C. Mills [Fri, 2 Dec 2022 21:41:23 +0000 (16:41 -0500)]
cmd/go: unskip TestScript/build_issue48319 on Windows

Now that we have newer C compilers on the Windows builders, they
should fully support reproducible builds.

Updates #35006.

Change-Id: I0a8995fe327067c9e73e5578c385ea01ae5dee5d
Reviewed-on: https://go-review.googlesource.com/c/go/+/454504
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Bryan Mills <bcmills@google.com>

18 months agoarchive/zip: only consider UncompressedSize when checking dirs
Roland Shoemaker [Tue, 6 Dec 2022 19:58:10 +0000 (11:58 -0800)]
archive/zip: only consider UncompressedSize when checking dirs

CL 454475 switched from checking CompressedSize to UncompressedSize
when determining if we should consider an archive malformed because
it contains data and added a test for an example of this (a JAR). We
should also remove the hasDataDescriptor check, since that is basically
an alias for CompressedSize > 0. The test didn't catch this because we
didn't actually attempt to read from the returned reader.

Change-Id: Ibc4c1aa9c3a733f3ebf4a956d1e2f8f4900a29cd
Reviewed-on: https://go-review.googlesource.com/c/go/+/455523
Run-TryBot: Roland Shoemaker <roland@golang.org>
Reviewed-by: Julie Qiu <julieqiu@google.com>
Auto-Submit: Roland Shoemaker <roland@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>

18 months agorun.bash, cmd/dist: document GO_TEST_SHORT and GO_TEST_TIMEOUT_SCALE
Dmitri Shuralyov [Fri, 2 Dec 2022 18:30:06 +0000 (13:30 -0500)]
run.bash, cmd/dist: document GO_TEST_SHORT and GO_TEST_TIMEOUT_SCALE

These environment variables affect cmd/dist, and in turn run.bash.
They exist primarily for the Go build system, but are still needed
sometimes when investigating problems. Document them in one place.

Fixes #46054.

Change-Id: I5dea2ac79b0d203d2f3c9ec2980382f62bead5cd
Reviewed-on: https://go-review.googlesource.com/c/go/+/455517
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>

18 months agogo/types, types2: better error message for invalid method expression
Robert Griesemer [Tue, 6 Dec 2022 00:17:56 +0000 (16:17 -0800)]
go/types, types2: better error message for invalid method expression

Fixes #53358.

Change-Id: I38528da1596b6e1aaedcab89b1513fb8acac596c
Reviewed-on: https://go-review.googlesource.com/c/go/+/455335
Reviewed-by: Robert Findley <rfindley@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@google.com>
18 months agoruntime/pprof: unskip TestTimeVDSO on Android
Cherry Mui [Tue, 6 Dec 2022 17:11:57 +0000 (12:11 -0500)]
runtime/pprof: unskip TestTimeVDSO on Android

It is possible that CL 455166 fixes this. Try unskipping the test
and see. If it fails again we can skip it again.

Fixes #48655.

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

18 months agocmd/link: pass -Wl,--no-insert-timestamp to external linker on windows
Than McIntosh [Tue, 6 Dec 2022 15:22:09 +0000 (10:22 -0500)]
cmd/link: pass -Wl,--no-insert-timestamp to external linker on windows

Pass -Wl,--no-insert-timestamp to the external linker on windows, so
as to suppress generation of the PE file header data/time stamp. This
is in order to make it possible to get reproducible CGO builds on
windows (note that we already zero the timestamp field in question for
internal linkage).

Updates #35006.

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

18 months agocmd/compile: turn off jump tables when spectre retpolines are on
Keith Randall [Tue, 6 Dec 2022 00:26:26 +0000 (16:26 -0800)]
cmd/compile: turn off jump tables when spectre retpolines are on

Fixes #57097

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

18 months agocmd/asm: improve assembler error messages
Keith Randall [Mon, 5 Dec 2022 19:19:51 +0000 (11:19 -0800)]
cmd/asm: improve assembler error messages

Provide file/line numbers for errors when we have them.
Make the assembler error text closer to the equivalent errors from the compiler.

Abort further processing when we come across errors.
Fixes #53994

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

18 months agogo/types, types2: better error message for failing constraint type inference
Robert Griesemer [Mon, 5 Dec 2022 22:09:09 +0000 (14:09 -0800)]
go/types, types2: better error message for failing constraint type inference

We know the type argument against which constraint type inference fails:
print the type argument instead of the corresponding type parameter.

Fixes #57096.

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

18 months agocmd/compile: clean up amd64 opcode comments
Keith Randall [Sun, 11 Sep 2022 21:26:10 +0000 (14:26 -0700)]
cmd/compile: clean up amd64 opcode comments

Put comments about what operations do per block of related opcodes
instead of on each line. This is less repetitive and lets us be a bit
more verbose in our descriptions.

Doesn't change the generated code at all.

Change-Id: I98fbd4029df6537b10aac2113a00df121d0fca1b
Reviewed-on: https://go-review.googlesource.com/c/go/+/433736
Auto-Submit: Keith Randall <khr@google.com>
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Keith Randall <khr@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
18 months agoruntime: prioritize VDSO and libcall unwinding in profiler
Cherry Mui [Mon, 5 Dec 2022 18:02:22 +0000 (13:02 -0500)]
runtime: prioritize VDSO and libcall unwinding in profiler

In the profiler, when unwinding the stack, we have special
handling for VDSO calls. Currently, the special handling is only
used when the normal unwinding fails. If the signal lands in the
function that makes the VDSO call (e.g. nanotime1) and after the
stack switch, the normal unwinding doesn't fail but gets a stack
trace with exactly one frame (the nanotime1 frame). The stack
trace stops because of the stack switch. This 1-frame stack trace
is not as helpful. Instead, if vdsoSP is set, we know we are in
VDSO call or right before or after it, so use vdsoPC and vdsoSP
for unwinding. Do the same for libcall.

Also remove _TraceTrap for VDSO unwinding, as vdsoPC and vdsoSP
correspond to a call, not an interrupted instruction.

Fixes #56574.

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

18 months agonet: support context cancellation in resSearch
Mateusz Poliwczak [Sat, 3 Dec 2022 08:14:33 +0000 (08:14 +0000)]
net: support context cancellation in resSearch

As with all the stuff that call cgo from net package.

Change-Id: I7c42ae44a1d47f4f949b203682217498fcdba92a
GitHub-Last-Rev: 70406493bbbe10bf556a17e453623d3decf00822
GitHub-Pull-Request: golang/go#57043
Reviewed-on: https://go-review.googlesource.com/c/go/+/454697
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
18 months agodoc: 1.20 compiler changes
David Chase [Thu, 1 Dec 2022 18:39:23 +0000 (13:39 -0500)]
doc: 1.20 compiler changes

This adds the nonPGO, non-coverage compiler changes
for the 1.20 release.  There's not that much user
visible change.

For #54202.

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

18 months agoruntime/cgo: fix typo in gcc_loong64.S
Cherry Mui [Mon, 5 Dec 2022 18:02:22 +0000 (13:02 -0500)]
runtime/cgo: fix typo in gcc_loong64.S

Fix typo in CL 454838.

Change-Id: I0e91d22cf09949f0bf924ebcf09f1ddac525bac4
Reviewed-on: https://go-review.googlesource.com/c/go/+/455161
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
18 months agoruntime/cgo: add .file directive to GNU assembly files
Cherry Mui [Fri, 2 Dec 2022 18:34:03 +0000 (13:34 -0500)]
runtime/cgo: add .file directive to GNU assembly files

Without it, at least on ARM64 with older BFD linker, it will
include the file of the object file (which is of a temporary path)
as a debug symbol into the binary, causing the build to be
nondeterministic. Adding a .file directive makes it to create a
STT_FILE symbol with deterministic input, and prevent the linker
creating one using the temporary object file path.

Fixes #57035.

Change-Id: I3ab716b240f60f7a891af2f7e10b467df67d1f31
Reviewed-on: https://go-review.googlesource.com/c/go/+/454838
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Cherry Mui <cherryyz@google.com>

18 months agoall: fix some comments for method
cui fliter [Mon, 14 Nov 2022 12:13:10 +0000 (20:13 +0800)]
all: fix some comments for method

Change-Id: I4cff6b2a1fed6acdf754539c3c53a61eaa3b3f84
Reviewed-on: https://go-review.googlesource.com/c/go/+/450176
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Martin Möhrmann <moehrmann@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
18 months agoruntime/debug: add missing period
Russ Cox [Tue, 29 Nov 2022 20:13:52 +0000 (15:13 -0500)]
runtime/debug: add missing period

Pointed out in review of CL 453602,
but it looks like I forgot to re-upload before submitting.

Change-Id: I8f4fac52ea0f904f6f9b06e13fc8ed2e778f2360
Reviewed-on: https://go-review.googlesource.com/c/go/+/454835
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
Auto-Submit: Russ Cox <rsc@golang.org>
Reviewed-by: Julie Qiu <julieqiu@google.com>
18 months agodoc/go1.20: preannounce dropping macOS 10.13 and 10.14 support
Heschi Kreinick [Fri, 2 Dec 2022 22:06:15 +0000 (17:06 -0500)]
doc/go1.20: preannounce dropping macOS 10.13 and 10.14 support

For #23011.

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

18 months agocmd/go: remove TestScript/version_buildvcs_git_gpg
Bryan C. Mills [Fri, 2 Dec 2022 19:11:00 +0000 (14:11 -0500)]
cmd/go: remove TestScript/version_buildvcs_git_gpg

This was a regression test added for a 'git' command line
used for build stamping. Unfortunately, 'gpg' has proved to
be extremely fragile:

* In recent versions, it appears to always require 'gpg-agent' to be
  installed for anything involving secret keys, but for some reason is
  not normally marked as requiring gpg-agent in Debian's package
  manager.

* It tries to create a Unix domain socket in a subdirectory of $TMPDIR
  without checking the path length, which fails when $TMPDIR is too
  long to fit in the 'sun_path' field of a sockaddr_un struct (which
  typically tops out somewhere between 92 and 108 bytes).

We could theoretically address those by artificially reducing the
script's TMPDIR length and checking for gpg-agent in addition to gpg,
but arguably those should both be fixed upstream instead. On balance,
the incremental value that this test provides does not seem worth the
complexity of dealing with such a fragile third-party tool.

Updates #50675.
Updates #48802.
Fixes #57034.

Change-Id: Ia3288c2f84f8db86ddfa139b4d1c0112d67079ef
Reviewed-on: https://go-review.googlesource.com/c/go/+/454502
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Bryan Mills <bcmills@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
18 months agocmd/go: skip TestScript/mod_replace_gopkgin
Bryan C. Mills [Fri, 2 Dec 2022 19:52:34 +0000 (14:52 -0500)]
cmd/go: skip TestScript/mod_replace_gopkgin

(Until it can be made hermetic.)

The gopkg.in service has had a lot of flakiness lately. Go users in
general are isolated from that flakiness by the Go module mirror
(proxy.golang.org), but this test intentionally bypasses the module
mirror because the mirror itself uses cmd/go to download the module.

In the long term, we can redirect the gopkg.in URL to the local
(in-process) vcweb server added for #27494.

In the meantime, let's skip the test to reduce the impact of upstream
outages.

For #54503.

Change-Id: Icf3de7ca416db548e53864a71776fe22b444fcea
Reviewed-on: https://go-review.googlesource.com/c/go/+/454503
Run-TryBot: Bryan Mills <bcmills@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
18 months agopath/filepath: make Join("c:", "/a") return "c:/a" again
Damien Neil [Wed, 30 Nov 2022 01:07:02 +0000 (20:07 -0500)]
path/filepath: make Join("c:", "/a") return "c:/a" again

Historically, on Windows filepath.Join("c:", elt) does not insert
a path separator between "c:" and elt, but preserves leading slashes
in elt. Restore this behavior, which was inadvertently changed by
CL 444280.

Fixes #56988

Change-Id: Id728bf311f4093264f8c067d8b801ea9ebef5b5f
Reviewed-on: https://go-review.googlesource.com/c/go/+/453497
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Bryan Mills <bcmills@google.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Run-TryBot: Damien Neil <dneil@google.com>

18 months agogo/internal/gcimporter: in short tests, avoid creating export data for all of std
Bryan C. Mills [Thu, 1 Dec 2022 20:37:50 +0000 (15:37 -0500)]
go/internal/gcimporter: in short tests, avoid creating export data for all of std

gcimporter.TestImportTypeparamTests still needs to create full export
data because it loads lots of source files from GOROOT/test that
expect to be able to import arbitrary subsets of the standard library,
so we now skip it in short mode.

On a clean build cache, this reduces
'go test -short cmd/compile/internal/importer go/internal/gcimporter'
on my machine from 21–28s per test to <6s per test.

Updates #56967.
Updates #47257.

Change-Id: I8fd80293ab135e0d2d213529b74e0ca6429cdfc7
Reviewed-on: https://go-review.googlesource.com/c/go/+/454498
Run-TryBot: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Bryan Mills <bcmills@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
18 months agodoc/go1.20: resolve root bundle package TODO
Roland Shoemaker [Tue, 29 Nov 2022 21:19:27 +0000 (13:19 -0800)]
doc/go1.20: resolve root bundle package TODO

We're unlikely to get this package out of the door all that soon. For
now add a note that SetFallbackRoots will be most commonly used with
an TBA package, and link the tracking issue.

We could also just remove the "It will most commonly be used ..."
sentence.

Change-Id: Ie96134d757f5b4c69f1878d53c92b5ed602671e4
Reviewed-on: https://go-review.googlesource.com/c/go/+/454056
Reviewed-by: Julie Qiu <julieqiu@google.com>
Run-TryBot: Roland Shoemaker <roland@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Roland Shoemaker <roland@golang.org>

18 months agomath/big: fix BitLen performance regression
Filippo Valsorda [Fri, 2 Dec 2022 16:58:00 +0000 (17:58 +0100)]
math/big: fix BitLen performance regression

CL 450055 replaced BitLen with a slower constant-time implementation,
which caused a performance regression in some ecosystem benchmarks.

https://perf.golang.org/search?q=upload%3A20221130.13+pkg%3Agithub.com%2Fericlagergren%2Fdecimal%2Fbenchmarks

Current tip vs this CL

name                                   old time/op  new time/op  delta
Pi/foo=ericlagergren_(Go)/prec=100-4    151µs ± 0%   129µs ± 0%  -14.89%  (p=0.000 n=10+9)
Pi/foo=ericlagergren_(GDA)/prec=100-4   305µs ± 0%   269µs ± 1%  -11.88%  (p=0.000 n=9+10)
Pi/foo=cockroachdb/apd/prec=100-4      5.74ms ± 0%  5.33ms ± 0%   -7.02%  (p=0.000 n=9+10)
Pi/foo=shopspring/prec=100-4            265µs ±16%   268µs ±11%     ~     (p=0.796 n=10+10)
Pi/foo=apmckinlay/prec=100-4           3.10µs ± 0%  3.08µs ± 0%   -0.60%  (p=0.000 n=8+10)
Pi/foo=go-inf/prec=100-4                132µs ± 9%   137µs ± 9%     ~     (p=0.182 n=10+9)
Pi/foo=float64/prec=100-4              4.97µs ± 0%  4.98µs ± 0%     ~     (p=0.196 n=10+10)

CL 450055's parent vs this CL

name                                   old time/op  new time/op  delta
Pi/foo=ericlagergren_(Go)/prec=100-4    129µs ± 1%   129µs ± 0%    ~     (p=0.182 n=10+9)
Pi/foo=ericlagergren_(GDA)/prec=100-4   267µs ± 1%   269µs ± 1%  +0.93%  (p=0.001 n=9+10)
Pi/foo=shopspring/prec=100-4            252µs ± 9%   268µs ±11%    ~     (p=0.052 n=10+10)
Pi/foo=apmckinlay/prec=100-4           3.10µs ± 1%  3.08µs ± 0%  -0.66%  (p=0.000 n=9+10)
Pi/foo=go-inf/prec=100-4                135µs ± 6%   137µs ± 9%    ~     (p=0.605 n=9+9)
Pi/foo=float64/prec=100-4              4.97µs ± 0%  4.98µs ± 0%  +0.23%  (p=0.005 n=8+10)

goos: linux
goarch: amd64
pkg: github.com/ericlagergren/decimal_benchmarks
cpu: Intel(R) Core(TM) i5-7400 CPU @ 3.00GHz

Fixes #57014

Change-Id: I08478bea122212320a592ad2652e33077807de09
Reviewed-on: https://go-review.googlesource.com/c/go/+/454617
Reviewed-by: Roland Shoemaker <roland@golang.org>
Run-TryBot: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>

18 months agocmd/api: track darwin arm64 port
Russ Cox [Wed, 23 Nov 2022 21:30:11 +0000 (16:30 -0500)]
cmd/api: track darwin arm64 port

The darwin arm64 port was added in Go 1.16 and is a first-class port,
so it should be tracked by cmd/api. This CL does that, backfilling
API files as needed.

It also removes a spurious cgo.Incomplete API feature.

Change-Id: Idd995677915e81bf1c2e09be65b31e084b75f668
Reviewed-on: https://go-review.googlesource.com/c/go/+/453260
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>

18 months agoencoding/csv: use proper doc comment for Deprecated notes
Russ Cox [Mon, 28 Nov 2022 16:02:52 +0000 (11:02 -0500)]
encoding/csv: use proper doc comment for Deprecated notes

End-of-line comments are not doc comments,
so Deprecated notes in them are not recognized
as deprecation notices. Rewrite the comments.

Change-Id: I275fa9aec403132fda45853e52daa22bc06fcd36
Reviewed-on: https://go-review.googlesource.com/c/go/+/453617
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Joseph Tsai <joetsai@digital-static.net>
Reviewed-by: Ian Lance Taylor <iant@google.com>
18 months agoarchive/zip: use proper doc comment for Deprecated notes
Russ Cox [Mon, 28 Nov 2022 16:02:23 +0000 (11:02 -0500)]
archive/zip: use proper doc comment for Deprecated notes

End-of-line comments are not doc comments,
so Deprecated notes in them are not recognized
as deprecation notices. Rewrite the comments.

Change-Id: Idc4681924f9a7e9ead62f672ef8a763e70db1f0f
Reviewed-on: https://go-review.googlesource.com/c/go/+/453616
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Joseph Tsai <joetsai@digital-static.net>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Russ Cox <rsc@golang.org>
Auto-Submit: Russ Cox <rsc@golang.org>

18 months agoarchive/tar: use proper doc comment for Deprecated notes
Russ Cox [Mon, 28 Nov 2022 16:01:36 +0000 (11:01 -0500)]
archive/tar: use proper doc comment for Deprecated notes

End-of-line comments are not doc comments,
so Deprecated notes in them are not recognized
as deprecation notices. Rewrite the comments.

Change-Id: Idb19603d7fc2ec8e3a2f74bacb74fbbec5583d20
Reviewed-on: https://go-review.googlesource.com/c/go/+/453615
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Joseph Tsai <joetsai@digital-static.net>
Reviewed-by: Ian Lance Taylor <iant@google.com>
18 months agocmd/api: track deprecations
Russ Cox [Wed, 23 Nov 2022 18:45:56 +0000 (13:45 -0500)]
cmd/api: track deprecations

Deprecating an API creates notices that go out to potentially
millions of Go developers encouraging them to update their code.
The choice to deprecate an API is as important as the choice to
add a new API. We should track those and make them explicit.
This will also ensure that deprecations go through proposal review.

Change-Id: Ide9f60c32e5a88fb133e0dfedd984b8b0f70f510
Reviewed-on: https://go-review.googlesource.com/c/go/+/453259
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
Auto-Submit: Russ Cox <rsc@golang.org>
Reviewed-by: David Chase <drchase@google.com>
18 months agoruntime/debug: more complete BuildInfo documentation
Russ Cox [Tue, 29 Nov 2022 20:13:52 +0000 (15:13 -0500)]
runtime/debug: more complete BuildInfo documentation

A potential user did not realize Deps included all transitive dependencies,
not just direct dependencies of the main module. Clarify that and add
various other useful information.

Change-Id: I5b8e1314bb26092edbcc090ba8eb9859f0a70662
Reviewed-on: https://go-review.googlesource.com/c/go/+/453602
Run-TryBot: Russ Cox <rsc@golang.org>
Auto-Submit: Russ Cox <rsc@golang.org>
Reviewed-by: Julie Qiu <julieqiu@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
18 months agogo/internal/gcimporter: load cached export data for packages individually
Bryan C. Mills [Thu, 1 Dec 2022 18:39:39 +0000 (13:39 -0500)]
go/internal/gcimporter: load cached export data for packages individually

Previously, we were using internal/goroot.PkgfileMap to locate
cached export data. However, PkgfileMap regenerates export data
for the entire standard library, whereas gcimporter may only need
a single package.

Under the new approach, we load the export data (still using
'go list -export') for each GOROOT package individually, avoiding work
to rebuild export data for packages that are not needed.
This is a tradeoff: if most packages in GOROOT are actually needed, we
end up making many more calls to 'go list', and may build packages
sequentially instead of in parallel (but with lower latency to start
using the export data from the earlier packages).

On my workstation, starting from a clean cache for each run,
this reduces the wall time of
'go test go/internal/gcimporter -run=TestImportedTypes'
from 22s real time (2m10s user time) to 6s real (27s user),
and only increases 'go test go/internal/gcimporter' from
28s real (2m16s user) to 30s real (2m19s user).

Updates #56967.
Updates #47257.

Change-Id: I22556acdd9b1acc56533ed4c2728ea29b585c073
Reviewed-on: https://go-review.googlesource.com/c/go/+/454497
Reviewed-by: Michael Matloob <matloob@golang.org>
Auto-Submit: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Bryan Mills <bcmills@google.com>

18 months agocmd/dist: remove pkg/$GOOS_$GOARCH and pkg/obj at exit
Michael Matloob [Tue, 29 Nov 2022 23:32:32 +0000 (18:32 -0500)]
cmd/dist: remove pkg/$GOOS_$GOARCH and pkg/obj at exit

pkg/obj will be empty, so just remove it.
pkg/$GOOS_$GOARCH will be empty unless the user has specified
GODEBUG=installgoroot=all, so check if it's empty, and if so, delete
it.

Also remove xreaddirfiles, which is unused.

Also remove the copy of pkg/$GOOS_$GOARCH in the cmd/go test
TestNewReleaseRebuildsStalePackagesInGOPATH. The directory is empty so
copying it has no effect.

For #47257

Change-Id: Ief90b882d157bd16078cd5d2b83a915bfc831f9a
Reviewed-on: https://go-review.googlesource.com/c/go/+/453496
Run-TryBot: Michael Matloob <matloob@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
18 months agodoc/go1.20: add code tags in crypto/{rsa,subtle} and net/netip sections
Tobias Klauser [Wed, 30 Nov 2022 10:03:47 +0000 (11:03 +0100)]
doc/go1.20: add code tags in crypto/{rsa,subtle} and net/netip sections

Change-Id: I516195fb1c2434feb3bf130d37012a98d77beeb6
Reviewed-on: https://go-review.googlesource.com/c/go/+/454235
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Russ Cox <rsc@golang.org>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

18 months agonet: acquire thread in resSearch
Mateusz Poliwczak [Thu, 1 Dec 2022 09:26:18 +0000 (09:26 +0000)]
net: acquire thread in resSearch

Change-Id: I042906d8eee8defafbd98f671fd30c2a68281705
GitHub-Last-Rev: 0660c9a989600eeb8652d1228777488d28397731
GitHub-Pull-Request: golang/go#57021
Reviewed-on: https://go-review.googlesource.com/c/go/+/454396
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>

18 months agonet: retry with bigger buffer in resSearch
Mateusz Poliwczak [Thu, 1 Dec 2022 17:54:49 +0000 (17:54 +0000)]
net: retry with bigger buffer in resSearch

Glibc returns size > bufSize, when the entire dns reply does not fit inside the provided buffer.

Change-Id: Ie1c1c6a3411880bd8bdb4371f1f1b7bcce837ea2
GitHub-Last-Rev: 488cd3ed0db2a86433aa921117b8f1e9192b1fa5
GitHub-Pull-Request: golang/go#57020
Reviewed-on: https://go-review.googlesource.com/c/go/+/454395
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>

18 months agocrypto/des: fix a typo in the comment for permuteFinalBlock
Chaoshuai Lü [Wed, 30 Nov 2022 12:29:46 +0000 (12:29 +0000)]
crypto/des: fix a typo in the comment for permuteFinalBlock

The comment copy pasted from the permuteInitialBlock and should be fixed.

Change-Id: I101f1deceadf9b0480e5b679e4e237bda601950b
GitHub-Last-Rev: 7662df772e4ac171c79467678861ac4d7547da78
GitHub-Pull-Request: golang/go#56982
Reviewed-on: https://go-review.googlesource.com/c/go/+/453995
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Russ Cox <rsc@golang.org>
18 months agodoc: add release note for cgo.Incomplete
Cuong Manh Le [Thu, 1 Dec 2022 16:58:44 +0000 (23:58 +0700)]
doc: add release note for cgo.Incomplete

Updates #46731

Change-Id: Ie64e87d759c48642582342d221b24f77bb81d47a
Reviewed-on: https://go-review.googlesource.com/c/go/+/453556
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
18 months agodoc/go1.20: document new semantics for comparable constraint
Robert Griesemer [Thu, 1 Dec 2022 20:36:51 +0000 (12:36 -0800)]
doc/go1.20: document new semantics for comparable constraint

For #54202.
For #56548.

Change-Id: If2b9e41813c3e1c8d373469a40e1bd0bd5ea2b16
Reviewed-on: https://go-review.googlesource.com/c/go/+/454595
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Bypass: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
18 months agogo/internal/gcimporter: fix TestImportStdLib
Michael Matloob [Wed, 30 Nov 2022 17:53:13 +0000 (12:53 -0500)]
go/internal/gcimporter: fix TestImportStdLib

The test attempted to find all stdlib packages by scanning
pkg/$GOOS_$GOARCH for .a files and then tried to import all of them.
Now that .a files are no longer being placed there, the test is a
noop. Fix this by using go list std (and filtering out testonly
packages) and trying to import all of those to recreate what the test
intended to do.

This also removes a dependency on the pkg/$GOOS_$GOARCH directory
which will stop being produced by dist in CL 453496.

For #47257

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

18 months agogo/types, types2: make the new comparable semantics the default
Robert Griesemer [Thu, 1 Dec 2022 17:39:45 +0000 (09:39 -0800)]
go/types, types2: make the new comparable semantics the default

Ordinary interface types now satisfy comparable constraints. This
is a fully backward-compatible change: it simply permits additional
code to be valid that wasn't valid before.

This change makes the new comparable semantics the default behavior,
depending on the Go -lang version.

It also renames the flag types2.Config.AltComparableSemantics to
types2.Config.OldComparableSemantics and inverts its meaning
(or types.Config.oldComparableSemantics respectively).

Add new predicate Satisfies (matching the predicate Implements but
for constraint satisfaction), per the proposal description.

Adjust some existing tests by setting -oldComparableSemantics
and add some new tests that verify version-dependent behavior.

The compiler flag -oldcomparable may be used to temporarily
switch back to the Go 1.18/1.19 behavior should this change
cause problems, or to identify that a problem is unrelated
to this change. The flag will be removed for Go 1.21.

For #52509.
For #56548.
For #57011.

Change-Id: I8b3b3d9d492fc24b0693567055f0053ccb5aeb42
Reviewed-on: https://go-review.googlesource.com/c/go/+/454575
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
18 months agocmd/go/internal/work: make formatOutput return an error that includes the import...
Bryan C. Mills [Wed, 16 Nov 2022 20:36:30 +0000 (15:36 -0500)]
cmd/go/internal/work: make formatOutput return an error that includes the import path

This refines the error output that was previously adjusted in CL 437298.

Longer term, we should consider unraveling the call chains involving
formatOutput to avoid passing so many parameters through so many
different formatting functions.

Updates #25842.

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

18 months agoruntime,hash/maphash: eliminate maphash torture test for -race
Than McIntosh [Thu, 1 Dec 2022 16:38:38 +0000 (11:38 -0500)]
runtime,hash/maphash: eliminate maphash torture test for -race

Disable the "torture" portion of the maphash tests if -race is in
effect (these tests can cause timeouts on the longtest -race builder).

Fixes #57030.

Change-Id: I23d7561dac3e81d979cad9e0efa6f5b7154aadd2
Reviewed-on: https://go-review.googlesource.com/c/go/+/454455
Run-TryBot: Than McIntosh <thanm@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
18 months agocrypto/x509: include more hints for verification failure
Roland Shoemaker [Thu, 1 Dec 2022 17:24:06 +0000 (09:24 -0800)]
crypto/x509: include more hints for verification failure

Include hint from isValid, as well as CheckSignatureFrom.

Change-Id: I408f73fc5f12572f1937da50be7fa3e1109164b0
Reviewed-on: https://go-review.googlesource.com/c/go/+/454477
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Roland Shoemaker <roland@golang.org>
Run-TryBot: Roland Shoemaker <roland@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
18 months agoRevert "go/types, types2: make the new comparable semantics the default"
Robert Griesemer [Thu, 1 Dec 2022 17:09:37 +0000 (09:09 -0800)]
Revert "go/types, types2: make the new comparable semantics the default"

The CL below was accidentally submitted, while waiting for the freeze
exception. Reverting.

This reverts commit 15e705ea963b5008112793507365e24b743606bc.

Change-Id: I4dbf92dcb01fa9245a6e6a2d1514d8aa898d0048
Reviewed-on: https://go-review.googlesource.com/c/go/+/454476
Reviewed-by: Robert Griesemer <gri@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Auto-Submit: Robert Griesemer <gri@google.com>

18 months agointernal/coverage: use io.Seek* constants
Tobias Klauser [Mon, 28 Nov 2022 13:23:07 +0000 (14:23 +0100)]
internal/coverage: use io.Seek* constants

Use the io.Seek* constants instead of their deprecated os.SEEK_*
counterparts.

Change-Id: Ie899f9cf286de7304a394d9a2a091a55937542ad
Reviewed-on: https://go-review.googlesource.com/c/go/+/453576
Reviewed-by: Than McIntosh <thanm@google.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Than McIntosh <thanm@google.com>

18 months agoarchive/zip: tolerate compressed directories with zero uncompressed size
Roland Shoemaker [Thu, 1 Dec 2022 17:02:16 +0000 (09:02 -0800)]
archive/zip: tolerate compressed directories with zero uncompressed size

In CL 449955 we made reading of directories with associated file data
an error, since it is a "must not" in the zip specification. It turns
out that a number of implementations make the mistake of not setting
the correct compression method on directories (in particular the Java
jar tool does this when storing the META-INF directory). If the
compression method used is not 0 (stored) then the compressed size of
the directory can be > 0, despite the uncompressed size still being 0.

Since this mistake is not uncommon, we are forced to tolerate it. We
still fail if the recorded uncompressed size is > 0, which should be
a significantly harder mistake to make.

Change-Id: Ia732b10787f26ab937ac9cf9869ac3042efb8118
Reviewed-on: https://go-review.googlesource.com/c/go/+/454475
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Roland Shoemaker <roland@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Roland Shoemaker <roland@golang.org>

18 months agocrypto/ecdsa: verify validity of signature parameters in Verify
Roland Shoemaker [Mon, 28 Nov 2022 16:51:32 +0000 (08:51 -0800)]
crypto/ecdsa: verify validity of signature parameters in Verify

CL 353849 removed validation of signature parameters being passed to
Verify which led to two distinct problems. If passed a R or S == 0,
encodeSignature would panic since it expects them to be non-zero.
encodeSignature would also normalize (i.e. make non-negative) parameters
by zero padding them, which would result in a signature being passed to
VerifyASN1 which did not match the input signature, resulting in success
in cases where it should've failed. This change re-adds the verification
that 0 < r,s < N before calling ecnodeSignature.

This was caught because tink runs the wycheproof ECDSA vectors against
Verify, where we only run the vectors against VerifyASN1. We should be
doing both.

Change-Id: I1dcf41626b4df2b43296e8b878dc607ff316a892
Reviewed-on: https://go-review.googlesource.com/c/go/+/453675
Auto-Submit: Roland Shoemaker <roland@golang.org>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
Run-TryBot: Roland Shoemaker <roland@golang.org>

18 months agogo/types, types2: make the new comparable semantics the default
Robert Griesemer [Wed, 30 Nov 2022 22:19:39 +0000 (14:19 -0800)]
go/types, types2: make the new comparable semantics the default

Ordinary interface types now satisfy comparable constraints.

This change makes the new comparable semantics the default behavior,
depending on the Go -lang version.

It also renames the flag types2.Config.AltComparableSemantics to
types2.Config.OldComparableSemantics and inverts its meaning
(or types.Config.oldComparableSemantics respectively).

Adjust some existing tests by setting -oldComparableSemantics
and add some new tests that verify version-dependent behavior.

The compiler flag -oldcomparable may be used to temporarily
switch back to the Go 1.18/1.19 behavior should this change
cause problems, or to identify that a problem is unrelated
to this change. The flag will be removed for Go 1.21.

For #52509.
For #56548.

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

18 months agocmd/compile: fix inline static init with derived types
Cuong Manh Le [Thu, 24 Nov 2022 05:43:22 +0000 (12:43 +0700)]
cmd/compile: fix inline static init with derived types

CL 450136 added handling for simple calls in staticinit. If there's any
derived types conversion in the body of generic function called, that
conversion will require runtime dictionary, thus the optimization could
not happen.

Fixes #56923

Change-Id: I498cee9f8ab4397812ef79a6c2ab6c55e0ee4aef
Reviewed-on: https://go-review.googlesource.com/c/go/+/453315
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Gabriel Morency (Amgc63spaming) <morencyvincent8@gmail.com>
18 months agocmd/cgo: walk {FuncType,TypeSpec}.TypeParams fields
Matthew Dempsky [Wed, 30 Nov 2022 20:31:30 +0000 (12:31 -0800)]
cmd/cgo: walk {FuncType,TypeSpec}.TypeParams fields

This CL updates the cgo tool to walk the TypeParams fields for
function types and type declarations, so that C.xxx identifiers can
appear within type parameter lists.

Fixes #52542.

Change-Id: Id02a88d529d50fe59b0a834f415c2575204ffd1f
Reviewed-on: https://go-review.googlesource.com/c/go/+/453977
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

18 months agonet: reenable SRV tests with _ldap._tcp.google.com
Damien Neil [Wed, 30 Nov 2022 18:57:33 +0000 (13:57 -0500)]
net: reenable SRV tests with _ldap._tcp.google.com

TestLookupDotsWithRemoteSource and TestLookupGoogleSRV
were disabled because they look up the no-longer-present
SRV record for _xmpp-server._tcp.google.com.

Change the tests to look for _ldap._tcp.google.com and
reenable them.

Fixes #56708.

Change-Id: I26475fa3ff6fc008048a4e5f24f0e96ee12f655c
Reviewed-on: https://go-review.googlesource.com/c/go/+/453861
Run-TryBot: Damien Neil <dneil@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

18 months agodoc/go1.20: add runtime, runtime/trace, and runtime/pprof release notes
Michael Anthony Knyszek [Tue, 29 Nov 2022 21:23:40 +0000 (21:23 +0000)]
doc/go1.20: add runtime, runtime/trace, and runtime/pprof release notes

This change adds release notes for the "Runtime" section and updated
some of the release notes for runtime/trace and runtime/pprof after I
looked at the full list of runtime-related changes.

For #54202.

Change-Id: Id1395f4e6e02d3fcc248855ca98ad0ee26cae574
Reviewed-on: https://go-review.googlesource.com/c/go/+/454075
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Austin Clements <austin@google.com>
Run-TryBot: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>

18 months agonet/http: deflake and fix TestWrappedResponseController
Damien Neil [Wed, 30 Nov 2022 18:43:45 +0000 (13:43 -0500)]
net/http: deflake and fix TestWrappedResponseController

Read the full (empty) response body before closing it,
to avoid cancelling the request while the server handler
is still running.

Wrap the ResponseWriter before calling NewResponseController:
This test is intended to verify that wrapping the controller
works properly, but neglected to actually wrap the controller.

Fixes #56961.

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

18 months agocmd/compile: disallow CMOV optimization with ptr arithmetic as an arg
Keith Randall [Tue, 29 Nov 2022 23:00:11 +0000 (15:00 -0800)]
cmd/compile: disallow CMOV optimization with ptr arithmetic as an arg

    if q != nil {
        p = &q.f
    }

Which gets rewritten to a conditional move:

    tmp := &q.f
    p = Select q!=nil, tmp, p

Unfortunately, we can't compute &q.f before we've checked if q is nil,
because if it is nil, &q.f is an invalid pointer (if f's offset is
nonzero but small).

Normally this is not a problem because the tmp variable above
immediately dies, and is thus not live across any safepoint. However,
if later there is another &q.f computation, those two computations are
CSEd, causing tmp to be used at both use points. That will extend
tmp's lifetime, possibly across a call.

Fixes #56990

Change-Id: I3ea31be93feae04fbe3304cb11323194c5df3879
Reviewed-on: https://go-review.googlesource.com/c/go/+/454155
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
18 months agospec: document conversion from slice to array
Tim King [Wed, 23 Nov 2022 18:31:03 +0000 (10:31 -0800)]
spec: document conversion from slice to array

Document that a slice can be converted to either an array or a pointer
to an array of a matching underlying array type. This was documented in
the "Conversions from slice to array or array pointer" subsection, but
not in the list of conversion rules.

Updates #46505.

Change-Id: I16a89a63ef23c33580129952415e977a8f334009
Reviewed-on: https://go-review.googlesource.com/c/go/+/452936
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@google.com>
Run-TryBot: Tim King <taking@google.com>

18 months agoreflect: correct tpoy in comment
Ian Lance Taylor [Tue, 22 Nov 2022 22:50:57 +0000 (14:50 -0800)]
reflect: correct tpoy in comment

Change-Id: I75aef6bf957939fae8b680214f5923dc2713a5cc
Reviewed-on: https://go-review.googlesource.com/c/go/+/452935
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Russ Cox <rsc@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>

18 months agoRevert "encoding/xml: disallow empty namespace when prefix is set"
Ian Lance Taylor [Tue, 29 Nov 2022 19:37:10 +0000 (19:37 +0000)]
Revert "encoding/xml: disallow empty namespace when prefix is set"

This reverts CL 105636.

Reason for revert: Fails with existing XML data.  At this stage in the release cycle we should revert, and try again next time with some way to support existing XML.

For #8068

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

18 months agodoc/go1.20: revise linker release note
Cherry Mui [Tue, 29 Nov 2022 15:48:37 +0000 (10:48 -0500)]
doc/go1.20: revise linker release note

I misunderstood CL 420774. We didn't remove GO_LDSO, just that
make.bash no longer tries to set it automatically. If GO_LDSO is
explicitly set at make.bash, it is still used as the default
dynamic interpreter.

For #54202.

Change-Id: Ided775438b8e4b87a6acd9bc87657657dbd3d91c
Reviewed-on: https://go-review.googlesource.com/c/go/+/453601
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Cherry Mui <cherryyz@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
18 months agodoc/go1.20: quote code in Bootstrap and Cgo sections
Cherry Mui [Mon, 28 Nov 2022 23:03:20 +0000 (18:03 -0500)]
doc/go1.20: quote code in Bootstrap and Cgo sections

Add code tag for environment variables and file paths in the
Bootstrap section.

Add code tag for packages in the Cgo section.

Change-Id: Ib0fad1c09fbc497a097ef43cbf5850a27b9a6532
Reviewed-on: https://go-review.googlesource.com/c/go/+/453621
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
18 months agotesting: remove stale builder names from windows tests
Than McIntosh [Wed, 23 Nov 2022 11:47:14 +0000 (06:47 -0500)]
testing: remove stale builder names from windows tests

A couple of the windows runtime tests were being gated by "if
testenv.Builder() == ..." guards that referred to builders that have
long since been obsoleted (e.g. "windows-amd64-gce"). Use a more
generic guard instead, checking for windows-<goarch> prefix.

Change-Id: Ibdb9ce2b0cfe10bba986bd210a5b8ce5c1b1d675
Reviewed-on: https://go-review.googlesource.com/c/go/+/453035
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

18 months agodoc/go1.20: add release notes for the linker
Cherry Mui [Mon, 28 Nov 2022 20:42:40 +0000 (15:42 -0500)]
doc/go1.20: add release notes for the linker

For #54202.

Change-Id: I06d7a44fb24427d783a9f57368dccce219b217bb
Reviewed-on: https://go-review.googlesource.com/c/go/+/453620
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Austin Clements <austin@google.com>
18 months agodoc/go1.20: add release notes for PGO
Cherry Mui [Mon, 28 Nov 2022 17:22:26 +0000 (12:22 -0500)]
doc/go1.20: add release notes for PGO

For #54202.
For #55022.

Change-Id: Ia3183e48536fa707c091094880d52fb75e7f6666
Reviewed-on: https://go-review.googlesource.com/c/go/+/453636
Reviewed-by: Austin Clements <austin@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Cherry Mui <cherryyz@google.com>

18 months agocmd/go: run the gpg command verbosely in TestScript/version_buildvcs_git_gpg
Bryan C. Mills [Mon, 28 Nov 2022 19:08:12 +0000 (14:08 -0500)]
cmd/go: run the gpg command verbosely in TestScript/version_buildvcs_git_gpg

Also update test helper programs to avoid the deprecated io/ioutil
package and fix minor formatting issues.

For #49649.

Change-Id: Id404acbb2795470420854d682f849d959d2080c0
Reviewed-on: https://go-review.googlesource.com/c/go/+/453775
Auto-Submit: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Carlos Amedee <carlos@golang.org>
18 months agocontext: add lock in Cause to avoid race
Ian Lance Taylor [Mon, 28 Nov 2022 18:33:04 +0000 (10:33 -0800)]
context: add lock in Cause to avoid race

Change-Id: I8d970e8db859bdd17390cfbc22cc2ba0d326ed0c
Reviewed-on: https://go-review.googlesource.com/c/go/+/453735
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Sameer Ajmani <sameer@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>

18 months agonet: gofmt after CL 382996
Tobias Klauser [Mon, 28 Nov 2022 13:22:10 +0000 (14:22 +0100)]
net: gofmt after CL 382996

Change-Id: Ic1302eb02f4369bf6758be9fb91379fd9a992e48
Reviewed-on: https://go-review.googlesource.com/c/go/+/453575
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Damien Neil <dneil@google.com>
18 months agodoc/go1.20: fix missing <code> tag
Tobias Klauser [Mon, 28 Nov 2022 17:00:55 +0000 (18:00 +0100)]
doc/go1.20: fix missing <code> tag

Change-Id: I9c6f9ec28dbe038ddc195310a32d97d5b2a28ef5
Reviewed-on: https://go-review.googlesource.com/c/go/+/453695
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
18 months agodoc/go1.20: fix missing </code> tag
Russ Cox [Mon, 28 Nov 2022 16:38:59 +0000 (11:38 -0500)]
doc/go1.20: fix missing </code> tag

Change-Id: I8767696a62d8a814c7ed94abfd4b99ca0cab31f9
Reviewed-on: https://go-review.googlesource.com/c/go/+/453635
Auto-Submit: Russ Cox <rsc@golang.org>
TryBot-Bypass: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Robert Griesemer <gri@google.com>
18 months agocmd/api: rewrite as package test
Russ Cox [Wed, 23 Nov 2022 19:16:53 +0000 (14:16 -0500)]
cmd/api: rewrite as package test

No one ever runs 'go tool api', because the invocation
has gotten unwieldy enough that it's not practical.
And we don't support it as a standalone tool for other
packages - it's not even in the distribution.

Making it an ordinary package test lets us invoke it
more easily from cmd/dist (as go test cmd/api -check)
and avoids the increasingly baroque code in run.go to
build a command line.

Left in cmd/api even though it's no longer a command
because (1) it uses a package from cmd/vendor and
(2) it uses internal/testenv. Otherwise it could be misc/api.

Fixes #56845.

Change-Id: I00a13d9c19b1e259fa0e6bb93d1a4dca25f0e8c1
Reviewed-on: https://go-review.googlesource.com/c/go/+/453258
Auto-Submit: Russ Cox <rsc@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Russ Cox <rsc@golang.org>

18 months agodoc/go1.20: complete, add more library TODOs
Russ Cox [Wed, 23 Nov 2022 23:08:57 +0000 (18:08 -0500)]
doc/go1.20: complete, add more library TODOs

Finish all standard library TODOs, including additions
flagged by another run of relnote.

Change-Id: Ib9d22672b13b9775a98262d645aaf1d54e7494df
Reviewed-on: https://go-review.googlesource.com/c/go/+/453295
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>

18 months agodoc/go1.20: fix HTML closing tag
Brad Fitzpatrick [Sun, 27 Nov 2022 00:27:40 +0000 (16:27 -0800)]
doc/go1.20: fix HTML closing tag

Change-Id: I7e2519601bfe1a59a48e240ff67868b1d74d55d1
Reviewed-on: https://go-review.googlesource.com/c/go/+/453516
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>

18 months agocontext: canceLLation
Russ Cox [Wed, 23 Nov 2022 22:42:01 +0000 (17:42 -0500)]
context: canceLLation

Fixes post-review comment on CL 375977.

Change-Id: If7117fd7b505670eb676a73d991917505bc18a4b
Reviewed-on: https://go-review.googlesource.com/c/go/+/453296
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Russ Cox <rsc@golang.org>

18 months agolib/time, time/tzdata: update to 2022f
Tobias Klauser [Wed, 23 Nov 2022 13:07:19 +0000 (14:07 +0100)]
lib/time, time/tzdata: update to 2022f

Version 2022f was released on 2022-10-29,  see
https://mm.icann.org/pipermail/tz-announce/2022-October/000075.html for
the release announcement.

For #22487

Change-Id: I6130def7fcd389b30ffed0eb9003d0fcf5eabb82
Reviewed-on: https://go-review.googlesource.com/c/go/+/453055
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
18 months agosyscall, runtime/internal/syscall: zero r2 before mips linux syscalls
Rongrong [Mon, 21 Nov 2022 06:05:40 +0000 (14:05 +0800)]
syscall, runtime/internal/syscall: zero r2 before mips linux syscalls

All mips variant perform syscalls similarly. R2 (v0) holds r1 and R3
(v1) holds r2 of a syscall. The latter is only used by 2-ret syscalls.
A 1-ret syscall would not touch R3 but keeps it as is, making r2 be a
random value. Always reset it to 0 before SYSCALL to fix the issue.

Fixes #56426

Change-Id: Ie49965c0c3c224c4a895703ac659205cd040ff56
Reviewed-on: https://go-review.googlesource.com/c/go/+/452975
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Meng Zhuo <mzh@golangcn.org>
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Meng Zhuo <mzh@golangcn.org>
18 months agocrypto/elliptic: remove deprecation markers
Russ Cox [Wed, 23 Nov 2022 21:11:19 +0000 (16:11 -0500)]
crypto/elliptic: remove deprecation markers

These should be deprecated, but per go.dev/wiki/Deprecated,
that should only happen two releases after the replacement is
available (so Go 1.22).

The deprecation of this package was part of the discussion
of proposal #52221. All that remains is waiting for the new
package to be widely available.

Change-Id: I580a4af6514eb77d7ec31b443d07259a4a2cf030
Reviewed-on: https://go-review.googlesource.com/c/go/+/453256
Reviewed-by: Roland Shoemaker <roland@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>

18 months agocrypto/rsa: remove deprecation markers for multiprime RSA support
Russ Cox [Wed, 23 Nov 2022 21:13:34 +0000 (16:13 -0500)]
crypto/rsa: remove deprecation markers for multiprime RSA support

These should be marked deprecated, but that needs a
(likely quick) proposal review.

The proposal is #56921.

Change-Id: I013a913a7f5196a341e2dd5f49c2687c26ee8331
Reviewed-on: https://go-review.googlesource.com/c/go/+/453257
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>

18 months agodoc/go1.20: document changes to os on Windows
qmuntal [Tue, 22 Nov 2022 08:43:04 +0000 (09:43 +0100)]
doc/go1.20: document changes to os on Windows

This CL documents the changes introduced by
https://go-review.googlesource.com/c/go/+/405275.

Change-Id: I541712d65f2823ecdf606c5b91035cde55ecdac6
Reviewed-on: https://go-review.googlesource.com/c/go/+/452735
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Quim Muntal <quimmuntal@gmail.com>

18 months agofmt: add uintptr test case
kijimaD [Wed, 23 Nov 2022 07:09:31 +0000 (07:09 +0000)]
fmt: add uintptr test case

uintptr case was not covered, so add test.

Change-Id: I894e06cb7db250d5dc1f14293c0d5834bfb00b9a
GitHub-Last-Rev: 92f8301cb03b503500def0ae076fbf4de8ec448c
GitHub-Pull-Request: golang/go#56912
Reviewed-on: https://go-review.googlesource.com/c/go/+/452955
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Martin Möhrmann <moehrmann@google.com>
Reviewed-by: Rob Pike <r@golang.org>
Run-TryBot: Rob Pike <r@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>

18 months agocmd/compile: reenable inlstaticinit
Russ Cox [Tue, 22 Nov 2022 18:28:51 +0000 (13:28 -0500)]
cmd/compile: reenable inlstaticinit

This was disabled in CL 452676 out of an abundance of caution,
but further analysis has shown that the failures were not being
caused by this optimization. Instead the sequence of commits was:

CL 450136 cmd/compile: handle simple inlined calls in staticinit
...
CL 449937 archive/tar, archive/zip: return ErrInsecurePath for unsafe paths
...
CL 451555 cmd/compile: fix static init for inlined calls

The failures in question became compile failures in the first CL
and started building again after the last CL.
But in the interim the code had been broken by the middle CL.
CL 451555 was just the first time that the tests could run and fail.

For #30820.

Change-Id: I65064032355b56fdb43d9731be2f9f32ef6ee600
Reviewed-on: https://go-review.googlesource.com/c/go/+/452817
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Russ Cox <rsc@golang.org>
Auto-Submit: Russ Cox <rsc@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>

18 months agoreflect: remove deprecation notices from SliceHeader, StringHeader
Russ Cox [Tue, 22 Nov 2022 15:22:00 +0000 (10:22 -0500)]
reflect: remove deprecation notices from SliceHeader, StringHeader

There has been no proposal discussion about adding these notices.
Also, even if we did decide to add them, then since their replacements
are only appearing in Go 1.20, go.dev/wiki/Deprecation says that we
should wait until Go 1.22 to add the deprecation notice.

Filed #56906 for the proposal discussion.

Fixes #56905.

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

18 months agodoc/go1.20: finish most standard library TODOs
Russ Cox [Tue, 22 Nov 2022 15:38:34 +0000 (10:38 -0500)]
doc/go1.20: finish most standard library TODOs

Change-Id: Id8f074b96d28ae37a3d2d2a52a2b80cc53cd1203
Reviewed-on: https://go-review.googlesource.com/c/go/+/452760
TryBot-Bypass: Russ Cox <rsc@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
18 months agodoc/go1.20: document new freebsd/riscv64 port
Russ Cox [Tue, 22 Nov 2022 14:26:43 +0000 (09:26 -0500)]
doc/go1.20: document new freebsd/riscv64 port

Change-Id: I3931b84466f1ded9eecd8b70373ee183268a87a4
Reviewed-on: https://go-review.googlesource.com/c/go/+/452759
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
18 months agodoc/go1.20: add hyperlinks, minor edits
Russ Cox [Tue, 22 Nov 2022 14:07:30 +0000 (09:07 -0500)]
doc/go1.20: add hyperlinks, minor edits

Add links to all significant documentation symbols.
Fix or improve wording a few places.

Change-Id: I53277125eb75a8223a7464136e99accdb46744b7
Reviewed-on: https://go-review.googlesource.com/c/go/+/452757
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Bypass: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>

18 months agodoc/go1.20: document spec changes
Russ Cox [Tue, 22 Nov 2022 14:24:24 +0000 (09:24 -0500)]
doc/go1.20: document spec changes

Change-Id: I2e35bddfe20c96a8dc0ab187286aaf543ff66164
Reviewed-on: https://go-review.googlesource.com/c/go/+/452758
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>

18 months agocmd/compile: fix error message wording
Russ Cox [Tue, 22 Nov 2022 18:27:16 +0000 (13:27 -0500)]
cmd/compile: fix error message wording

CL 450136 fixed a different copy of this error but missed this one.

With the compiler fix from CL 451555 rolled back to produce the error,
this is the text before this CL:

b.go:9:15: internal compiler error: 'init': Value live at entry. It shouldn't be. func init, node a.i, value nil

And this CL changes it to:

b.go:9:15: internal compiler error: 'init': value a.i (nil) incorrectly live at entry

matching the same change in the earlier CL.

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

18 months agodoc/go1.20: document adding to the timeformat vet analysis
Tim King [Tue, 22 Nov 2022 21:52:11 +0000 (13:52 -0800)]
doc/go1.20: document adding to the timeformat vet analysis

Address the release notes TODO regarding the timeformat analyzer.

Change-Id: Ic132569d84d6e00eeed4ea49f2467e09af4b0756
Reviewed-on: https://go-review.googlesource.com/c/go/+/452915
Run-TryBot: Tim King <taking@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

18 months agoplugin: add warning
Alan Donovan [Tue, 22 Nov 2022 03:33:43 +0000 (22:33 -0500)]
plugin: add warning

The plugin mechanism has a number of serious drawbacks.
This change documents them.

Fixes #56893

Change-Id: I1309ac8520f7471dd9ace5be28a8dc3339fdf2db
Reviewed-on: https://go-review.googlesource.com/c/go/+/452695
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Alan Donovan <adonovan@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Alan Donovan <adonovan@google.com>

18 months agospec: add a link to Allocation section in section on append built-in
Robert Griesemer [Tue, 22 Nov 2022 00:36:14 +0000 (16:36 -0800)]
spec: add a link to Allocation section in section on append built-in

If needed, the built-in function append allocates a new underlying
array. While we (probably) don't want to specify exactly how much
is allocated (the prose is deliberately vague), if there's more
space allocated than needed (cap > len after allocation), that
extra space is zeroed. Use an explicit link to the section on
Allocation which explicitly states that newly allocated memory
is zeroed.

Fixes #56684.

Change-Id: I9805d37c263b87860ea703ad143f738a0846247e
Reviewed-on: https://go-review.googlesource.com/c/go/+/452619
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Joseph Tsai <joetsai@digital-static.net>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
18 months agospec: document that trailing comma is valid after index in index expressions
Robert Griesemer [Tue, 22 Nov 2022 00:02:20 +0000 (16:02 -0800)]
spec: document that trailing comma is valid after index in index expressions

At parse time we don't know if a[i] is an index expression or a
type (or function) instantiation. Because instantiations accept
a list of type arguments, and argument lists permit a trailing
comma, a[i,] is either an instantiation or index expression.

Document that a trailing comma is permitted in the syntax for
index expressions.

For comparison, the same problem arises with conversions which
cannot be distinguished from function calls at parse time. The
spec also permits a trailing comma for conversions T(x,). The
grammar adjustment is the same (see line 5239).

Fixes #55007.

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

18 months agocmd/go: fix the DefaultCC check if CC is an absolute file missing an extension on...
Bryan C. Mills [Tue, 22 Nov 2022 20:31:06 +0000 (15:31 -0500)]
cmd/go: fix the DefaultCC check if CC is an absolute file missing an extension on Windows

This undoes the code (but not test) change from CL 451219, which turns
out to be slightly harmful on Windows (because it doesn't resolve the
file extension for an absolute CC path) and unnecessary elsewhere
(because calling LookPath on a fully-resolved executable path already
stats¹ that path before returning it).

¹https://cs.opensource.google/go/go/+/refs/tags/go1.19.3:src/os/exec/lp_unix.go;l=46;drc=027855e8d86f461b50946b006ea032d4b4a7d817

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

18 months agocmd/vendor: update vendored github.com/google/pprof for Go 1.20 release
Cherry Mui [Tue, 22 Nov 2022 17:39:05 +0000 (12:39 -0500)]
cmd/vendor: update vendored github.com/google/pprof for Go 1.20 release

The Go 1.20 code freeze has recently started. This is a time to
update the vendored copy.

Done by
cd GOROOT/src/cmd
go get -d github.com/google/pprof@latest
go mod tidy
go mod vendor

For #36905.

Change-Id: Iaec604c66ea8f4b7638a31bdb77d6dd56966e38a
Reviewed-on: https://go-review.googlesource.com/c/go/+/452815
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
18 months agoall: enable disabled HTTP/2 tests
Damien Neil [Fri, 11 Nov 2022 20:31:44 +0000 (12:31 -0800)]
all: enable disabled HTTP/2 tests

Update net/http to enable tests that pass with the latest update
to the vendored x/net.

Update a few tests:

Windows apparently doesn't guarantee that time.Since(time.Now())
is >=0, so to set a definitely-expired write deadline, use a time
firmly in the past rather than now.

Put a backoff loop on TestServerReadTimeout to avoid failures
when the timeout expires mid-TLS-handshake. (The TLS handshake
timeout is set to min(ReadTimeout, WriteTimeout, ReadHeaderTimeout);
there's no way to set a long TLS handshake timeout and a short
read timeout.)

Don't close the http.Server in TestServerWriteTimeout while the
handler may still be executing, since this can result in us
getting the wrong error.

Change the GOOS=js fake net implementation to properly return
ErrDeadlineExceeded when a read/write deadline is exceeded,
rather than EAGAIN.

For #49837
For #54136

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

18 months agoRevert "net/url, net/http/httputil: accept invalid percent encodings"
Damien Neil [Tue, 22 Nov 2022 17:22:13 +0000 (09:22 -0800)]
Revert "net/url, net/http/httputil: accept invalid percent encodings"

This reverts CL 450375.

Reason for revert: This change causes test failures (and possibly other
problems) for users depending on the existing validation behavior.
Rolling back the change for now to give us more time to consider its
impact. This landed late in the cycle and isn't urgent; it can wait
for 1.21 if we do want to make the change.

Fixes #56884
For #56732

Change-Id: I082023c67f1bbb933a617453ab92b67abba876ef
Reviewed-on: https://go-review.googlesource.com/c/go/+/452795
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Damien Neil <dneil@google.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
18 months agocmd/dist: revise skip sequence added in CL 452763
Than McIntosh [Tue, 22 Nov 2022 17:06:53 +0000 (12:06 -0500)]
cmd/dist: revise skip sequence added in CL 452763

Revise the code added in CL 452763 that skips some of the -race tests
on older windows builders. The old-style skip was doing a log.Printf,
which wound up being interpreted in "-list" mode. Fix is to pass in a
special rtPreFunc when registering the test (thanks Austin for the
fix suggestion).

Updates #56904.

Change-Id: Ia6ea31fb7f011b539173f47357ab3bf7389f256d
Reviewed-on: https://go-review.googlesource.com/c/go/+/452769
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Run-TryBot: Than McIntosh <thanm@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Than McIntosh <thanm@google.com>

18 months agoarchive/tar, archive/zip: disable ErrInsecurePath by default
Damien Neil [Mon, 21 Nov 2022 22:27:24 +0000 (14:27 -0800)]
archive/tar, archive/zip: disable ErrInsecurePath by default

This change is being made late in the release cycle.
Disable it by default. Insecure path checks may be enabled by setting
GODEBUG=tarinsecurepath=0 or GODEBUG=zipinsecurepath=0.
We can enable this by default in Go 1.21 after publicizing the change
more broadly and giving users a chance to adapt to the change.

For #55356.

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

18 months agoall: update vendored golang.org/x dependencies for Go 1.20 release
Cherry Mui [Tue, 22 Nov 2022 16:25:08 +0000 (11:25 -0500)]
all: update vendored golang.org/x dependencies for Go 1.20 release

The Go 1.20 code freeze has recently started. This is a time to update
all golang.org/x/... module versions that contribute packages to the
std and cmd modules in the standard library to latest master versions.

This CL updates them with x/build/cmd/updatestd.

For #36905.

Change-Id: Ie0ec91daeb848f00f64686003012297161ad02fa
Reviewed-on: https://go-review.googlesource.com/c/go/+/452766
Run-TryBot: Cherry Mui <cherryyz@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
18 months agocmd/dist: skip -race w/ external linkage on windows 2008
Than McIntosh [Tue, 22 Nov 2022 15:42:25 +0000 (10:42 -0500)]
cmd/dist: skip -race w/ external linkage on windows 2008

Add a skip for the external-linkage part of the race detector test for
elderly versions of windows, until the underlying cause for the problem
can be determined.

Updates #56904.

Change-Id: I3e8650ff66f34efefabcd6bc343d57124539901b
Reviewed-on: https://go-review.googlesource.com/c/go/+/452763
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Than McIntosh <thanm@google.com>
Auto-Submit: Than McIntosh <thanm@google.com>

18 months agocmd/go: remove special case for prebuilt cgo library cache keys
Bryan C. Mills [Tue, 22 Nov 2022 03:12:15 +0000 (22:12 -0500)]
cmd/go: remove special case for prebuilt cgo library cache keys

This was an oversight from CL 452457 that I noticed while
investigating #56889.

This change essentially undoes CL 335409, which is no longer needed
after CL 450739 because we no longer attempt to use cgo by default
when no C compiler is present.

Updates #47257.
Updates #40042.
Updates #47215.

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