1
0
mirror of https://github.com/golang/go synced 2024-11-17 00:44:46 -07:00
Commit Graph

59044 Commits

Author SHA1 Message Date
Olivier Mengué
2184a39477 runtime/metrics: godoc link fixes
Fix rendering of link to runtime/debug.ReadGCStats in package overview:
as the package is not imported we must specify the absolute package
name.

Change-Id: I123db49eee05e6812427e19873e628b4e4feb203
Reviewed-on: https://go-review.googlesource.com/c/go/+/549735
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Run-TryBot: qiulaidongfeng <2645477756@qq.com>
Reviewed-by: qiulaidongfeng <2645477756@qq.com>
2023-12-21 18:36:41 +00:00
Manlio Perillo
9c01ecce48 doc: fix misspelling in go1.22 release notes
Found by codespell.

Change-Id: I38254f75a8d342a48bbaf6421c681bef7a262dec
Reviewed-on: https://go-review.googlesource.com/c/go/+/551955
Reviewed-by: Jonathan Amsterdam <jba@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Jes Cok <xigua67damn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2023-12-21 17:12:31 +00:00
Cherry Mui
0b56804084 runtime: use racereleasemerge for godebugInc
CL 549796 adds race annotations to godebugInc. It uses racerelease
to model a CompareAndSwap. However, a CompareAndSwap is
essentially a load and a store. Modeling it as just racerelease
makes it not synchronized with other racerelease, i.e. other CAS.
For the following execution

thread         A             B
          load, got nil
                        load, got nil
          set *inc
                        set *inc
          racerelease
          CAS success
                        racerelease
                        CAS fail
                        load
                        raceacquire
                        use *inc (from A)

On thread B, the raceacquire synchronizes with the previous
racerelease, which is not synchronized with racerelease on thread
A, so it doesn't know that the use of *inc on thread B is after
the set on thread A, and will report a race.

Change it to use racereleasemerge, which synchronizes with
previous racerelease and racereleasemerge. So in the case above it
knows thread B's CAS is after thread A's.

Also remove stale comment that was more relevant when the code
used atomic store, where CL 549796 changed to CAS.

Updates #64649.

Change-Id: I17671090a19c0699fcb4e6481e2abd98ef2e5542
Reviewed-on: https://go-review.googlesource.com/c/go/+/551856
Reviewed-by: Mauri de Souza Meneguzzo <mauri870@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
2023-12-21 14:47:40 +00:00
Keith Randall
f6509cf5cd cmd/compile: handle constant-folding of an out-of-range jump table index
The input index to a jump table can be out of range for unreachable code.

Dynamically the compiler ensures that an out-of-range index can never
reach a jump table, but that guarantee doesn't extend to the static
realm.

Fixes #64826

Change-Id: I5829f3933ae5124ffad8337dfd7dd75e67a8ec33
Reviewed-on: https://go-review.googlesource.com/c/go/+/552055
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
2023-12-21 00:15:58 +00:00
Tim King
adec22b9f7 doc/go1.22: document changes to vet loopclosure analyzer
cmd/vet no longer reports loopclosure bugs within files built at
GoVersion>=1.22.

For #61422.

Change-Id: I6f29373bb236822ece4e7ae35914859538b8d57b
Reviewed-on: https://go-review.googlesource.com/c/go/+/551376
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Run-TryBot: Tim King <taking@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2023-12-20 18:38:20 +00:00
Robert Griesemer
a2a2c5b947 doc: update unsafe.Pointer rule in spec
The valid conversions consider the core types of operands, not just
their underlying type.

This also explains the valid arguments for unsafe.Slice which are
explained in terms of unsafe.Pointer conversions.

unsafe.SliceData simply refers to "slice argument" and we use
similar terminology elsewhere in the spec to denote values that
have a core type of slice (or any other type for that matter).
Leaving alone for now.

Fixes #64452.

Change-Id: I0eed3abbc0606f22358835e5d434f026fe0909c8
Reviewed-on: https://go-review.googlesource.com/c/go/+/551379
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Bypass: Robert Griesemer <gri@google.com>
2023-12-20 02:18:50 +00:00
Roland Shoemaker
35222eeb78 doc: add html/template release note
Updates #61422

Change-Id: Ie86e8545d55cfd0898d21387d8b48d9392f85bf0
Reviewed-on: https://go-review.googlesource.com/c/go/+/551335
Reviewed-by: Carlos Amedee <carlos@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2023-12-19 16:39:05 +00:00
Than McIntosh
03242506de 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>
2023-12-19 15:55:00 +00:00
Bryan C. Mills
9dd1cde9ac 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>
2023-12-19 15:51:46 +00:00
Bryan C. Mills
22284c34f2 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>
2023-12-19 15:51:37 +00:00
Carlos Amedee
339177aa31 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>
2023-12-19 15:13:06 +00:00
Russ Cox
52dbffeac8 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 e44b8b15b1.

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>
2023-12-19 14:42:39 +00:00
Jonathan Amsterdam
1d4b0b6236 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>
2023-12-19 11:08:11 +00:00
Robert Griesemer
6fe0d3758b 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>
2023-12-19 04:39:56 +00:00
Guoqi Chen
90daaa0576 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>
2023-12-19 00:06:00 +00:00
Than McIntosh
5b84d50038 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>
2023-12-18 23:35:19 +00:00
Filippo Valsorda
4106de901a 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>
2023-12-18 23:29:17 +00:00
Filippo Valsorda
7383b2a4db 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>
2023-12-18 23:29:10 +00:00
Than McIntosh
c564d4ae08 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>
2023-12-18 21:30:58 +00:00
Tim King
7058f09a8b 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>
2023-12-18 21:28:13 +00:00
qmuntal
761e10be88 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>
2023-12-18 20:26:46 +00:00
Russ Cox
450f5d90c2 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>
2023-12-18 20:06:05 +00:00
Irakli Safareli
08bec0db39 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: c773abb75c
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>
2023-12-18 19:42:41 +00:00
Mauri de Souza Meneguzzo
2acbdd086d 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: 60bd64a8fb
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>
2023-12-18 19:22:04 +00:00
Bryan C. Mills
a7097243e4 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>
2023-12-18 19:20:32 +00:00
Michael Anthony Knyszek
8e3930f258 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>
2023-12-18 17:42:38 +00:00
Michael Pratt
9b4b3e5acc 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>
2023-12-15 22:00:45 +00:00
Jes Cok
793097161b all: fix copyright headers
Change-Id: Ib16986fb088030b93140e48c17e3d7bb2c9312cf
GitHub-Last-Rev: 41572879f8
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>
2023-12-15 21:57:36 +00:00
Keith Randall
f8170cc017 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>
2023-12-15 20:51:01 +00:00
David Chase
3313bbb405 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>
2023-12-15 20:30:44 +00:00
Keith Randall
b60bf8f8e1 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>
2023-12-15 19:35:21 +00:00
Roland Shoemaker
5e939b3a9c 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>
2023-12-15 18:30:29 +00:00
Russ Cox
d73b4322ed 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>
2023-12-14 22:24:40 +00:00
Bryan C. Mills
e44b8b15b1 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>
2023-12-14 20:10:04 +00:00
Bryan C. Mills
7c282ba12a 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>
2023-12-14 19:59:55 +00:00
Bryan C. Mills
6aa482681c 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).

¹ff6a37c99e

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>
2023-12-14 19:46:23 +00:00
Andy Pan
23fee06a14 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>
2023-12-14 18:21:21 +00:00
qiulaidongfeng
2f706871b9 runtime: delete todo of the list field for mspan
Change-Id: I10a3308c19da08d2ff0c8077bb74ad888ee04fea
GitHub-Last-Rev: 3e95b71384
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>
2023-12-14 18:21:15 +00:00
Davis Goodin
d2867b29c2 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>
2023-12-14 18:20:06 +00:00
qmuntal
6396a42b99 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>
2023-12-14 18:17:36 +00:00
cui fliter
3b55377394 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>
2023-12-14 18:17:28 +00:00
Danil Timerbulatov
527829a7cb 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>
2023-12-14 17:22:18 +00:00
Dmitri Shuralyov
5f48662c5a 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>
2023-12-14 16:00:05 +00:00
Than McIntosh
d1a186d7d0 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>
2023-12-14 14:30:32 +00:00
Robert Griesemer
6146a73d27 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>
2023-12-13 22:57:57 +00:00
Tolya Korniltsev
d95e25e83c 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>
2023-12-13 20:40:52 +00:00
Robert Griesemer
cc5ccd71ef 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>
2023-12-13 20:38:46 +00:00
Robert Griesemer
0b3dd75f6c 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>
2023-12-13 17:54:56 +00:00
Mauri de Souza Meneguzzo
f2d243db8f 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: 7c1f19238d
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>
2023-12-13 16:20:09 +00:00
Robert Griesemer
58c28ba286 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>
2023-12-13 14:32:38 +00:00