]> Cypherpunks.ru repositories - gostls13.git/log
gostls13.git
4 months ago[release-branch.go1.22] go1.22rc1 go1.22rc1
Gopher Robot [Tue, 19 Dec 2023 20:28:47 +0000 (20:28 +0000)]
[release-branch.go1.22] go1.22rc1

Change-Id: Ia3eeb58ffd7acc4dc519a304f3ef934ab9c82175
Reviewed-on: https://go-review.googlesource.com/c/go/+/551536
Reviewed-by: Carlos Amedee <carlos@golang.org>
Auto-Submit: Gopher Robot <gobot@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Than McIntosh <thanm@google.com>
4 months ago[release-branch.go1.22] all: merge master (0324250) into release-branch.go1.22
Than McIntosh [Tue, 19 Dec 2023 15:57:35 +0000 (10:57 -0500)]
[release-branch.go1.22] all: merge master (0324250) into release-branch.go1.22

Merge List:

+ 2023-12-19 03242506de doc: comment out remaining TODOs in Go 1.22 relnotes (for now)
+ 2023-12-19 9dd1cde9ac doc/go1.22,cmd/go: document that 'go mod init' no longer imports from other vendoring tools
+ 2023-12-19 22284c34f2 doc/go1.22: document removal of 'go get' support in GOPATH mode
+ 2023-12-19 339177aa31 doc: typo fix for net/http.ServeMux
+ 2023-12-19 52dbffeac8 cmd/go/internal/toolchain: revert "make a best effort to parse 'go run' and 'go install' flags"

Change-Id: I102e8267373364d0ad6170d36442d19048268765

4 months agodoc: comment out remaining TODOs in Go 1.22 relnotes (for now)
Than McIntosh [Tue, 19 Dec 2023 15:32:52 +0000 (10:32 -0500)]
doc: comment out remaining TODOs in Go 1.22 relnotes (for now)

This patch comments out the remaining "TODO" items in the Go 1.22
release notes temporarily, so as to have RC1 go out with the notes
in a clean (TODO-less) state.

Change-Id: I88f5fef75860fc78b8077dce704ae71c6194a6a9
Reviewed-on: https://go-review.googlesource.com/c/go/+/551257
Reviewed-by: Carlos Amedee <carlos@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Than McIntosh <thanm@google.com>

4 months agodoc/go1.22,cmd/go: document that 'go mod init' no longer imports from other vendoring...
Bryan C. Mills [Mon, 11 Dec 2023 17:42:16 +0000 (12:42 -0500)]
doc/go1.22,cmd/go: document that 'go mod init' no longer imports from other vendoring tools

This support was removed in CL 518776.

For #61422.
Fixes #53327.

Change-Id: I8ad0f76aed5f03e32c4c2c5c0001c3f06beb3c7d
Reviewed-on: https://go-review.googlesource.com/c/go/+/548877
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

4 months agodoc/go1.22: document removal of 'go get' support in GOPATH mode
Bryan C. Mills [Mon, 11 Dec 2023 17:29:32 +0000 (12:29 -0500)]
doc/go1.22: document removal of 'go get' support in GOPATH mode

For #61422.
Updates #60915.

Change-Id: Ia8ca12c163a02223b26c5e4cd4c1b6093978aba4
Reviewed-on: https://go-review.googlesource.com/c/go/+/548875
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

4 months agodoc: typo fix for net/http.ServeMux
Carlos Amedee [Tue, 19 Dec 2023 14:44:43 +0000 (09:44 -0500)]
doc: typo fix for net/http.ServeMux

Updates #61422

Change-Id: I2d86863db70792122b5168935e76d9ca38f761b7
Reviewed-on: https://go-review.googlesource.com/c/go/+/551256
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Auto-Submit: Carlos Amedee <carlos@golang.org>

4 months agocmd/go/internal/toolchain: revert "make a best effort to parse 'go run' and 'go insta...
Russ Cox [Tue, 19 Dec 2023 14:21:45 +0000 (09:21 -0500)]
cmd/go/internal/toolchain: revert "make a best effort to parse 'go run' and 'go install' flags"

This caused other problems, and for the purposes of the Go 1.22
release, we can just roll back to the Go 1.21 behavior and then
decide in January what the correct path forward is.

Revert of CL 546635.

Unfixes #64282.
Fixes #64738.
For #57001.

This reverts commit e44b8b15b19058b7a22a859ab4159f924856f688.

Change-Id: I78753c76dcd0bc6dbc90caa17f73248c42e5f64a
Reviewed-on: https://go-review.googlesource.com/c/go/+/551215
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Russ Cox <rsc@golang.org>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Than McIntosh <thanm@google.com>
4 months ago[release-branch.go1.22] all: merge master (1d4b0b6) into release-branch.go1.22
Than McIntosh [Tue, 19 Dec 2023 14:29:25 +0000 (09:29 -0500)]
[release-branch.go1.22] all: merge master (1d4b0b6) into release-branch.go1.22

Merge List:

+ 2023-12-19 1d4b0b6236 doc/go1.22.html: release notes for slog, testing/slogtest and net/http.ServeMux
+ 2023-12-19 6fe0d3758b cmd/compile: remove interfacecycles debug flag
+ 2023-12-19 90daaa0576 doc/go1.22: announcing support address sanitizer on Loong64
+ 2023-12-18 5b84d50038 test: skip rangegen.go on 32-bit platforms
+ 2023-12-18 4106de901a crypto/tls: align FIPS-only mode with BoringSSL policy
+ 2023-12-18 7383b2a4db crypto/internal/boring: upgrade module to fips-20220613
+ 2023-12-18 c564d4ae08 Revert "cmd/cgo/internal/testsanitizers: fix msan test failing with clang >= 16"
+ 2023-12-18 7058f09a8b cmd: go get golang.org/x/tools@83bceaf2 and revendor
+ 2023-12-18 761e10be88 cmd/link/internal/loadpe: update comment about @feat.00 symbol handling
+ 2023-12-18 450f5d90c2 doc: add math/rand/v2 release notes
+ 2023-12-18 08bec0db39 builtin: mention PanicNilError in comments of recover
+ 2023-12-18 2acbdd086d cmd/cgo/internal/testsanitizers: fix msan test failing with clang >= 16
+ 2023-12-18 a7097243e4 internal/syscall/windows: fix the signature of SetFileInformationByHandle
+ 2023-12-18 8e3930f258 runtime: skip TestRuntimeLockMetricsAndProfile for flakiness
+ 2023-12-15 9b4b3e5acc runtime: properly model rwmutex in lock ranking
+ 2023-12-15 793097161b all: fix copyright headers
+ 2023-12-15 f8170cc017 cmd/asm: for arm, rewrite argument shifted right by 0 to left by 0.
+ 2023-12-15 3313bbb405 runtime: add race annotations in IncNonDefault
+ 2023-12-15 b60bf8f8e1 cmd/asm: fix encoding for arm right shift by constant 0
+ 2023-12-15 5e939b3a9c doc: add crypto/tls and crypto/x509 release notes

Change-Id: I2a80e9d39aa1fbb22b06ecfa16f725bacb78eb3f

4 months agodoc/go1.22.html: release notes for slog, testing/slogtest and net/http.ServeMux
Jonathan Amsterdam [Mon, 18 Dec 2023 18:07:07 +0000 (13:07 -0500)]
doc/go1.22.html: release notes for slog, testing/slogtest and net/http.ServeMux

Updates #61422.

Change-Id: I8f2dfe92405f409c46465bbb5714eff662ce9b49
Reviewed-on: https://go-review.googlesource.com/c/go/+/550776
Run-TryBot: Jonathan Amsterdam <jba@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

4 months agocmd/compile: remove interfacecycles debug flag
Robert Griesemer [Tue, 19 Dec 2023 02:13:30 +0000 (18:13 -0800)]
cmd/compile: remove interfacecycles debug flag

Per the discussion on the issue, since no problems related to this
appeared since Go 1.20, remove the ability to disable the check for
anonymous interface cycles permanently.

Adjust various tests accordingly.

For #56103.

Change-Id: Ica2b28752dca08934bbbc163a9b062ae1eb2a834
Reviewed-on: https://go-review.googlesource.com/c/go/+/550896
Run-TryBot: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
4 months agodoc/go1.22: announcing support address sanitizer on Loong64
Guoqi Chen [Fri, 15 Dec 2023 09:35:40 +0000 (17:35 +0800)]
doc/go1.22: announcing support address sanitizer on Loong64

Change-Id: Ide5eddc6c04347ada468bc8dd4c27d9b492cf0ff
Reviewed-on: https://go-review.googlesource.com/c/go/+/550176
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Mauri de Souza Meneguzzo <mauri870@gmail.com>
Reviewed-by: David Chase <drchase@google.com>
4 months agotest: skip rangegen.go on 32-bit platforms
Than McIntosh [Mon, 18 Dec 2023 21:00:06 +0000 (16:00 -0500)]
test: skip rangegen.go on 32-bit platforms

Add a skip for this test that effectively disables it for 32-bit platforms,
so as to not run into timeouts or OOMs on smaller machines.

Fixes #64789.

Change-Id: I2d428e1dccae62b8bb1a69c5f95699692a282bbb
Reviewed-on: https://go-review.googlesource.com/c/go/+/550975
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
4 months agocrypto/tls: align FIPS-only mode with BoringSSL policy
Filippo Valsorda [Thu, 14 Dec 2023 21:13:29 +0000 (22:13 +0100)]
crypto/tls: align FIPS-only mode with BoringSSL policy

This enables TLS 1.3, disables P-521, and disables non-ECDHE suites.

Fixes #64717
Updates #62372

Change-Id: I3a65b239ef0198bbdbe5e55e0810e7128f90a091
Reviewed-on: https://go-review.googlesource.com/c/go/+/549975
Reviewed-by: Roland Shoemaker <roland@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Than McIntosh <thanm@google.com>
4 months agocrypto/internal/boring: upgrade module to fips-20220613
Filippo Valsorda [Thu, 14 Dec 2023 16:07:19 +0000 (17:07 +0100)]
crypto/internal/boring: upgrade module to fips-20220613

Also, add EVP_aead_aes_*_gcm_tls13 to the build, which we will need in a
following CL, to avoid rebuilding the syso twice.

Updates #64717
Updates #62372

Change-Id: Ie4d853ad9b914c1095cad60694a1ae6f77dc22ce
Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-boringcrypto
Reviewed-on: https://go-review.googlesource.com/c/go/+/549695
Reviewed-by: Than McIntosh <thanm@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
4 months agoRevert "cmd/cgo/internal/testsanitizers: fix msan test failing with clang >= 16"
Than McIntosh [Mon, 18 Dec 2023 21:11:13 +0000 (21:11 +0000)]
Revert "cmd/cgo/internal/testsanitizers: fix msan test failing with clang >= 16"

This reverts commit https://go.dev/cl/c/go/+/549297

Reason for revert: breaks clang builder

Change-Id: I2321dec9bc1fc20dfafa8a984303b0b5710f8aac
Reviewed-on: https://go-review.googlesource.com/c/go/+/550779
Auto-Submit: Than McIntosh <thanm@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Mauri de Souza Meneguzzo <mauri870@gmail.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
4 months agocmd: go get golang.org/x/tools@83bceaf2 and revendor
Tim King [Mon, 18 Dec 2023 20:01:43 +0000 (12:01 -0800)]
cmd: go get golang.org/x/tools@83bceaf2 and revendor

go get golang.org/x/tools@83bceaf2 # CL 550395
go mod tidy
go mod vendor

Fixes #64786

Change-Id: Ia9879975eb3e8e4130ded7b2d8ba1277b5811eec
Reviewed-on: https://go-review.googlesource.com/c/go/+/550895
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Tim King <taking@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

4 months agocmd/link/internal/loadpe: update comment about @feat.00 symbol handling
qmuntal [Sun, 17 Dec 2023 16:51:25 +0000 (17:51 +0100)]
cmd/link/internal/loadpe: update comment about @feat.00 symbol handling

The @feat.00 comment is outdated, as Go does support SEH on
windows/amd64. While here, simplify it and add a link to the
relevant documentation.

Change-Id: I6e3c786ca4f4809baf46015edf569d06b12f1239
Reviewed-on: https://go-review.googlesource.com/c/go/+/550635
Reviewed-by: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Run-TryBot: Quim Muntal <quimmuntal@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

4 months agodoc: add math/rand/v2 release notes
Russ Cox [Mon, 18 Dec 2023 18:34:36 +0000 (13:34 -0500)]
doc: add math/rand/v2 release notes

Change-Id: If1922413ff948f9b8d8cebec6756b6870f38c162
Reviewed-on: https://go-review.googlesource.com/c/go/+/550777
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

4 months agobuiltin: mention PanicNilError in comments of recover
Irakli Safareli [Mon, 18 Dec 2023 08:53:03 +0000 (08:53 +0000)]
builtin: mention PanicNilError in comments of recover

As of CL 461956 `recover` will not return `nil` if `panic` is called with `nil`. I have updated  comments of `recover` to account for this change.

Change-Id: Ibd0b27fe9b89fb29349b62ad34e762239a1d165b
GitHub-Last-Rev: c773abb75c8cd8e08c3470f064a3205573156fea
GitHub-Pull-Request: golang/go#64393
Reviewed-on: https://go-review.googlesource.com/c/go/+/544975
Reviewed-by: Mauri de Souza Meneguzzo <mauri870@gmail.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
4 months agocmd/cgo/internal/testsanitizers: fix msan test failing with clang >= 16
Mauri de Souza Meneguzzo [Wed, 13 Dec 2023 19:58:23 +0000 (19:58 +0000)]
cmd/cgo/internal/testsanitizers: fix msan test failing with clang >= 16

Clang 16 introduced a more aggressive behavior regarding uninitialized
memory in the memory sanitizer.

The new option -fsanitize-memory-param-retval is enabled by default
and makes the test msan8 fail, since it uses an
uninitialized variable on purpose.

Disable this behavior if we are running with clang 16+.

Fixes #64616

Change-Id: If366f978bef984ea73f6ae958f24c8fce99b59fe
GitHub-Last-Rev: 60bd64a8fb24a552fce23fb2b43a75e92443e039
GitHub-Pull-Request: golang/go#64691
Reviewed-on: https://go-review.googlesource.com/c/go/+/549297
Auto-Submit: Bryan Mills <bcmills@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Than McIntosh <thanm@google.com>
4 months agointernal/syscall/windows: fix the signature of SetFileInformationByHandle
Bryan C. Mills [Tue, 12 Dec 2023 21:26:45 +0000 (16:26 -0500)]
internal/syscall/windows: fix the signature of SetFileInformationByHandle

Also fix its call site in internal/poll to pass the length of the
actual buffer instead of an unrelated variable, and update the
definition of FILE_BASIC_INFO to match the documented field types
and add padding that is empirically needed on the 386 architecture.

Passing a pointer to a Go-allocated buffer as type uintptr violates
the unsafe.Pointer conversion rules, which allow such a conversion
only in the call expression itself for a call to syscall.Syscall or
equivalent. That can allow the buffer to be corrupted arbitrarily if
the Go runtime happens to garbage-collect it while the call to
SetFileInformationByHandle is in progress.

The Microsoft documentation for SetFileInformationByHandle specifies
its third argument type as LPVOID, which corresponds to Go's
unsafe.Pointer, not uintptr.

Fixes #58933 (maybe).

Change-Id: If577b57adea9922f5fcca55e46030c703d8f035c
Cq-Include-Trybots: luci.golang.try:gotip-windows-amd64-longtest
Reviewed-on: https://go-review.googlesource.com/c/go/+/549256
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
Reviewed-by: Quim Muntal <quimmuntal@gmail.com>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
4 months agoruntime: skip TestRuntimeLockMetricsAndProfile for flakiness
Michael Anthony Knyszek [Mon, 18 Dec 2023 17:03:19 +0000 (17:03 +0000)]
runtime: skip TestRuntimeLockMetricsAndProfile for flakiness

This test was added to check new mutex profile functionality.
Specifically, it checks to make sure that the functionality behind
GODEBUG=runtimecontentionstacks works. The runtime currently tracks
contention from runtime-internal mutexes in mutex profiles, but it does
not record stack traces for them, attributing the time to a dummy
symbol. This GODEBUG enables collecting stacks.

Just disable the test. Even if this functionality breaks, it won't
affect Go users and it'll help keep the builders green. It's fine to
leave the test because this will be revisited in the next dev cycle.

For #64253.

Change-Id: I7938fe0f036fc4e4a0764f030e691e312ec2c9b5
Reviewed-on: https://go-review.googlesource.com/c/go/+/550775
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Eli Bendersky <eliben@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>

5 months agoruntime: properly model rwmutex in lock ranking
Michael Pratt [Wed, 13 Dec 2023 20:07:28 +0000 (15:07 -0500)]
runtime: properly model rwmutex in lock ranking

Currently, lock ranking doesn't really try to model rwmutex. It records
the internal locks rLock and wLock, but in a subpar fashion:

1. wLock is held from lock to unlock, so it works OK, but it conflates
   write locks of all rwmutexes as rwmutexW, rather than allowing
   different rwmutexes to have different rankings.
2. rLock is an internal implementation detail that is only taken when
   there is contention in rlock. As as result, the reader lock path is
   almost never checked.

Add proper modeling. rwmutexR and rwmutexW remain as the ranks of the
internal locks, which have their own ordering. The new init method is
passed the ranks of the higher level lock that this represents, just
like lockInit for mutex.

execW ordered before MALLOC captures the case from #64722. i.e., there
can be allocation between BeforeFork and AfterFork.

For #64722.

Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-staticlockranking
Change-Id: I23335b28faa42fb04f1bc9da02fdf54d1616cd28
Reviewed-on: https://go-review.googlesource.com/c/go/+/549536
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

5 months agoall: fix copyright headers
Jes Cok [Fri, 15 Dec 2023 04:33:18 +0000 (04:33 +0000)]
all: fix copyright headers

Change-Id: Ib16986fb088030b93140e48c17e3d7bb2c9312cf
GitHub-Last-Rev: 41572879f8f45c963c0e3ab9862bc0de59781a13
GitHub-Pull-Request: golang/go#64731
Reviewed-on: https://go-review.googlesource.com/c/go/+/549956
Run-TryBot: Jes Cok <xigua67damn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@google.com>

5 months agocmd/asm: for arm, rewrite argument shifted right by 0 to left by 0.
Keith Randall [Fri, 15 Dec 2023 00:29:50 +0000 (16:29 -0800)]
cmd/asm: for arm, rewrite argument shifted right by 0 to left by 0.

Right shift by 0 has bad semantics. Make sure if we try to right shift by 0,
do a left shift by 0 instead.

CL 549955 handled full instructions with this strange no-op encoding.
This CL handles the shift done to instruction register inputs.
(The former is implemented using the latter, but not until deep
inside the assembler.)

Update #64715

Change-Id: Ibfabb4b13e2595551e58b977162fe005aaaa0ad1
Reviewed-on: https://go-review.googlesource.com/c/go/+/550335
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
5 months agoruntime: add race annotations in IncNonDefault
David Chase [Thu, 14 Dec 2023 19:20:12 +0000 (14:20 -0500)]
runtime: add race annotations in IncNonDefault

Also use CompareAndSwap to make the code actually less racy.

Added a test which will be meaningful when run under the race
detector (tested it -race with broken fix in runtime, it failed).

Fixes #64649

Change-Id: I5972e08901d1adc8ba74858edad7eba91be1b0ce
Reviewed-on: https://go-review.googlesource.com/c/go/+/549796
Run-TryBot: David Chase <drchase@google.com>
Reviewed-by: Mauri de Souza Meneguzzo <mauri870@gmail.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

5 months agocmd/asm: fix encoding for arm right shift by constant 0
Keith Randall [Thu, 14 Dec 2023 21:07:50 +0000 (13:07 -0800)]
cmd/asm: fix encoding for arm right shift by constant 0

Right shifts, for some odd reasons, can encode shifts of constant
1-32 instead of 0-31. Left shifts, however, can encode shifts 0-31.
When the shift amount is 0, arm recommends encoding right shifts
using left shifts.

Fixes #64715

Change-Id: Id3825349aa7195028037893dfe01fa0e405eaa51
Reviewed-on: https://go-review.googlesource.com/c/go/+/549955
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
5 months agodoc: add crypto/tls and crypto/x509 release notes
Roland Shoemaker [Mon, 11 Dec 2023 19:44:23 +0000 (11:44 -0800)]
doc: add crypto/tls and crypto/x509 release notes

Updates #61422

Change-Id: If561f701882396f8e28e2fc3fa9c76c7169f752e
Reviewed-on: https://go-review.googlesource.com/c/go/+/548975
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
Auto-Submit: Roland Shoemaker <roland@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

5 months ago[release-branch.go1.22] update codereview.cfg for release-branch.go1.22
Michael Pratt [Fri, 15 Dec 2023 16:57:56 +0000 (11:57 -0500)]
[release-branch.go1.22] update codereview.cfg for release-branch.go1.22

Change-Id: I3f5cd8d62cfb1e62240e2b9f0b22022ee57262a7
Reviewed-on: https://go-review.googlesource.com/c/go/+/550255
Auto-Submit: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
5 months agonet/netip: remove Prefix.Compare for Go 1.22
Russ Cox [Thu, 14 Dec 2023 04:35:30 +0000 (23:35 -0500)]
net/netip: remove Prefix.Compare for Go 1.22

API questions remain, so we decided to back it out for Go 1.22.
Code still lives in the repo, just unexported.

For #61642.

Change-Id: Iccd91b0da48ae72dec9f660476826a220c7ca4be
Reviewed-on: https://go-review.googlesource.com/c/go/+/549615
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Anderson <dave@natulte.net>
Auto-Submit: Russ Cox <rsc@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
5 months agocmd/go/internal/toolchain: make a best effort to parse 'go run' and 'go install'...
Bryan C. Mills [Fri, 1 Dec 2023 19:25:48 +0000 (14:25 -0500)]
cmd/go/internal/toolchain: make a best effort to parse 'go run' and 'go install' flags

When the argument to 'go install' or 'go run' looks like a versioned
package, we make a best effort to switch to a toolchain compatible
with the module containing that package, by fetching its go.mod file
and checking the go version it specifies.

At this point in the code, we have not yet parsed the arguments given
on the command line: instead, we just make a best effort to find one
we can use to select a toolchain version. Since that toolchain may be
newer, the command to install it may also include flags that are only
supported by that Go version — and we don't want to fail due to an
error that would be resolved by switching to a more appropriate
toolchain.

So at this point in the code we can't parse the flags in a way that
will surface errors, but we want to make a best effort to parse the
ones that we know about. It turns out that “parse the flags we know
about” is already a familiar problem: that's also what we do in
'go test', so we can reuse the cmdflag library from that to do the
best-effort pass of parsing.

If it turns out that we don't need to switch toolchains after all,
cmd/go's main function will parse the flags again, and will report any
errors at that point.

This fixes a regression, introduced in CL 497879, which caused
'go install -modcacherw pkg@version' to unset the write bit for
directories created while selecting the toolchain to use.

Fixes #64282.
Updates #57001.

Change-Id: Icc409c57858aa15c7d58a97a61964b4bc2560547
Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest,gotip-windows-amd64-longtest
Reviewed-on: https://go-review.googlesource.com/c/go/+/546635
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
5 months agocmd/go/internal/modfetch: simplify a redundant condition
Bryan C. Mills [Thu, 14 Dec 2023 19:26:20 +0000 (14:26 -0500)]
cmd/go/internal/modfetch: simplify a redundant condition

In gitRepo.stat, we were checking ref != "" twice,
which confused me during casual reading because it made it seem like
the string could be empty when it actually never is.

For #56881.

Change-Id: Ib83303a149ea771399cb55fedd5dfa02ad411ff0
Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest,gotip-windows-amd64-longtest
Reviewed-on: https://go-review.googlesource.com/c/go/+/549855
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
5 months agocmd/go/internal/vcweb: set GIT_PROTOCOL in the git CGI handler
Bryan C. Mills [Fri, 5 May 2023 13:13:15 +0000 (09:13 -0400)]
cmd/go/internal/vcweb: set GIT_PROTOCOL in the git CGI handler

This works around a bug in 'git http-backend' that was fixed in
Git 2.34.0,¹ and will hopefully allow the tests in
cmd/go/internal/modfetch/codehost to pass reliably using older
Git releases (I tested with 2.30.2).

¹https://github.com/git/git/commit/ff6a37c99e3343633c53f56789afcc8f8165d276

Fixes #56881.

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

5 months agodoc/go1.22: correct the system call name used for zero-copy from net.TCPConn to net...
Andy Pan [Wed, 13 Dec 2023 01:23:18 +0000 (09:23 +0800)]
doc/go1.22: correct the system call name used for zero-copy from net.TCPConn to net.UnixConn

For #58808

Change-Id: I9b27af30888aaaa9659387a32c57aaea136b1c3a
Reviewed-on: https://go-review.googlesource.com/c/go/+/549335
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

5 months agoruntime: delete todo of the list field for mspan
qiulaidongfeng [Thu, 14 Dec 2023 13:12:45 +0000 (13:12 +0000)]
runtime: delete todo of the list field for mspan

Change-Id: I10a3308c19da08d2ff0c8077bb74ad888ee04fea
GitHub-Last-Rev: 3e95b71384a25e0b29029731b72cf2c7f6a96055
GitHub-Pull-Request: golang/go#64077
Reviewed-on: https://go-review.googlesource.com/c/go/+/541755
Reviewed-by: Michael Pratt <mpratt@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com>

5 months agodoc: improve release note for Windows hosts file being respected
Davis Goodin [Wed, 13 Dec 2023 19:38:01 +0000 (11:38 -0800)]
doc: improve release note for Windows hosts file being respected

Make a grammar fix (searches -> searches for) and simplify "when
building with" phrase.

For #61422.

Change-Id: I179b3816c0e223a16e4969290b2c1ed19d44c556
Reviewed-on: https://go-review.googlesource.com/c/go/+/549457
Reviewed-by: Bryan Mills <bcmills@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
Reviewed-by: Quim Muntal <quimmuntal@gmail.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
5 months agodoc: document Windows os.ReadDir improvements
qmuntal [Tue, 12 Dec 2023 18:20:24 +0000 (19:20 +0100)]
doc: document Windows os.ReadDir improvements

For #61422.

Change-Id: Icc1868ef9516766d0f422849866ef8de27bfa4c5
Reviewed-on: https://go-review.googlesource.com/c/go/+/549275
Reviewed-by: Mauri de Souza Meneguzzo <mauri870@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
5 months agodoc: add missing html tags
cui fliter [Wed, 13 Dec 2023 14:50:17 +0000 (22:50 +0800)]
doc: add missing html tags

Change-Id: Ieb1a9efdff571f402dd44815e0fbe2cf5a2d55b1
Reviewed-on: https://go-review.googlesource.com/c/go/+/549355
Reviewed-by: Michael Pratt <mpratt@google.com>
Run-TryBot: shuang cui <imcusg@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
5 months agoall: remove newline characters after return statements
Danil Timerbulatov [Thu, 7 Dec 2023 21:17:19 +0000 (00:17 +0300)]
all: remove newline characters after return statements

This commit is aimed at improving the readability and consistency
of the code base. Extraneous newline characters were present after
some return statements, creating unnecessary separation in the code.

Fixes #64610

Change-Id: Ic1b05bf11761c4dff22691c2f1c3755f66d341f7
Reviewed-on: https://go-review.googlesource.com/c/go/+/548316
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
5 months agodoc/go1.22: pre-announce dropping macOS 10.15 support
Dmitri Shuralyov [Thu, 14 Dec 2023 15:37:33 +0000 (10:37 -0500)]
doc/go1.22: pre-announce dropping macOS 10.15 support

For #64207.
For #23011.

Change-Id: I17ff221718aef03e9cda0ae4eb7b79896933553a
Reviewed-on: https://go-review.googlesource.com/c/go/+/549655
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
5 months agodoc: add release note fragment on inlining changes
Than McIntosh [Wed, 13 Dec 2023 16:37:46 +0000 (11:37 -0500)]
doc: add release note fragment on inlining changes

Add some material to the "compiler" portion of the release
notes describing the 1.22 changes to the inliner.

For #61422.
Updates #61502.

Change-Id: Ic7f1cb7f70752446d2465ea3da6bd7488436342b
Reviewed-on: https://go-review.googlesource.com/c/go/+/549395
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

5 months agogo/types, types2: report error for range over int if Go version < 1.22
Robert Griesemer [Wed, 13 Dec 2023 22:15:53 +0000 (14:15 -0800)]
go/types, types2: report error for range over int if Go version < 1.22

Fixes #64704.

Change-Id: Ied3af46ab534343cdafba5ee27680b9c6ef3d37a
Reviewed-on: https://go-review.googlesource.com/c/go/+/549459
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

5 months agoruntime/pprof: fix inlined generics locations
Tolya Korniltsev [Tue, 12 Dec 2023 15:24:34 +0000 (22:24 +0700)]
runtime/pprof: fix inlined generics locations

When generic function[a,b] is inlined to the same generic function[b,a]
with different types (not recursion) it is expected to get a pprof with
a single Location with two functions. However due to incorrect check
for generics names using runtime.Frame.Function, the profileBuilder
assumes it is a recursion and emits separate Location.

This change fixes the recursion check for generics functions by using
runtime_expandFinalInlineFrame

Fixes #64641

Change-Id: I3f58818f08ee322b281daa377fa421555ad328c9
Reviewed-on: https://go-review.googlesource.com/c/go/+/549135
Run-TryBot: Michael Pratt <mpratt@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

5 months agodoc: in pre-generic spec, be explicit that it is not the current spec
Robert Griesemer [Wed, 13 Dec 2023 19:12:44 +0000 (11:12 -0800)]
doc: in pre-generic spec, be explicit that it is not the current spec

Change-Id: I4cf7efc8e704d41ee2e3743f6aa712cc46dd1fe9
Reviewed-on: https://go-review.googlesource.com/c/go/+/549515
TryBot-Bypass: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
5 months agogo/types, types2: better error message when missing method is unexported
Robert Griesemer [Wed, 13 Dec 2023 01:52:36 +0000 (17:52 -0800)]
go/types, types2: better error message when missing method is unexported

Change lookupMethod such that "foldCase" means "ignore case
and package" and analyze a lookup result further to determine
if a method name was not exported, and report a better error
message in that case.

Fixes #59831.

Change-Id: Ice6222e1fc00dba13caeda6c48971e8473d12da5
Reviewed-on: https://go-review.googlesource.com/c/go/+/549298
Run-TryBot: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@google.com>
5 months agoiter: fix race instrumentation for Pull2
Mauri de Souza Meneguzzo [Tue, 12 Dec 2023 21:39:54 +0000 (21:39 +0000)]
iter: fix race instrumentation for Pull2

Pull2 tests are failing with -race, giving false-positive race conditions
due to bad race instrumentation.

No tests for this as it should be caught by the race builders. The only
reason it was not caught is because it is behind GOEXPERIMENT=rangefunc.

Fixes #64651

Change-Id: I20554da930b0e19594e0e267f01a1e7a9cbc577a
GitHub-Last-Rev: 7c1f19238d2c0b7efa5f0a2033893914e402bbc2
GitHub-Pull-Request: golang/go#64653
Reviewed-on: https://go-review.googlesource.com/c/go/+/548895
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
5 months agogo/types, types2: avoid confusing error message "have m(T), want m(T)"
Robert Griesemer [Tue, 12 Dec 2023 23:40:16 +0000 (15:40 -0800)]
go/types, types2: avoid confusing error message "have m(T), want m(T)"

This is a partial fix for situations where a method lookup leads to
an error due to non-matching signatures, but where the signatures
print exactly the same. This can happen if both signatures contain
type parameters (after instantiation) and the type parameters have
the same name (such as "T").

For now, rather than printing a confusing error message in this
case, leave away the confusing part of the error message (at the
cost of providing slightly less information).

In the long run, we need to find a better solution for this problem;
but this seems better than what we had before.

For #61685.

Change-Id: I259183f08b9db400ffc8e1cf447967c640a0f444
Reviewed-on: https://go-review.googlesource.com/c/go/+/549296
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>
Auto-Submit: Robert Griesemer <gri@google.com>

5 months agodoc/go1.22: document reflect.TypeFor
Mauri de Souza Meneguzzo [Tue, 12 Dec 2023 21:32:10 +0000 (21:32 +0000)]
doc/go1.22: document reflect.TypeFor

Change-Id: I122a3422f541f66d9f6e644a9f287f0e5a5729d2
GitHub-Last-Rev: 1d9fe39d0c1221d7179476383f3d503e45daa051
GitHub-Pull-Request: golang/go#64688
Reviewed-on: https://go-review.googlesource.com/c/go/+/549295
Reviewed-by: Michael Pratt <mpratt@google.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
5 months agocrypto/x509: properly gate test on macos version
Roland Shoemaker [Tue, 12 Dec 2023 17:28:03 +0000 (09:28 -0800)]
crypto/x509: properly gate test on macos version

Fixes the gating of TestIssue51759 by shelling out to sw_vers to check
what version of macOS we are on.

Fixes #64677

Change-Id: I5eef4fa39e5449e7b2aa73864625c3abf002aef8
Reviewed-on: https://go-review.googlesource.com/c/go/+/549195
Reviewed-by: Bryan Mills <bcmills@google.com>
Auto-Submit: Roland Shoemaker <roland@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

5 months agodoc/go1.22: document minor net/http changes
Damien Neil [Tue, 12 Dec 2023 19:27:01 +0000 (11:27 -0800)]
doc/go1.22: document minor net/http changes

For #51971
For #61679

Change-Id: Ie7b44201a9c40f5563c6d6051d22ae807ad0480d
Reviewed-on: https://go-review.googlesource.com/c/go/+/549198
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Damien Neil <dneil@google.com>
Reviewed-by: Mauri de Souza Meneguzzo <mauri870@gmail.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
5 months agodoc/go1.22: document zero-copy to net.UnixConn
Damien Neil [Tue, 12 Dec 2023 19:10:35 +0000 (11:10 -0800)]
doc/go1.22: document zero-copy to net.UnixConn

For #58808

Change-Id: Id73b9e4b5fb96426a01b76ce7a1053a6ad61a58e
Reviewed-on: https://go-review.googlesource.com/c/go/+/549197
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Auto-Submit: Damien Neil <dneil@google.com>

5 months agodoc: document SetUnhandledExceptionFilter interop
qmuntal [Sun, 10 Dec 2023 17:38:08 +0000 (18:38 +0100)]
doc: document SetUnhandledExceptionFilter interop

For #50951.
For #61422.

Change-Id: Ib9038a00de8f4d8606443e9acd414402023cde63
Reviewed-on: https://go-review.googlesource.com/c/go/+/548319
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
5 months agodoc/go1.22: remove reference to #60107
Damien Neil [Tue, 12 Dec 2023 18:52:57 +0000 (10:52 -0800)]
doc/go1.22: remove reference to #60107

This was implemented in Go 1.21.

Change-Id: Ic434670938589f10f367b1f893c4427e6f0b991c
Reviewed-on: https://go-review.googlesource.com/c/go/+/549196
Auto-Submit: Damien Neil <dneil@google.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Mauri de Souza Meneguzzo <mauri870@gmail.com>
5 months agocmd/cgo/internal/testsanitizers: check for go build and cgo in fuzzer and msan tests
Mauri de Souza Meneguzzo [Mon, 11 Dec 2023 00:22:50 +0000 (00:22 +0000)]
cmd/cgo/internal/testsanitizers: check for go build and cgo in fuzzer and msan tests

Make sure the platform we are running the tests on can compile programs
and has cgo support in order to run the fuzzer and msan tests. This is the
same approach used by the asan tests, which share the same requirements.

Fixes #64626

Change-Id: I7c0b912dabdd1b7d7d44437e4ade5e5994994796
GitHub-Last-Rev: 9fae6970f0f3b32a24893ef32fc4b38fa5a2a96d
GitHub-Pull-Request: golang/go#64640
Reviewed-on: https://go-review.googlesource.com/c/go/+/548715
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
5 months agogo/types, types2: flip message contents for reverse type inference errors
Robert Griesemer [Tue, 12 Dec 2023 01:54:18 +0000 (17:54 -0800)]
go/types, types2: flip message contents for reverse type inference errors

Add a new flag 'reverse' to control the formatting of type inference
error messages.

This change only impacts error messages.

Fixes #60747.

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

5 months agogo/types, types2: better error message for cases of reverse type inference
Robert Griesemer [Mon, 11 Dec 2023 21:28:25 +0000 (13:28 -0800)]
go/types, types2: better error message for cases of reverse type inference

Introduce a new type "target" to pass around target types together
with a suitable description (typically a variable name) for a better
error message.

As a side effect, using a specific type (target), rather than just Type
avoids accidental confusion with other types.

Use the target type description for a better error message in some
cases.

The error message can be further improved by flipping the order of
the sentence (for another CL to keep this one small and simple).

Also, and unrelated to this fix, remove the first argument to errorf
in infer.go: the argument is always "type" (there's only one call).

For #60747.

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

5 months agodoc/go1.22: remove empty cgo section
Bryan C. Mills [Mon, 11 Dec 2023 17:31:25 +0000 (12:31 -0500)]
doc/go1.22: remove empty cgo section

The only issue in this section, #56378, does not need a release note
for Go 1.22 because its feature was disabled for this release.

For #61422.
Updates #56378.

Change-Id: Ia4e090994cd9ac04e855f8b3a2c6ca0cde4485d2
Reviewed-on: https://go-review.googlesource.com/c/go/+/548876
Auto-Submit: Bryan Mills <bcmills@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

5 months agodoc/go1.22: document ast.Unparen
Alan Donovan [Mon, 11 Dec 2023 22:50:08 +0000 (17:50 -0500)]
doc/go1.22: document ast.Unparen

Updates #60061

Change-Id: Ifa51f0bac0346ebc352c7524204aa94336a2b5ad
Reviewed-on: https://go-review.googlesource.com/c/go/+/548882
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
5 months agodoc: emphasize gotypesalias GODEBUG flag in go 1.22 release notes
Robert Griesemer [Tue, 12 Dec 2023 02:22:59 +0000 (18:22 -0800)]
doc: emphasize gotypesalias GODEBUG flag in go 1.22 release notes

Per discussion with rfindley.

Change-Id: Ia1cff05aff724eb8c919ffcc1fac121ca017efe9
Reviewed-on: https://go-review.googlesource.com/c/go/+/549056
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
TryBot-Bypass: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
5 months agodoc/go1.22: document io changes
Michael Pratt [Mon, 11 Dec 2023 21:45:56 +0000 (16:45 -0500)]
doc/go1.22: document io changes

Change-Id: I1dd4030782ad20512836927d42bc8fe3d93437d7
Reviewed-on: https://go-review.googlesource.com/c/go/+/548880
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
5 months agodoc/go1.22: document bufio changes
Michael Pratt [Mon, 11 Dec 2023 21:37:49 +0000 (16:37 -0500)]
doc/go1.22: document bufio changes

For #61422.

Change-Id: I1b20c536a5b1c105286c84e7c1c7e37eb89bbc93
Reviewed-on: https://go-review.googlesource.com/c/go/+/548879
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

5 months agodoc/go1.22: document archive/tar and archive/zip changes
Michael Pratt [Mon, 11 Dec 2023 21:19:42 +0000 (16:19 -0500)]
doc/go1.22: document archive/tar and archive/zip changes

For #61422.

Change-Id: Icf56cba0ac40b46caf3072bf2951b07403f47f36
Reviewed-on: https://go-review.googlesource.com/c/go/+/548939
Auto-Submit: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
5 months agocmd/go: explicitly name the default branch “main” in testdata/vcstest/git/issue57650.txt
Bryan C. Mills [Tue, 12 Dec 2023 15:49:55 +0000 (10:49 -0500)]
cmd/go: explicitly name the default branch “main” in testdata/vcstest/git/issue57650.txt

Updates #47650.

Change-Id: I90c0a51b390326129643d5b90fe935d44e5e5372
Reviewed-on: https://go-review.googlesource.com/c/go/+/549155
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Bryan Mills <bcmills@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
5 months agocrypto/x509: gate Policies marshaling with GODEBUG
Roland Shoemaker [Mon, 4 Dec 2023 18:17:34 +0000 (10:17 -0800)]
crypto/x509: gate Policies marshaling with GODEBUG

Use a GODEBUG to choose which certificate policy field to use. If
x509usepolicies=1 is set, use the Policies field, otherwise use the
PolicyIdentifiers field.

Fixes #64248

Change-Id: I3f0b56102e0bac4ebe800497717c61c58ef3f092
Reviewed-on: https://go-review.googlesource.com/c/go/+/546916
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

5 months agonet: remove an arbitrary timeout in TestAcceptTimeoutMustReturn
Bryan C. Mills [Mon, 11 Dec 2023 21:14:24 +0000 (16:14 -0500)]
net: remove an arbitrary timeout in TestAcceptTimeoutMustReturn

This probably fixes the failure mode seen in
https://build.golang.org/log/e73acfd930cbe82302505cac0041d9883e2360c5.

If not, allowing the test to deadlock and dump goroutines
should produce better debugging information than the existing
"didn't return in an expected time" failure message.

For #58901.

Change-Id: Ie0bb1887a4329d2f6b0e7348a4820af71385494e
Reviewed-on: https://go-review.googlesource.com/c/go/+/548881
Auto-Submit: Bryan Mills <bcmills@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
5 months agocmd/go/internal/modload: classify "invalid pseudo-version" errors in Query
Bryan C. Mills [Fri, 8 Dec 2023 16:26:30 +0000 (11:26 -0500)]
cmd/go/internal/modload: classify "invalid pseudo-version" errors in Query

If we encounter an unclassified error in modload.Query, it takes
precedence even if the package is found in some other module.
(That is intentional, so that if a package exists in both a parent
and a nested module the outcome is deterministic, and does not shift
if a temporary error causes one of the modules to be unavailable.)

A pseudo-version is formed from a base version and a commit hash.
Each version tag is specific to the module in a particular directory
of the repo (often the root directory), whereas the commit hash is
the same for all subdirectories. When we go to check a particular
subdirectory for the requested package, we may find that that version
is not valid for that combination of <subdirectory, commit hash>,
but we should keep looking to see whether it is valid for a module
in some other subdirectory.

Fixes #47650.

Change-Id: Id48f590ce906a3d4cf4e82fc66137bf67613277d
Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest,gotip-windows-amd64-longtest
Reviewed-on: https://go-review.googlesource.com/c/go/+/548475
Reviewed-by: Michael Matloob <matloob@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Bryan Mills <bcmills@google.com>

5 months agodoc: document SEH changes
qmuntal [Sat, 9 Dec 2023 00:03:32 +0000 (01:03 +0100)]
doc: document SEH changes

For #57302.
For #61422.

Change-Id: Iee4e6600bf473eb982d0cb7330f7b2c1b48b9e13
Reviewed-on: https://go-review.googlesource.com/c/go/+/548575
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
5 months agodoc/go1.22: remove compiler TODO
Michael Pratt [Mon, 11 Dec 2023 20:55:17 +0000 (15:55 -0500)]
doc/go1.22: remove compiler TODO

For #61422.

Change-Id: Id4eed9affde20857d6b60c0b6d7d1443ea5e460b
Reviewed-on: https://go-review.googlesource.com/c/go/+/548938
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
5 months agodoc/go1.22: add TODOs for missing APIs
Michael Pratt [Mon, 11 Dec 2023 20:49:09 +0000 (15:49 -0500)]
doc/go1.22: add TODOs for missing APIs

Add TODOs for APIs mentioned in api/go1.22.txt but missing from the
release notes.

The issue list was generated with:

    $ awk '{print substr($NF, 2, length($NF)-1)}' < ../api/go1.22.txt | uniq | xargs -I{} sh -c 'echo -n "{}: " && grep -c {} ../doc/go1.22.html'

For #61422.

Change-Id: I85d41c28530e6b5e3e388a41206b251278c91dd5
Reviewed-on: https://go-review.googlesource.com/c/go/+/548937
Auto-Submit: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
5 months agodoc/go1.22: document syscall changes
Michael Pratt [Mon, 11 Dec 2023 20:03:39 +0000 (15:03 -0500)]
doc/go1.22: document syscall changes

For #61422.

Change-Id: I976b8cc14893b91e5140c7b53d0773bca57cb19d
Reviewed-on: https://go-review.googlesource.com/c/go/+/548936
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
5 months agodoc/go1.22: document workspace vendoring
Bryan C. Mills [Mon, 11 Dec 2023 16:29:36 +0000 (11:29 -0500)]
doc/go1.22: document workspace vendoring

For #61422.
Updates #60056.

Change-Id: Ie7c7e12acc173f1ff1644555016e51a52509bd6d
Reviewed-on: https://go-review.googlesource.com/c/go/+/548815
Auto-Submit: Bryan Mills <bcmills@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

5 months agodoc/go1.22: fix stale id for math/rand/v2
Michael Pratt [Mon, 11 Dec 2023 19:14:10 +0000 (14:14 -0500)]
doc/go1.22: fix stale id for math/rand/v2

For #61422.

Change-Id: If87f30229e5e5351e81d42c777259335af3533e6
Reviewed-on: https://go-review.googlesource.com/c/go/+/548878
Auto-Submit: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
5 months agodoc: fix formatting of runtime and runtime/trace release notes
Michael Anthony Knyszek [Mon, 11 Dec 2023 18:43:11 +0000 (18:43 +0000)]
doc: fix formatting of runtime and runtime/trace release notes

For #61422.

Change-Id: I621627140d2d5ebede9b932a7e55fbe92ded5249
Reviewed-on: https://go-review.googlesource.com/c/go/+/548935
Auto-Submit: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
5 months agoruntime/pprof: fix generics function names
Tolya Korniltsev [Mon, 4 Dec 2023 10:53:29 +0000 (17:53 +0700)]
runtime/pprof: fix generics function names

profileBuilder is using Frame->Function as key for checking if we already
emitted a function. However for generics functions it has dots there [...],
so sometimes for different functions with different generics types,
the profileBuilder emits wrong functions.

Fixes #64528

Change-Id: I8b39245e0b18f4288ce758c912c6748f87cba39a
Reviewed-on: https://go-review.googlesource.com/c/go/+/546815
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
5 months agoruntime: clear mspan.largeType more carefully in the case of arenas
Keith Randall [Fri, 8 Dec 2023 21:50:22 +0000 (13:50 -0800)]
runtime: clear mspan.largeType more carefully in the case of arenas

The pointer stored in mspan.largeType is an invalid pointer when
the span is an arena. We need to make sure that pointer isn't seen
by the garbage collector, as it might barf on it. Make sure we
zero the pointer using a uintptr write so the old value isn't picked
up by the write barrier.

The mspan.largeType field itself is in a NotInHeap struct, so a heap
scan won't find it. The only way we find it is when writing it, or
when reading it and putting it in a GC-reachable location. I think we
might need to audit the runtime to make sure these pointers aren't
being passed in places where the GC might (non-conservatively) scan a
stack frame it lives in. (It might be ok, many such places are either
systemstack or nosplit.)

Change-Id: Ie059d054e0da4d48a4c4b3be88b8e1e46ffa7d10
Reviewed-on: https://go-review.googlesource.com/c/go/+/548535
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

5 months agodoc: document os/exec changes on Windows
Bryan C. Mills [Fri, 8 Dec 2023 22:01:43 +0000 (17:01 -0500)]
doc: document os/exec changes on Windows

For #61422.
Updates #62596.
Updates #61493.

Change-Id: I5c910f9961da24d90b3618ee53540118db06ff91
Reviewed-on: https://go-review.googlesource.com/c/go/+/548481
Auto-Submit: Bryan Mills <bcmills@google.com>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

5 months agoos: limit temp file randomness to uint32
Russ Cox [Sat, 9 Dec 2023 19:32:10 +0000 (14:32 -0500)]
os: limit temp file randomness to uint32

CL 516860 accidentally changed the randomness
used in TempFile from 32 to 64 bits on 64-bit platforms,
meaning from 10 to 20 decimal bytes.
This is enough to cause problems in a few tests
because it makes temporary directory names just
a little bit longer.

Limit back down to 32 bits of randomness, which is fine,
and add a test to avoid repeating the mistake.

Fixes #64605.

Change-Id: I17b8c063d11d5c0a96a68b5e5f83c889a13bca77
Reviewed-on: https://go-review.googlesource.com/c/go/+/548635
Reviewed-by: Bryan Mills <bcmills@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Russ Cox <rsc@golang.org>

5 months agodoc: document that os.Stat follows all link reparse points on Windows
qmuntal [Thu, 7 Dec 2023 20:45:57 +0000 (21:45 +0100)]
doc: document that os.Stat follows all link reparse points on Windows

For #61422.

Change-Id: I2bb59a1ae38c40368343414a6077bb09c1675a6b
Reviewed-on: https://go-review.googlesource.com/c/go/+/548315
Reviewed-by: Bryan Mills <bcmills@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
5 months agodoc: document that the Windows hosts file is now respected
qmuntal [Wed, 6 Dec 2023 23:59:54 +0000 (00:59 +0100)]
doc: document that the Windows hosts file is now respected

For #57757.
For #61422.

Change-Id: Icbe9a86b43eb0816dc5899a1c14b50ee22db1c5d
Reviewed-on: https://go-review.googlesource.com/c/go/+/548095
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
5 months agodoc: describe for loop changes (lifetime, range int; range func experiment)
David Chase [Wed, 29 Nov 2023 21:09:26 +0000 (16:09 -0500)]
doc: describe for loop changes (lifetime, range int; range func experiment)

See also https://go.dev/wiki/RangefuncExperiment, written as a companion
to this change.

For #61422.

Change-Id: I129bf38dd2fa4aef47454138b4ca5ed18653aecf
Reviewed-on: https://go-review.googlesource.com/c/go/+/546095
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
5 months agodoc/go1.22: document that reflect.PtrTo is deprecated
Cherry Mui [Fri, 8 Dec 2023 20:33:14 +0000 (15:33 -0500)]
doc/go1.22: document that reflect.PtrTo is deprecated

Updates #59599.
For #61422.

Change-Id: I923be38b719a78dd983372acad93f710a53b0922
Reviewed-on: https://go-review.googlesource.com/c/go/+/548036
Reviewed-by: Keith Randall <khr@google.com>
TryBot-Bypass: Cherry Mui <cherryyz@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
5 months agodoc/go1.22: remove stale TODO and comments for vet changes
Cherry Mui [Fri, 8 Dec 2023 20:11:47 +0000 (15:11 -0500)]
doc/go1.22: remove stale TODO and comments for vet changes

They are already mentioned in the Vet section.

For #61422.

Change-Id: I773881df8c6a97263fc3d516e1d38b95679f2693
Reviewed-on: https://go-review.googlesource.com/c/go/+/548480
Reviewed-by: Than McIntosh <thanm@google.com>
TryBot-Bypass: Cherry Mui <cherryyz@google.com>

5 months agodoc/go1.22: fix go test -cover formatting
Cherry Mui [Fri, 8 Dec 2023 20:11:12 +0000 (15:11 -0500)]
doc/go1.22: fix go test -cover formatting

For #61422.

Change-Id: I3591673b55fef35bc429d2e1ce4bc72c0129c03c
Reviewed-on: https://go-review.googlesource.com/c/go/+/548479
Reviewed-by: Than McIntosh <thanm@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

5 months agodoc/go1.22: document additional constants in debug/elf package
Cherry Mui [Fri, 8 Dec 2023 20:02:47 +0000 (15:02 -0500)]
doc/go1.22: document additional constants in debug/elf package

Updates #61974, #63725.
For #61422.

Change-Id: Ifd6c62e877dbd13f0e86fef801fe70d39fb3a66b
Reviewed-on: https://go-review.googlesource.com/c/go/+/548478
Reviewed-by: Than McIntosh <thanm@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

5 months agogo/parser: fix panic in object resolution for invalid type parameter list
Robert Griesemer [Fri, 8 Dec 2023 05:08:17 +0000 (21:08 -0800)]
go/parser: fix panic in object resolution for invalid type parameter list

This change restores the original logic in parseParameterList to what
it was before CL 538858 (which caused the issue), not in exact wording
but in identical semantic meaning, and thus restores this function to
a state that we know was working fine.

However, the change keeps the improved error reporting introduced by
CL 538858. To keep the code changes somewhat minimal as we are close
to RC1, the improved error handling exists twice for now even though
it could be factored out.

Fixes #64534.

Change-Id: I0b7bbf74d28811e8aae74f838f2d424f78af1f38
Reviewed-on: https://go-review.googlesource.com/c/go/+/548395
Reviewed-by: Alan Donovan <adonovan@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>

5 months agocmd/go: relax version regexp from CL 547998
Bryan C. Mills [Fri, 8 Dec 2023 17:20:35 +0000 (12:20 -0500)]
cmd/go: relax version regexp from CL 547998

In CL 547998 I relaxed cmd/go's parsing of version lines to allow it
to recognize clang versions with vendor prefixes. To prevent false-positives,
I added a check for a version 3-tuple following the word "version".
However, it appears that some releases of GCC use only a 2-tuple instead.

Updates #64423.
Fixes #64619.

Change-Id: I5f1d0881b6295544a46ab958c6ad4c2155cf51fe
Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest,gotip-windows-amd64-longtest
Reviewed-on: https://go-review.googlesource.com/c/go/+/548120
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
Run-TryBot: Bryan Mills <bcmills@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

5 months agocmd/internal/obj/arm64: fix invalid register pair for LDP
eric fang [Wed, 6 Dec 2023 03:41:13 +0000 (03:41 +0000)]
cmd/internal/obj/arm64: fix invalid register pair for LDP

ZR register can be used in register pair of LDP, LDPW and LDPSW
instructions, but now it's not allowed. This CL fixes this issue.

Change-Id: I8467502de4664214e0b7dad0295c44f6cff16ee6
Reviewed-on: https://go-review.googlesource.com/c/go/+/547815
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Eric Fang <eric.fang@arm.com>

5 months agocmd/compile: fix error message for mismatch between the number of type params and...
Raghvender [Tue, 21 Nov 2023 01:43:13 +0000 (19:43 -0600)]
cmd/compile: fix error message for mismatch between the number of type params and arguments

Fixes #64276

Change-Id: Ib6651669904e6ea0daf275d85d8bd008b8b21cc6
Reviewed-on: https://go-review.googlesource.com/c/go/+/544018
Reviewed-by: raghvender sundarjee <raghvenders@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

5 months agocmd/compile: fix SCCP propagation into jump tables
Keith Randall [Thu, 7 Dec 2023 19:09:29 +0000 (11:09 -0800)]
cmd/compile: fix SCCP propagation into jump tables

We can't delete all the outgoing edges and then add one back in, because
then we've lost the argument of any phi at the target. Instead, move
the important target to the front of the list and delete the rest.

This normally isn't a problem, because there is never normally a phi
at the target of a jump table. But this isn't quite true when in race
build mode, because there is a phi of the result of a bunch of raceread
calls.

The reason this happens is that each case is written like this (where e
is the runtime.eface we're switching on):

if e.type == $type.int32 {
   m = raceread(e.data, m1)
}
m2 = phi(m1, m)
if e.type == $type.int32 {
   .. do case ..
   goto blah
}

so that if e.type is not $type.int32, it falls through to the default
case. This default case will have a memory phi for all the (jumped around
and not actually called) raceread calls.

If we instead did it like

if e.type == $type.int32 {
  raceread(e.data)
  .. do case ..
  goto blah
}

That would paper over this bug, as it is the only way to construct
a jump table whose target is a block with a phi in it. (Yet.)

But we'll fix the underlying bug in this CL. Maybe we can do the
rewrite mentioned above later.  (It is an optimization for -race mode,
which isn't particularly important.)

Fixes #64606

Change-Id: I6f6e3c90eb1e2638112920ee2e5b6581cef04ea4
Reviewed-on: https://go-review.googlesource.com/c/go/+/548356
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

5 months agoruntime: put runtime.fastrand back temporarily
Russ Cox [Thu, 7 Dec 2023 16:11:01 +0000 (11:11 -0500)]
runtime: put runtime.fastrand back temporarily

Callers should be using math/rand/v2.Uint64 instead,
but there are lots of linkname references to runtime.fastrand
in public code. If we break it all now, that will require people
to use //go:build tags to use rand/v2.Uint64 with Go 1.22
and keep using the linkname for earlier versions.
Instead, leave the linkname working and then we can remove
it in Go 1.24, at which point everyone should be able to use
math/rand/v2.Uint64 unconditionally.

Change-Id: I7287ca4f67c270b009562313661cc28a4c2219a4
Reviewed-on: https://go-review.googlesource.com/c/go/+/548235
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Russ Cox <rsc@golang.org>

5 months agointernal/profile: fully decode proto even if there are no samples
Michael Pratt [Wed, 6 Dec 2023 18:29:03 +0000 (13:29 -0500)]
internal/profile: fully decode proto even if there are no samples

This is a partial revert of CL 483137.

CL 483137 started checking errors in postDecode, which is good. Now we
can catch more malformed pprof protos. However this made
TestEmptyProfile fail, so an early return was added when the profile was
"empty" (no samples).

Unfortunately, this was problematic. Profiles with no samples can still
be valid, but skipping postDecode meant that the resulting Profile was
missing values from the string table. In particular, net/http/pprof
needs to parse empty profiles in order to pass through the sample and
period types to a final output proto. CL 483137 broke this behavior.

internal/profile.Parse is only used in two places: in cmd/compile to
parse PGO pprof profiles, and in net/http/pprof to parse before/after
pprof profiles for delta profiles. In both cases, the input is never
literally empty (0 bytes). Even a pprof proto with no samples still
contains some header fields, such as sample and period type. Upstream
github.com/google/pprof/profile even has an explicit error on 0 byte
input, so `go tool pprof` will not support such an input.

Thus TestEmptyProfile was misleading; this profile doesn't need to
support empty input at all.

Resolve this by removing TestEmptyProfile and replacing it with an
explicit error on empty input, as upstream
github.com/google/pprof/profile has. For non-empty input, always run
postDecode to ensure the string table is processed.

TestConvertCPUProfileEmpty is reverted back to assert the values from
before CL 483137. Note that in this case "Empty" means no samples, not a
0 byte input.

Continue to allow empty files for PGO in order to minimize the chance of
last minute breakage if some users have empty files.

Fixes #64566.

Change-Id: I83a1f0200ae225ac6da0009d4b2431fe215b283f
Reviewed-on: https://go-review.googlesource.com/c/go/+/547996
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
5 months agocmd/go: accept clang versions with vendor prefixes
Bryan C. Mills [Wed, 6 Dec 2023 20:19:59 +0000 (15:19 -0500)]
cmd/go: accept clang versions with vendor prefixes

To better diagnose bugs like this one in the future, I think
we should also refuse to use a C compiler if we can't identify
a sensible version for it. I did not do that in this CL because
I want it to be small and low-risk for possible backporting.

Fixes #64423.

Change-Id: I21e44fc55f6fcf76633e4fecf6400c226a742351
Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest,gotip-windows-amd64-longtest
Reviewed-on: https://go-review.googlesource.com/c/go/+/547998
Auto-Submit: Bryan Mills <bcmills@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
5 months agocmd/go: unset CC when we remove it from PATH in TestScript/cgo_stale_precompiled
Bryan C. Mills [Wed, 6 Dec 2023 14:50:42 +0000 (09:50 -0500)]
cmd/go: unset CC when we remove it from PATH in TestScript/cgo_stale_precompiled

Otherwise, if make.bash produced a relative default CC path but the
user has an absolute path to CC set in their environment, the test
will fail spuriously.

For #64423.

Change-Id: I0f3e1d04851585e1b39266badcda9f17489332d9
Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest,gotip-windows-amd64-longtest
Reviewed-on: https://go-review.googlesource.com/c/go/+/547997
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
Auto-Submit: Bryan Mills <bcmills@google.com>

5 months agocmd/asm: print absolute PC for all patterns "off(PC)" in testEndToEnd
Ruinan [Thu, 30 Nov 2023 07:54:06 +0000 (15:54 +0800)]
cmd/asm: print absolute PC for all patterns "off(PC)" in testEndToEnd

Before this CL, testEndToEnd only turns the relative PC to absolute PC
when pattern "off(PC)" is the suffix of an instruction. But there are
some instructions like:

  ADR 10(PC), R10

it's also acceptable for the assembler while the pattern "off(PC)" is
not a suffix, which makes the test fail.

This CL fixes this issue by searching the pattern in the whole string
instead of only in the suffix.

Change-Id: I0cffedeb7b3c63abca7697671088cf993aff71ff
Reviewed-on: https://go-review.googlesource.com/c/go/+/547235
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ruinan Sun <Ruinan.Sun@arm.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
5 months agoos: document Readlink behavior for relative links
Bryan C. Mills [Mon, 4 Dec 2023 20:32:01 +0000 (15:32 -0500)]
os: document Readlink behavior for relative links

Also provide a runnable example to illustrate that behavior.

This should help users to avoid the common mistake of expecting
os.Readlink to return an absolute path.

Fixes #57766.

Change-Id: I8f60aa111ebda0cae985758615019aaf26d5cb41
Reviewed-on: https://go-review.googlesource.com/c/go/+/546995
Auto-Submit: Bryan Mills <bcmills@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
5 months agodoc/go1.22: document openbsd/ppc64 port
Cherry Mui [Thu, 7 Dec 2023 16:34:35 +0000 (11:34 -0500)]
doc/go1.22: document openbsd/ppc64 port

Updates #56001.
For #61422.

Change-Id: Ie4afbc42191b155d28945bd8f104ad7a63d30db9
Reviewed-on: https://go-review.googlesource.com/c/go/+/547999
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Than McIntosh <thanm@google.com>
5 months agocmd/go: set global .gitconfig location more robustly in tests
Bryan C. Mills [Thu, 7 Dec 2023 15:24:55 +0000 (10:24 -0500)]
cmd/go: set global .gitconfig location more robustly in tests

Also confirm that setting the location actually worked before
proceeding with the rest of the test.

This fixes a test failure with git versions older than 2.32.0.

Updates #53955.
Fixes #64603.

Change-Id: I1a954975a3d8300e8b4dca045d3a15438a0407ec
Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest,gotip-windows-amd64-longtest
Reviewed-on: https://go-review.googlesource.com/c/go/+/548215
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
Run-TryBot: Bryan Mills <bcmills@google.com>

5 months agogo/types, types2: don't print aliased type (in comments) for Alias types
Robert Griesemer [Thu, 7 Dec 2023 00:36:10 +0000 (16:36 -0800)]
go/types, types2: don't print aliased type (in comments) for Alias types

Fixes #64584.

Change-Id: I756d6026d10f130c1dd5026891b7cc3c640d7f78
Reviewed-on: https://go-review.googlesource.com/c/go/+/548135
Reviewed-by: Alan Donovan <adonovan@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>

5 months agodoc: add release notes for changes to encoding/json package
Joe Tsai [Wed, 6 Dec 2023 22:03:17 +0000 (14:03 -0800)]
doc: add release notes for changes to encoding/json package

The escaping of certain control characters has been changed.
The change is compliant with the JSON specification.
The JSON package never promised exactly how JSON formatted
and has historically changed its representation over time.

Change-Id: I8b23f503cfff86c460f642693b50dee24038fb0d
Reviewed-on: https://go-review.googlesource.com/c/go/+/548075
Run-TryBot: Joseph Tsai <joetsai@digital-static.net>
Auto-Submit: Joseph Tsai <joetsai@digital-static.net>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@google.com>
5 months agocmd/go: avoid hard-coding runtime dependencies in TestNewReleaseRebuildsStalePackages...
Bryan C. Mills [Wed, 6 Dec 2023 17:47:32 +0000 (12:47 -0500)]
cmd/go: avoid hard-coding runtime dependencies in TestNewReleaseRebuildsStalePackagesInGOPATH

Fixes #64583.

Change-Id: Idbe50fe77f6030f2402ac436abe6710cb1183730
Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest,gotip-windows-amd64-longtest
Reviewed-on: https://go-review.googlesource.com/c/go/+/547995
Reviewed-by: Russ Cox <rsc@golang.org>
Auto-Submit: Bryan Mills <bcmills@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>