1
0
mirror of https://github.com/golang/go synced 2024-09-28 21:34:30 -06:00
Commit Graph

56876 Commits

Author SHA1 Message Date
Ian Lance Taylor
ccc42b0f91 doc/go1.21: document clear builtin and init order changes
Also move all the language changes to the same part of the release notes.

For #56351
For #57411

Change-Id: Id1c51b5eb8f7d85e61a2ae44ee7d73bb13036631
Reviewed-on: https://go-review.googlesource.com/c/go/+/498755
TryBot-Bypass: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
2023-05-27 02:02:49 +00:00
Michael Pratt
3824d3d71e cmd/go: always track visited packages in setPGOProfilePath
Currently we only track visited (copied) packages when a copy is
required. When a copy is not required, we will rewalk each package's
entire dependency graph every time we see it, which is terribly
inefficient.

Pull the visited package check up a level so that we visit packages only
once regardless of how many times they are visited.

Fixes #60455.
Fixes #60428.

Change-Id: I4e9b31eeeaa170db650c461a5de2ca984b9aba0f
Reviewed-on: https://go-review.googlesource.com/c/go/+/498735
Run-TryBot: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
2023-05-27 00:39:39 +00:00
Ian Lance Taylor
6e248b8ff2 doc/go1.21: mention os package changes
Also mention WTF-8 support in the syscall package.

For #32558
For #58977
For #59971

Change-Id: Id1627889b5e498add498748d9bfc69fb58030b35
Reviewed-on: https://go-review.googlesource.com/c/go/+/498600
Reviewed-by: Eli Bendersky <eliben@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
2023-05-26 23:40:46 +00:00
Ian Lance Taylor
c2bb350d80 doc/go1.21: mention changes to the reflect package
Added Value.Clear, deprecated SliceHeader and StringHeader.

For #55002
For #56906

Change-Id: Ib7497aff830d56fad90c31ec28596e71a448e9ce
Reviewed-on: https://go-review.googlesource.com/c/go/+/498757
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Eli Bendersky <eliben@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
2023-05-26 23:31:44 +00:00
Ian Lance Taylor
dcb27e8a66 doc/go1.21: mention regexp.MarshalText and UnmarshalText
For #46159

Change-Id: Ia9cc0827a89d362532d1a662b791de8eebbfb2fe
Reviewed-on: https://go-review.googlesource.com/c/go/+/498756
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Eli Bendersky <eliben@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
2023-05-26 23:31:22 +00:00
Matthew Dempsky
260a9b0a07 all: update vendored dependencies
Generated with x/build/cmd/updatestd.

Updates #36905.

Change-Id: Iecd76e820c5f40a0f5e013684f7e7bef4c3fd482
Reviewed-on: https://go-review.googlesource.com/c/go/+/498598
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
2023-05-26 22:45:40 +00:00
Ian Lance Taylor
699a6bfbfc doc/go1.21: remove TODOs for x/ repos
Remove x/ repos changes that aren't part of the 1.21 release.

Change-Id: Ia5cbf02ed6c0cc4dc0ff80d68403723b3f9ae0ba
Reviewed-on: https://go-review.googlesource.com/c/go/+/498596
Run-TryBot: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2023-05-26 21:29:06 +00:00
Dmitri Shuralyov
142b012e94 cmd/internal/testdir: stop manually adding GOROOT/bin to PATH
The go command already places $GOROOT/bin at the beginning of $PATH in
the test's environment as of Go 1.19¹, so there's no need for the test
to do it anymore. Start enjoying yet another benefit of using 'go test'.

¹ See go.dev/issue/57050.

For #56844.

Change-Id: If7732cd8b8979eabf185485d3c73858a4e546d69
Reviewed-on: https://go-review.googlesource.com/c/go/+/498271
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2023-05-26 20:41:52 +00:00
Than McIntosh
d8782e7061 cmd/go: remove stray reference to mkalldocs.sh
Clean up a stray reference in the docs to 'mkalldocs.sh', which no
longer exists (was replaced by a Go program, in 676794f73e).

Change-Id: I058e86395b14756d7afc184f99f89dbc5ba0184e
Reviewed-on: https://go-review.googlesource.com/c/go/+/498715
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Than McIntosh <thanm@google.com>
Auto-Submit: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2023-05-26 20:14:26 +00:00
Alan Donovan
869af57260 doc: release notes for my humble contributions to go1.21
Updates #58645

Change-Id: Ieb4e6062613e26826ba8373cb4c2fd9198d0c692
Reviewed-on: https://go-review.googlesource.com/c/go/+/496116
Reviewed-by: Eli Bendersky <eliben@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Alan Donovan <adonovan@google.com>
TryBot-Bypass: Eli Bendersky <eliben@google.com>
2023-05-26 18:02:00 +00:00
Chris O'Hara
7756f82590 syscall: implement wasip1 Fcntl
CL 494915 broke non-blocking I/O on wasip1 for files
opened with os.NewFile. This is fixed by providing an
implementation of fcntl(F_GETFL) for wasip1.

Change-Id: I78979076b95495fd4b94814552e5f5b043270cd0
Reviewed-on: https://go-review.googlesource.com/c/go/+/498195
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Achille Roussel <achille.roussel@gmail.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
2023-05-26 17:59:52 +00:00
Johan Brandhorst-Satzkorn
188066cfbc misc/wasm: set PATH variable in exec
The PATH variable is required to run the testenv tests.
Set it for all the runtime invocations where we don't
already set it by inheriting from the environment.

For #59583
For #59907
For #60097

Change-Id: If582dd8f086e3f40bc58d555f6034dcffe6f8e5f
Reviewed-on: https://go-review.googlesource.com/c/go/+/498616
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>
2023-05-26 17:21:14 +00:00
Ian Lance Taylor
c2633dfe77 doc/go1.21: mention syscall package changes
One of the changes also affects the os package, so mention it
there too.

For #46259

Change-Id: I8041a5ce009725ab210118ee668fc94196d9ff82
Reviewed-on: https://go-review.googlesource.com/c/go/+/498376
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Eli Bendersky <eliben@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
2023-05-26 17:09:12 +00:00
Ian Lance Taylor
1ff89009f1 io: clarify that Read(nil) can return 0, EOF
Fixes #40385

Change-Id: I965b5db985fd4418a992e883073cbc8309b2cb88
Reviewed-on: https://go-review.googlesource.com/c/go/+/498355
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
2023-05-26 17:03:12 +00:00
Than McIntosh
13be9fa7f8 doc: add release note on dead global map variable deletion
Add a short release note blurb on linker dead-coding of global map
variables.

Updates #58645.

Change-Id: Ibfdd3e2b2b78517db4245b1d7eedd5e75a643b47
Reviewed-on: https://go-review.googlesource.com/c/go/+/498575
Reviewed-by: Eli Bendersky <eliben@google.com>
TryBot-Bypass: Than McIntosh <thanm@google.com>
2023-05-26 16:21:12 +00:00
Austin Clements
76bb0caa5c runtime: delete a very stale comment
This comment claims mark termination re-scans stacks and uses the
write barrier to determine how much of the stack needs to be
rescanned. This hasn't been true since we introduced the hybrid write
barrier and deleted stack rescanning with CL 31766 in Go 1.8.

Updates #17503 I suppose.

Change-Id: I5e90f25020c9fa6f146ec6ed0642ba2b4884c2a8
Reviewed-on: https://go-review.googlesource.com/c/go/+/498435
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Michael Knyszek <mknyszek@google.com>
2023-05-26 16:19:30 +00:00
Dmitri Shuralyov
4c1d8bf54b cmd/go/internal/modget: remove unused base.Errorf argument
Found by the vet check that runs with 'go test cmd/go/internal/modget'.

For #57001.
For #60463.

Change-Id: I4be94f7156724459a5c47bb9745cbb5651fb972c
Reviewed-on: https://go-review.googlesource.com/c/go/+/498270
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
Auto-Submit: Dmitri Shuralyov <dmitshur@google.com>
2023-05-26 16:17:40 +00:00
Damien Neil
a4cd36500b crypto/tls: avoid referencing potentially unused symbols in init
A reference to a function in a "var _ = ..." init-time
initialization keeps the symbol live. Move references to
Config.EncryptTicket and Config.DecryptTicket into tests.
These references increase the size of an unused import of
crypto/tls by about 1MiB.

Change-Id: I6d62a6dcbd73e22972a217afcda7395e909b52cc
Reviewed-on: https://go-review.googlesource.com/c/go/+/498595
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Run-TryBot: Damien Neil <dneil@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2023-05-26 15:24:38 +00:00
Ian Lance Taylor
f89d575d9e doc/go1.21: mention new go test -fullpath option
For #37708

Change-Id: I7b04d6331c15771c7d74ff77afd523c435e0dafe
Reviewed-on: https://go-review.googlesource.com/c/go/+/498396
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Auto-Submit: Eli Bendersky <eliben@google.com>
Reviewed-by: Eli Bendersky <eliben@google.com>
2023-05-26 13:43:41 +00:00
Dan Peterson
f90b4cd655 doc: fill out net/http.ErrSchemeMismatch note
For #44855

Change-Id: I517394b227ea948ed3e1f9ffdaab2bb2676863c8
Reviewed-on: https://go-review.googlesource.com/c/go/+/496795
TryBot-Bypass: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
2023-05-26 03:21:41 +00:00
Brad Fitzpatrick
145eec8768 database/sql: fix regression from earlier RawBytes fix
The earlier CL 497675 for #60304 introduced a behavior change
that, while not strictly a bug, caused a bunch of test failures
in a large codebase. Rather than add behavior changes in a 10 year
old package, revert to the old behavior: a context cancelation
between Rows.Next reporting false and a call to Rows.Err should
not result in Rows.Err returning the context error.

That behavior was accidentally added in CL 497675 as part of changing
how contexts and Rows iteration worked.

Updates #60304
Updates #53970

Change-Id: I22f8a6a6b0b5a94b430576cf50e015efd01ec652
Reviewed-on: https://go-review.googlesource.com/c/go/+/498398
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2023-05-26 03:06:19 +00:00
Robert Griesemer
f0e356a07d doc: add release notes for new min/max built-ins
For #59488.

Change-Id: Iefabb06014767c5f633082a112a81e9ff5f09a30
Reviewed-on: https://go-review.googlesource.com/c/go/+/498397
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
TryBot-Bypass: Robert Griesemer <gri@google.com>
2023-05-25 22:02:08 +00:00
Russ Cox
cfe8b43b1f cmd/go: show full path name (testdata/script/foo.txt) in script errors
Showing the full path (relative to the current directory)
instead of just foo.txt lets editors that understand file:line
jump straight to the file without having to edit it to say
testdata/script/ first.

Change-Id: I44177b687249f3c7c724b45d02f5167607369e1b
Reviewed-on: https://go-review.googlesource.com/c/go/+/498119
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Russ Cox <rsc@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
2023-05-25 21:49:42 +00:00
Ian Lance Taylor
ee6b9dd47f doc/go1.21: merge x/exp/slices issue into slices package
For #57348

Change-Id: I84943711b033d63f0993133f93d9f09ce2af5965
Reviewed-on: https://go-review.googlesource.com/c/go/+/498395
Reviewed-by: Eli Bendersky <eliben@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
2023-05-25 21:41:53 +00:00
Robert Griesemer
1dd24d8216 go/types, types2: don't infer type argument for unused parameter in interfaces
Two interface types that are assignable don't have to be identical;
specifically, if they are defined types, they can be different
defined types. If those defined types specify type parameters which
are never used, do not infer a type argument based on the instantiation
of a matching defined type.

Adjusted three existing tests where we inferred type arguments incorrectly.

Fixes #60377.

Change-Id: I91fb207235424b3cbc42b5fd93eee619e7541cb7
Reviewed-on: https://go-review.googlesource.com/c/go/+/498315
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2023-05-25 21:37:01 +00:00
Robert Griesemer
f9d114d0e8 spec: document min and max built-ins
For #59488.

Change-Id: I50f65216bf02b42c1e0619702833f4a6dbed8925
Reviewed-on: https://go-review.googlesource.com/c/go/+/498136
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Bypass: Robert Griesemer <gri@google.com>
2023-05-25 21:09:38 +00:00
Eli Bendersky
01b5cce626 doc: add release notes for additions to the slices package
Updates #60091

Change-Id: I7438811f4e41a2977acbb5ac74c22a02c28c6597
Reviewed-on: https://go-review.googlesource.com/c/go/+/498175
Reviewed-by: Eli Bendersky <eliben@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Eli Bendersky‎ <eliben@golang.org>
Run-TryBot: Eli Bendersky‎ <eliben@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2023-05-25 21:01:03 +00:00
Michael Matloob
11bb2922fb cmd/go: fix reporting of test cycles to have proper order
and begin and end with the same package to demonstrate the cyclical
nature of the stack. Also fix the list_test_cycle script test
which was testing for the wrong behavior.

Fixes #59970

Change-Id: I3b3ee6762ee121fec19688ff1823cdfddae94f53
Reviewed-on: https://go-review.googlesource.com/c/go/+/498115
Reviewed-by: Michael Matloob <matloob@golang.org>
Run-TryBot: Michael Matloob <matloob@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2023-05-25 19:18:23 +00:00
Russ Cox
789701e93a runtime: change heapObjectsCanMove to a func
A var is problematic because the zero value is already false,
so if it goes away, it will appear to be false.
I'm also not sure about go:linkname on vars,
so switch to func for both reasons.

Also add a test.

Change-Id: I2318a5390d98577aec025152e65543491489defb
Reviewed-on: https://go-review.googlesource.com/c/go/+/498261
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
2023-05-25 18:35:49 +00:00
Russ Cox
82d5ebce96 cmd/go: rename gover.ToolchainVersion to gover.FromToolchain
Suggested by bcmills in CL 497555 review but easier to do at the
top of the stack.

For #57001.

Change-Id: I6f2cc0f546e8d6b1e03c7335a89f07dcb45cf5b6
Reviewed-on: https://go-review.googlesource.com/c/go/+/498077
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
Auto-Submit: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
2023-05-25 17:52:18 +00:00
Russ Cox
4c028edffa cmd/go: avoid duplicate errors in module load
Just a missing base.ExitIfErrors.

Fixes #46160.

Change-Id: I41949b0b7b036da94ba269220951677585d3f8e9
Reviewed-on: https://go-review.googlesource.com/c/go/+/498122
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
Auto-Submit: Russ Cox <rsc@golang.org>
2023-05-25 17:51:34 +00:00
Russ Cox
e8c6003023 cmd/go: expand acceptable toolchains a bit
Allow both prefix-goVERSION and goVERSION-suffix for custom toolchains.
Also make sure that a tie in the toolchain and min version goes to the
toolchain line.

For #57001.

Change-Id: Ibeea5f47db7349cfdf36da188bb43e195e196f5b
Reviewed-on: https://go-review.googlesource.com/c/go/+/498076
Auto-Submit: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2023-05-25 17:51:31 +00:00
Russ Cox
ff07c540b1 cmd/go: add go get go@version and toolchain@version
go get go@version and toolchain@version updates the
go and toolchain lines in go.mod. If toolchain ends up <= go,
it is dropped.

When the go version crosses certain version boundaries,
it may be necessary to run 'go mod tidy -go=version'.
That's left for a followup CL.

When the go or toolchain version ends up higher than the
current toolchain version, we cannot be sure we know how
to write the file out, so we fail with an error message.
In GOTOOLCHAIN auto mode, the newer toolchain should
be downloaded and reinvoked; that's left for a followup CL too.

For #57001.

Change-Id: Ibfdcc549b40555a53bdb2d019816d18f1bd16be6
Reviewed-on: https://go-review.googlesource.com/c/go/+/497081
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
2023-05-25 17:51:28 +00:00
Russ Cox
aa99c4d292 cmd/go: handle queries properly in go install m@v
The original code only handled go install m@v1.0.0
but not queries like go install m@v1 or m@master.
Handle those by invoking more of the module machinery.

For #57001.

Change-Id: I7d54fc3dd65072e5906a17ff95b407b0f7feac69
Reviewed-on: https://go-review.googlesource.com/c/go/+/497879
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
Auto-Submit: Russ Cox <rsc@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
2023-05-25 17:34:01 +00:00
Russ Cox
a5be6dbbaf cmd/go: refuse to download zip files for too-new modules
In general an older version of Go does not know how to construct
a module written against a newer version of Go: the details may
change over time, such as for issues like #42965 (an ignore mechanism).

For #57001.

Change-Id: Id43fcfb71497375ad2eb5dfd292bad0adca0652e
Reviewed-on: https://go-review.googlesource.com/c/go/+/497795
Run-TryBot: Russ Cox <rsc@golang.org>
Auto-Submit: Russ Cox <rsc@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2023-05-25 17:07:09 +00:00
Austin Clements
f4086d3686 cmd/dist: drop wasitest from special list
CL 498255 made runtime/internal/wasitest compatible with all platforms
so that "go test std" works again. This means it no longer has to be
in the special dist test list.

While we're here explain the purpose of this list better and implore
people to please not expand it, since almost any addition is a sign
that "go test std cmd" no longer works.

Change-Id: I31c7fb767787fa587f65c2697aed9ed43e95fb18
Reviewed-on: https://go-review.googlesource.com/c/go/+/498256
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Austin Clements <austin@google.com>
2023-05-25 15:34:13 +00:00
Russ Cox
d23669db7d all: fix buildall.bash
Disable the android and ios builds since cross-compiling fails there.
Also make runtime/internal/wasitest not build on systems that don't
have syscall.Mkfifo for it to use (including, ironically, wasm itself).

Change-Id: I28eb1f216f9952f81a107056e97ee38e350f9287
Reviewed-on: https://go-review.googlesource.com/c/go/+/498255
Reviewed-by: Austin Clements <austin@google.com>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
2023-05-25 14:37:57 +00:00
Olivier Mengué
fc5c590d8d errors: add godoc links
Change-Id: I766e656e6b967290d692313ea1391878fc21c92d
Reviewed-on: https://go-review.googlesource.com/c/go/+/497375
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
2023-05-25 13:20:16 +00:00
Russ Cox
055c186f53 runtime: add heapObjectsCanMove
heapObjectsCanMove is always false in the current garbage collector.
It exists for go4.org/unsafe/assume-no-moving-gc, which is an
unfortunate idea that had an even more unfortunate implementation.
Every time a new Go release happened, the package stopped building,
and the authors had to add a new file with a new //go:build line, and
then the entire ecosystem of packages with that as a dependency had to
explicitly update to the new version. Many packages depend on
assume-no-moving-gc transitively, through paths like
inet.af/netaddr -> go4.org/intern -> assume-no-moving-gc.
This was causing a significant amount of friction around each new
release, so we added this bool for the package to //go:linkname
instead. The bool is still unfortunate, but it's not as bad as
breaking the ecosystem on every new release.

If the Go garbage collector ever does move heap objects, we can set
this to true to break all the programs using assume-no-moving-gc.

Change-Id: I06c32bf6ccc4601c8eef741d7382b678aada3508
Reviewed-on: https://go-review.googlesource.com/c/go/+/498121
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
2023-05-25 13:00:06 +00:00
Roland Shoemaker
6f7824f7a4 crypto/internal/bigmod: don't panic on NewModulusFromBig(0)
Return an error instead. Makes usages of NewModulusFromBig a bit more
verbose, but better than returning nil or something and just moving the
panic down the road.

Fixes #60411

Change-Id: I10732c6ce56ccd9e4769281cea049dd4beb60a6e
Reviewed-on: https://go-review.googlesource.com/c/go/+/498035
Auto-Submit: Roland Shoemaker <roland@golang.org>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Roland Shoemaker <roland@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
2023-05-25 01:01:41 +00:00
Monis Khan
20e08fe68c crypto/tls: advertise correct ciphers in TLS 1.3 only mode
This change updates the makeClientHello logic to only advertise TLS
1.3 ciphers when tls.Config.MinVersion is set to tls.VersionTLS13
(i.e the client only supports TLS 1.3).  Previously, TLS 1.2 ciphers
would be included in the client hello message.

Fixes #57771

Change-Id: Ife4123037b0a4609578ffffb1cdf1e1d4e0a8df6
GitHub-Last-Rev: 45f4275aa9
GitHub-Pull-Request: golang/go#49293
Reviewed-on: https://go-review.googlesource.com/c/go/+/360794
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Run-TryBot: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Marten Seemann <martenseemann@gmail.com>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
2023-05-25 01:01:27 +00:00
Russ Cox
d5a05a0510 cmd/go: clear HGRCPATH in script test
Invoking 'hg' in a nonexistant HOME can break extensions the user
may have installed; clear HGRCPATH in the script test to keep tests
working in that environment.

Change-Id: I4d21d024c6229ead38e5f24186883863511fd483
Reviewed-on: https://go-review.googlesource.com/c/go/+/497878
Reviewed-by: Bryan Mills <bcmills@google.com>
Auto-Submit: Russ Cox <rsc@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
2023-05-25 00:56:18 +00:00
Brad Fitzpatrick
558301a5cb cmd/go: abstract build cache, support implementations via child process
Via setting GOCACHEPROG to a binary which speaks JSON over
stdin/stdout.

For now, it requires GOEXPERIMENT=cacheprog.

Fixes golang/go#59719

Change-Id: I824ff04d5ebdf0ba4d1b5bc2e9fbaee26d34c80f
Reviewed-on: https://go-review.googlesource.com/c/go/+/486715
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2023-05-25 00:49:37 +00:00
Filippo Valsorda
d4bd855cfb crypto/tls: don't reverify but check certificate expiration on resumption
We used to inconsistently run certificate verification on the server on
resumption, but not on the client. This made TLS 1.3 resumption pretty
much useless, as it didn't save bytes, CPU, or round-trips.

This requires serializing the verified chains into the session ticket,
so it's a tradeoff making the ticket bigger to save computation (and for
consistency).

The previous behavior also had a "stickyness" issue: if a ticket
contained invalid certificates, they would be used even if the client
had in the meantime configured valid certificates for a full handshake.

We also didn't check expiration on the client side on resumption if
InsecureSkipVerify was set. Again for consistency, we do that now.

Also, we used to run VerifyPeerCertificates on resumption even if
NoClientCerts was set.

Fixes #31641

Change-Id: Icc88269ea4adb544fa81158114aae76f3c91a15f
Reviewed-on: https://go-review.googlesource.com/c/go/+/497895
Reviewed-by: Damien Neil <dneil@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
2023-05-25 00:14:50 +00:00
Filippo Valsorda
b267db08b2 crypto/tls: add VersionName
Fixes #46308

Change-Id: I5162b26cbce61ae5df5d2e093cf8a28406d15863
Reviewed-on: https://go-review.googlesource.com/c/go/+/497377
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Marten Seemann <martenseemann@gmail.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Samuli Silvius <samuli.silvius@gmail.com>
Reviewed-by: Damien Neil <dneil@google.com>
Run-TryBot: Filippo Valsorda <filippo@golang.org>
2023-05-25 00:13:32 +00:00
Filippo Valsorda
4406ed6d4e crypto/tls: implement Extended Master Secret
All OpenSSL tests now test operation with EMS. To test a handshake
*without* EMS we need to pass -Options=-ExtendedMasterSecret which is
only available in OpenSSL 3.1, which breaks a number of other tests.

Updates #43922

Change-Id: Ib9ac79a1d03fab6bfba5fe9cd66689cff661cda7
Reviewed-on: https://go-review.googlesource.com/c/go/+/497376
Run-TryBot: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
2023-05-25 00:13:30 +00:00
Filippo Valsorda
869da4a2a4 crypto/tls: add QUIC 0-RTT APIs
Fixes #60107

Change-Id: I158b1c2d80d8ebb5ed7a8e6f313f69060754e220
Reviewed-on: https://go-review.googlesource.com/c/go/+/496995
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Run-TryBot: Filippo Valsorda <filippo@golang.org>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
2023-05-25 00:13:28 +00:00
Chris O'Hara
a17de43ef1 net: implement wasip1 FileListener and FileConn
Implements net.FileListener and net.FileConn for wasip1.

net.FileListener can be used with a pre-opened socket. If the WASM
module knows the file descriptor, a listener can be constructed with:

    l, err := net.FileListener(os.NewFile(fd, ""))

If the WASM module does not know the file descriptor, but knows that at
least one of the preopens is a socket, it can find the file descriptor
and construct a listener like so:

    func findListener() (net.Listener, error) {
        // We start looking for pre-opened sockets at fd=3 because 0, 1,
        // and 2 are reserved for stdio. Pre-opened directories also
        // start at fd=3, so we skip fds that aren't sockets. Once we
        // reach EBADF we know there are no more pre-opens.
        for preopenFd := uintptr(3); ; preopenFd++ {
            l, err := net.FileListener(os.NewFile(preopenFd, ""))

            var se syscall.Errno
            switch errors.As(err, &se); se {
            case syscall.ENOTSOCK:
                continue
            case syscall.EBADF:
                err = nil
            }
            return l, err
        }
    }

A similar strategy can be used with net.FileConn and pre-opened
connection sockets.

The wasmtime runtime supports pre-opening listener sockets:

    $ wasmtime --tcplisten 127.0.0.1:8080 module.wasm

Change-Id: Iec6ae4ffa84b3753cce4f56a2817e150445db643
Reviewed-on: https://go-review.googlesource.com/c/go/+/493358
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Bypass: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>
Auto-Submit: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2023-05-25 00:12:41 +00:00
Chris O'Hara
c5c2184538 runtime: implement wasip1 netpoll
Implements netpoll using WASI's poll_oneoff system call.

This enables non-blocking I/O support for wasip1.

Change-Id: Ie395fa49d651c8b8262d485e2847dd65b0a10bc6
Reviewed-on: https://go-review.googlesource.com/c/go/+/493357
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>
Reviewed-by: Julien Fabre <ju.pryz@gmail.com>
Auto-Submit: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
2023-05-25 00:12:40 +00:00
Sean Liao
04c628935d encoding/json: document unsupported float values
Fixes #59627

Change-Id: Icd6a9803e213596de6136ec980b0a352c450e6f7
Reviewed-on: https://go-review.googlesource.com/c/go/+/496142
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2023-05-25 00:04:56 +00:00