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

57176 Commits

Author SHA1 Message Date
Russ Cox
5db1e99bbd doc/go1.21: document forward and backward compatibility
Also handle go test -c TODO.

For #15513.
For #56986.
For #57001.

Change-Id: I571ae25d8d8fcd44cb38ac16cdd2a1180016eb94
Reviewed-on: https://go-review.googlesource.com/c/go/+/500956
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: David Chase <drchase@google.com>
2023-06-05 19:18:05 +00:00
Michael Pratt
1b9c721f8f runtime: skip another GDB "no such process" case
Fixes #58698.
For #50838.

Change-Id: I043c59a57707e64d444cd687f9745bf5313fb7cc
Reviewed-on: https://go-review.googlesource.com/c/go/+/500959
Run-TryBot: Michael Pratt <mpratt@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
2023-06-05 19:03:34 +00:00
Russ Cox
eb413f7bcd doc/go1.21: move Ports to end
The most important parts of almost any release notes are the
language and tool changes. Those should be the first two sections.
Instead Ports interrupts the flow with information that usually
matters only to very few users.

Move Ports to the end of the release notes.

Change-Id: I78492e91e368184fb5f8e8d44d63f35b8f14eeae
Reviewed-on: https://go-review.googlesource.com/c/go/+/500957
TryBot-Bypass: Russ Cox <rsc@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2023-06-05 18:24:28 +00:00
Alessandro Arzilli
d8c9eece28 runtime: add debugger hook for fatal signals
On Go <= 1.20 signals that caused the program to exit would eventually
call runtime.fatal. After the changes made in go.dev/cl/462437 but it
would still be nice if debuggers (eg. Delve) had a function they could
hook to intercept fatal signals.

Change-Id: Icf2b65187f95d52e60825c84f386806a75b38f6e
Reviewed-on: https://go-review.googlesource.com/c/go/+/495736
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Hyang-Ah Hana Kim <hyangah@gmail.com>
Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2023-06-05 17:00:46 +00:00
Tobias Klauser
587c1c191a doc/go1.21: fix link in debug/elf section
Change-Id: Ief3e263e6c11069abbbf4dd8ce10c317e3a1cab2
Reviewed-on: https://go-review.googlesource.com/c/go/+/500815
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: David Chase <drchase@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
2023-06-05 16:41:14 +00:00
Cherry Mui
6dd3bfbed6 runtime: move Segv and TgkillSegv to testprog
The non-cgo test points Segv and TgkillSegv are currently in
testprogcgo. Although the test points don't explicitly use cgo,
being a cgo program, there is still some C code that runs when
the test point is invoked, such as thread creation code.

For the cgo test points, sometimes we fail to unwind the stack if
C code is involved. For the non-cgo ones, we want to always be
able to unwind the stack, so we check for stack unwinding failures.
But if a signal is landed in the small piece of C code mentioned
above, we may still fail to unwind. Move the non-cgo test points
to a pure-Go program to avoid this problem.

May fix #52963.
Updates #59029, #59443, #59492.

Change-Id: I35d99a0dd4c7cdb627e2083d2414887a24a2822d
Reviewed-on: https://go-review.googlesource.com/c/go/+/500535
Reviewed-by: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Cherry Mui <cherryyz@google.com>
2023-06-05 15:24:08 +00:00
Roland Shoemaker
96b79bd320 syscall: don't panic when argv is nil on freebsd
The workaround in CL 69970044 introduced a panic when StartProcess is
called with empty argv. Check the length before trying to access it.

Change-Id: Ic948d86c7067a21c484ba24e100d1f1f80179730
Reviewed-on: https://go-review.googlesource.com/c/go/+/500415
Run-TryBot: Roland Shoemaker <roland@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2023-06-05 15:22:32 +00:00
Robert Griesemer
05293d6b49 go/types, types2: fix incorrect logic in assignability check
Do not return prematurely in assignableTo.

Fixes #54424.

Change-Id: I769b3b4ad9d79b7bce60b92cc59c3564117e36db
Reviewed-on: https://go-review.googlesource.com/c/go/+/498400
Run-TryBot: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2023-06-05 14:01:09 +00:00
Cuong Manh Le
96d16803c2 cmd/compile: allow ir.OMIN/ir.OMAX in mayCall
CL 496257 adds min/max builtins, which may appear as argument to a
function call, so it will be tested by mayCall. But those ops are not
handled by mayCall, causes the compiler crashes.

Fixes #60582

Change-Id: I729f10bf62b4aad39ffcb1433f576e74d09fdd9a
Reviewed-on: https://go-review.googlesource.com/c/go/+/500575
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
2023-06-05 03:11:36 +00:00
Cuong Manh Le
2f5e2f6cc1 builtin: add documentation for min/max
Updates #59488

Change-Id: If873b81fb7f0e28b84a3e5c2ff89426b3e289d5d
Reviewed-on: https://go-review.googlesource.com/c/go/+/498495
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
2023-06-04 15:12:46 +00:00
Russ Cox
ce8146ed33 cmd/go: maintain go and toolchain lines in go.work
go work init / sync / use need to maintain the invariant that the
go version and toolchain in go.work are up-to-date with respect
to the modules in the workspace.

go get also preserves the invariant when running in a module.

go work use (including with no arguments) reestablishes the invariant.

Replaces the ToolchainTrySwitch func in PackageOpts with a new
gover.Switcher interface implemented by toolchain.Switcher.
Until now, the basic sketch of a particular phase of the go command
has been to call base.Error repeatedly, to report as many problems
as possible, and then call base.ExitIfErrors at strategic places where
continuing in the presence of errors is no longer possible.
A Switcher is similar: you call sw.Error repeatedly and then, when
all the errors from a given phase have been identified, call sw.Switch
to potentially switch toolchains, typically before calling base.ExitIfErrors.

One effect of the regularization of errors reported by the modload.loader
is to add a "go: " prefix to errors showing import stacks. That seems fine.

For #57001.

Change-Id: Id49ff7a28a969d3475c70e6a09d40d7aa529afa8
Reviewed-on: https://go-review.googlesource.com/c/go/+/499984
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2023-06-03 21:13:11 +00:00
thepudds
3637132233 cmd/compile/internal/devirtualize: devirtualize methods in other packages if current package has a concrete reference
The new PGO-driven indirect call specialization from CL 492436
in theory should allow for devirtualization on methods
in another package when those methods are directly referenced
in the current package.

However, inline.InlineImpossible was checking for a zero-length
fn.Body and would cause devirtualization to fail
with a debug log message like:

 "should not PGO devirtualize (*Speaker1).Speak: no function body"

Previously, the logic in inline.InlineImpossible was only
called on local functions, but with PGO-based devirtualization,
it can now be called on imported functions, where inlinable
imported functions will have a zero-length fn.Body but a
non-nil fn.Inl.

We update inline.InlineImpossible to handle imported functions
by adding a call to typecheck.HaveInlineBody in the check
that was previously failing.

For the test, we need to have a hopefully temporary workaround
of adding explicit references to the callees in another package
for devirtualization to work. CL 497175 or similar should
enable removing this workaround.

Fixes #60561
Updates #59959

Change-Id: I48449b7d8b329d84151bd3b506b8093c262eb2a3
GitHub-Last-Rev: 2d53c55fd8
GitHub-Pull-Request: golang/go#60565
Reviewed-on: https://go-review.googlesource.com/c/go/+/500155
Run-TryBot: thepudds <thepudds1460@gmail.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2023-06-03 01:13:08 +00:00
Bryan C. Mills
3fd867cecc cmd/go: adjust pruning and switch toolchain when needed in 'go mod tidy'
'go mod tidy' may resolve an imported package by added a dependency
that requires a higher 'go' version, which may activate graph pruning
(if the version goes from below go 1.16 to above it), and may even
require switching to a newer toolchain (if the version is not
supported by the current one).

For #57001.

Change-Id: Ic8e9b87d5979b3a6d1ee70f1f2bf2eea46b1bb0d
Reviewed-on: https://go-review.googlesource.com/c/go/+/499676
Reviewed-by: Russ Cox <rsc@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Bryan Mills <bcmills@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
2023-06-03 00:53:46 +00:00
Bryan C. Mills
77786d90fa cmd/go: adjust pruning and switch toolchains if needed when go get changes go version
When we do 'go get', the Go version can change now.
That means we need to do the pruning conversions that
until now have only been necessary in go mod tidy -go=version.

We may also need to upgrade the toolchain in order to load enough o
the module graph to finish the edit, so we should let a TooNewError
bubble up to the caller instead of trying to downgrade the affected
module to avoid the error.

Revised from CL 498120.

For #57001.

Change-Id: Ic8994737eca4ed61ccc093a69e46f5a6caa8be87
Reviewed-on: https://go-review.googlesource.com/c/go/+/498267
Reviewed-by: Russ Cox <rsc@golang.org>
Auto-Submit: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2023-06-02 23:07:08 +00:00
Bryan C. Mills
c292a74c38 cmd/go: adjust conditions in which toolchain lines are written
'go mod tidy -go=1.20' should tidy as Go 1.20 did, without writing a
toolchain line implicitly. (We don't need it to stabilize toolchain
version switching anyway: because Go 1.20 predates toolchain
switching, any toolchain that supports switching toolchains also
supports Go 1.20 modules directly.)

For #57001.

Change-Id: I415abac75d8d6de9f8ed470aab0d1ed4c225b08d
Reviewed-on: https://go-review.googlesource.com/c/go/+/499987
Auto-Submit: Bryan Mills <bcmills@google.com>
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2023-06-02 22:42:42 +00:00
Dmitri Shuralyov
6260049fa2 doc/go1.21: document macOS and Windows requirements
For #58645.
Fixes #57125.
Fixes #57003.
Fixes #57004.

Change-Id: I365929ca36aeb32e9ecd19f870e70869933ba6a0
Reviewed-on: https://go-review.googlesource.com/c/go/+/500239
Reviewed-by: Eli Bendersky <eliben@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Bypass: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2023-06-02 19:54:05 +00:00
qmuntal
ae71a862b1 doc/go1.21: document that os.TempDir now uses GetTempPath2W
Updates #56899

Change-Id: Ibde69cd55c81ac0bb757b28b28d69463778dd117
Reviewed-on: https://go-review.googlesource.com/c/go/+/500255
Reviewed-by: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Quim Muntal <quimmuntal@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2023-06-02 17:07:06 +00:00
Zhiyuan Zheng
c9faf3126e net: filter disabled interfaces in Windows DNS client
The Go DNS resolver on Windows should filter disabled
interfaces. Otherwise disabled TUN devices, VPNs will be also
considered as valid nameservers and finally timedout.

Fixes #56160

(Originally from Zhiyuan Zheng <zhzy0077@hotmail.com>
 in https://go.dev/cl/442375)

Co-authored-by: Zhiyuan Zheng <zhzy0077@hotmail.com>
GitHub-Last-Rev: db158625bb
GitHub-Pull-Request: golang/go#56161
Change-Id: I7becebc55c8ac612c670c533855f7e6ca397a496
Reviewed-on: https://go-review.googlesource.com/c/go/+/500375
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Auto-Submit: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2023-06-02 16:58:42 +00:00
Robert Griesemer
2e4fe8bbf0 go/types, types2: remove version check for more lenient constant handling in inference
For #58671.
Fixes #60566.

Change-Id: I746f99cdfd44b204dc90350fcfb3867e9b8b1da8
Reviewed-on: https://go-review.googlesource.com/c/go/+/499997
Run-TryBot: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2023-06-02 16:49:45 +00:00
Robert Griesemer
0cd9064cd7 go/types, types2: report inference instead of assignment failure when types can't match
Interface inference must only be used if we don't require exact
unification, otherwise we may infer types (that are reasonable)
but then fail with an assignment error.

Only checking if exact is set for defined (named) types is not
sufficient, we must also check outside. Oversight.

Fixes #60562.

Change-Id: I208a74bf7ed80bcb976ba9cc172715c83f9e3d0a
Reviewed-on: https://go-review.googlesource.com/c/go/+/499996
Auto-Submit: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
2023-06-02 16:28:54 +00:00
Dmitri Shuralyov
0a68767864 cmd/api: make check even pickier about api/next/*.txt
As spotted in CL 499981, 3 out of 51 of the api/next/*.txt files
ended up with a blank line at the end. It's possible it would've
been more if human reviewers didn't catch them.

Since there's no formatter for these files, the only way to help
catch things is to make the check pickier (as done in CL 431335).
It can be loosened to let in useful blank lines if needed in the
future.

Change-Id: Iae7ee8e782b32707c576150914539ac4cc0faec4
Reviewed-on: https://go-review.googlesource.com/c/go/+/500115
Reviewed-by: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2023-06-02 16:04:40 +00:00
Alan Donovan
fdbc66d6dd math/big: rename Int.ToFloat64 to Float64
The "To" prefix was a relic of the first draft
that I failed to make consistent with the unprefixed
name used in the proposal. Fortunately iant spotted
it during the API audit.

Updates #56984
Updates #60560

Change-Id: Ifa6eeddf6dd5f0637c0568e383f9a4bef88b10f9
Reviewed-on: https://go-review.googlesource.com/c/go/+/500116
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Alan Donovan <adonovan@google.com>
2023-06-02 14:22:24 +00:00
Russ Cox
c71cbd544e cmd/go: return more errors from ReadModFile, loadModFile
Return more errors instead of base.Fatalf, so we can handle them
in the callers.

For #57001.

Change-Id: If3e63d3f64188148f5d750991f9cb1175790d89d
Reviewed-on: https://go-review.googlesource.com/c/go/+/499983
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-06-02 02:54:20 +00:00
Roland Shoemaker
40c7be9b0f doc/go1.21: crypto release notes
Updates #58645

Change-Id: Ib7e2baba41bb327d8fc466afb1e117fe2f22e1c9
Reviewed-on: https://go-review.googlesource.com/c/go/+/499637
Reviewed-by: Damien Neil <dneil@google.com>
Auto-Submit: Roland Shoemaker <roland@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Roland Shoemaker <roland@golang.org>
2023-06-01 23:34:15 +00:00
Robert Griesemer
7183e77cc0 go/types, types2: use exact matching when unifying constraint method signatures
Fixes #60556.

Change-Id: I203a0bc79eff607654c3e8350d259e694cb035b2
Reviewed-on: https://go-review.googlesource.com/c/go/+/499995
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
2023-06-01 22:32:26 +00:00
Russ Cox
936ce874ac cmd/go: add gover.Max and gover.MaxToolchain
I've inlined these by hand enough times now.

For #57001.

Change-Id: Ia274bd444f12b07ce14eeb2b5a66546880db8f77
Reviewed-on: https://go-review.googlesource.com/c/go/+/499982
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Russ Cox <rsc@golang.org>
2023-06-01 21:32:58 +00:00
Russ Cox
8035de592f cmd/go: add base.Error and base.Fatal
Many many places in the go command use

	base.Errorf("go: %v", err)

or

	base.Fatalf("go: %v", err)

Introduce Error(error) and Fatal(error) to do this
and update all call sites (global search and replace).

The new Error gives us the opportunity to unwrap
a multierror and add the go prefix to each line,
which is the motivation for this change.
(We want to start returning a multierror from LoadModFile
and LoadModGraph.)

For #57001.

Change-Id: I9613653b94808224146077c30d22f814d4e19eed
Reviewed-on: https://go-review.googlesource.com/c/go/+/499980
Auto-Submit: Russ Cox <rsc@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
2023-06-01 21:32:23 +00:00
Russ Cox
9f450041c5 cmd/go: move CreateWorkFile from modload to workcmd
In workcmd it can deal with automatic version switching.

For #57001.

Change-Id: I5027690cf744d6d73f87e837c76ea7083ed56aba
Reviewed-on: https://go-review.googlesource.com/c/go/+/499979
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
Auto-Submit: Russ Cox <rsc@golang.org>
2023-06-01 21:13:05 +00:00
Russ Cox
459cca5cb2 cmd/go: move version constants from modload to gover
For #57001.

Change-Id: Ia76478b8eaa934b7e1dc1e9cd7fe8a2428fc291a
Reviewed-on: https://go-review.googlesource.com/c/go/+/499978
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Russ Cox <rsc@golang.org>
2023-06-01 21:12:04 +00:00
Michael Anthony Knyszek
a38a0839bd api: promote next to go1.21
Change-Id: I30cbd14bd2b3903d7960c5d860d76ce7f3d4730a
Reviewed-on: https://go-review.googlesource.com/c/go/+/499981
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
2023-06-01 20:02:28 +00:00
Michael Pratt
d0459766c8 runtime: update skips for TestGdbBacktrace
One issue simply has a reworded message, probably from a new version of
GDB. Another is a new issue.

Fixes #60553.
Fixes #58698.
Updates #39204.

Change-Id: I8389aa981fab5421f57ee761bfb5e1dd237709ed
Reviewed-on: https://go-review.googlesource.com/c/go/+/499975
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Michael Pratt <mpratt@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
2023-06-01 19:44:26 +00:00
Cherry Mui
fdb3dc471d cmd/internal/obj/arm: handle HAUTO etc. in addpool
HAUTO should be handled the same way as other stack offsets for
adding to constant pool. Add the missing cases.

Fixes #57955.

Change-Id: If7fc82cafb2bbf0a6121e73e353b8825cb36b5bc
Reviewed-on: https://go-review.googlesource.com/c/go/+/463138
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
2023-06-01 19:29:08 +00:00
Austin Clements
c2e0bf0abf cmd/internal/testdir: pass if GOEXPERIMENT=cgocheck2 is set
Some testdir tests fail if GOEXPERIMENT=cgocheck2 is set. Fix this by
skipping these tests.

Change-Id: I58d4ef0cceb86bcf93220b4a44de9b9dc4879b16
Reviewed-on: https://go-review.googlesource.com/c/go/+/499675
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
2023-06-01 18:30:44 +00:00
Austin Clements
563556ccc7 cmd/cgo/internal/testerrors: pass if GOEXPERIMENT=cgocheck2 is set
The tests in this package are meant to check cgocheck and cgocheck2
mode, so they're of course sensitive to whether they're set.
Currently, the test will set GOEXPERIMENT=cgocheck2 for tests of
cgocheck2 mode, but won't *unset* cgocheck2 mode if it's already in
the environment for tests that expect it to be off. This means

  GOEXPERIMENT=cgocheck2 go test cmd/cgo/internal/testerrors

fails.

Fix this by removing cgocheck2 from GOEXPERIMENT if it's set and the
test case expects it to be unset.

Change-Id: If663e41b791fb89df9940bc5356a566e2a54a77a
Reviewed-on: https://go-review.googlesource.com/c/go/+/499557
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
2023-06-01 18:30:29 +00:00
Christian Banse
7dc8509c69 cmd/link/internal/ld: pass correct offset to codesign.Sign
Previously, codesign.Sign was called with Segtext.Fileoff and
Segtext.Filelen. However, both variables do not contain the
complete __TEXT segment, as it excludes padding and header.
Therefore, we now store a reference to the complete segment
in mstext when it is created and pass its offset (which should
always be 0) and filesize to codesign.Sign.

Fixes #59555

Change-Id: Iad88f142705949dcc0b192b811337df9b4be08cf
GitHub-Last-Rev: 37a048d58e
GitHub-Pull-Request: golang/go#59581
Reviewed-on: https://go-review.googlesource.com/c/go/+/484015
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
2023-06-01 17:49:36 +00:00
Ian Lance Taylor
73a29bad0b doc/go1.21: correct links in go/build note
Change-Id: Ie84cad994c1ffb2c91ce45b2dfb9257e6a7f309b
Reviewed-on: https://go-review.googlesource.com/c/go/+/499957
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
TryBot-Bypass: Ian Lance Taylor <iant@google.com>
Reviewed-by: Eli Bendersky <eliben@google.com>
2023-06-01 17:35:10 +00:00
Tobias Klauser
300f24400a doc/go1.21: fix io/fs.ReadDirFS link formatting
Change-Id: I348ac0c0e098f027b8d608a260ee9437d2b77539
Reviewed-on: https://go-review.googlesource.com/c/go/+/499835
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Eli Bendersky <eliben@google.com>
2023-06-01 17:29:55 +00:00
Bryan C. Mills
5dd68a3ba7 cmd/go: propagate gover.TooNewError from modload.LoadModGraph
For #57001.

Change-Id: I639190b5f035139ba42a93ca03dd8a4c747556ea
Reviewed-on: https://go-review.googlesource.com/c/go/+/499678
Auto-Submit: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Russ Cox <rsc@golang.org>
2023-06-01 17:22:28 +00:00
Eli Bendersky
691b6ca3de doc: remove relnote TODO by merging with another section
This change was already described in the linker section.

Change-Id: I3e36dbd66b3b53c5f0063b0d67d8773383f1f77f
Reviewed-on: https://go-review.googlesource.com/c/go/+/499817
Auto-Submit: Eli Bendersky <eliben@google.com>
Reviewed-by: Eli Bendersky <eliben@google.com>
TryBot-Bypass: Eli Bendersky <eliben@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2023-06-01 17:13:46 +00:00
Ian Lance Taylor
990113f3a0 doc/go1.21: reformat flag init change note
It reads better as a single paragraph. Also added links.

Change-Id: Id6ba54111b63fbd536423272f674e0eb64b087a7
Reviewed-on: https://go-review.googlesource.com/c/go/+/499956
TryBot-Bypass: Ian Lance Taylor <iant@google.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2023-06-01 16:14:15 +00:00
Ian Lance Taylor
fecb31f672 doc/go1.21: remove some references to reverted CLs
Change-Id: Id9a8871af9cc3ac26be539877f2eea3462db6f3d
Reviewed-on: https://go-review.googlesource.com/c/go/+/499955
TryBot-Bypass: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Eli Bendersky <eliben@google.com>
2023-06-01 16:02:44 +00:00
Ian Lance Taylor
a469983943 doc/go1.21: fix type in closing tag
Change-Id: Ibcdedb8222a80c0478f783f4a1800e472dbe062c
Reviewed-on: https://go-review.googlesource.com/c/go/+/499935
Reviewed-by: Eli Bendersky <eliben@google.com>
TryBot-Bypass: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2023-06-01 16:02:23 +00:00
Eli Bendersky
2ea592c543 doc: add release note for go:wasmimport
Change-Id: I9c6fc4c7e24d0e78086d95dccd61e80bd5ddd856
Reviewed-on: https://go-review.googlesource.com/c/go/+/499815
Auto-Submit: Eli Bendersky‎ <eliben@golang.org>
Reviewed-by: Eli Bendersky <eliben@google.com>
Reviewed-by: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>
TryBot-Bypass: Eli Bendersky‎ <eliben@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2023-06-01 15:56:20 +00:00
Bryan C. Mills
0a87fdc06e cmd/go/internal/toolchain: avoid importing modcmd
modcmd is a high-level command, but toolchain is a low-level building
block. A dependency from toolchain on modcmd makes it very difficult
to call from other lower-level packages without creating an import
cycle.

Instead, use modfetch.Download in place of modcmd.DownloadModule.

For #57001.

Change-Id: I9694706d7225b269f26dc68814894613a3329abb
Reviewed-on: https://go-review.googlesource.com/c/go/+/499316
Run-TryBot: Bryan Mills <bcmills@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2023-06-01 15:54:37 +00:00
Bryan C. Mills
5f08963b2c cmd/go: fix TestScript/gotoolchain_net when $PATH contains golang.org/dl/go1.20.1
For #57001.

Change-Id: Idcc291c872864bcce7e6d411cdd208db3b331282
Reviewed-on: https://go-review.googlesource.com/c/go/+/499855
Run-TryBot: Bryan Mills <bcmills@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
TryBot-Bypass: Bryan Mills <bcmills@google.com>
Reviewed-by: Russ Cox <rsc@golang.org>
2023-06-01 15:53:59 +00:00
Eli Bendersky
5f695f7072 doc: add release note for cgo error on methods on C types
Change-Id: Ibc5f23f37e5bd45034771a0205eadac3072d6870
Reviewed-on: https://go-review.googlesource.com/c/go/+/499816
TryBot-Bypass: Eli Bendersky <eliben@google.com>
Reviewed-by: Eli Bendersky <eliben@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Auto-Submit: Eli Bendersky <eliben@google.com>
2023-06-01 14:43:34 +00:00
Michael Pratt
7911f7c21d runtime: only increment extraMInUse when actually in use
Currently lockextra always increments extraMInUse, even if the M won't
be used (or doesn't even exist), such as in addExtraM. addExtraM fails
to decrement extraMInUse, so it stays elevated forever.

Fix this bug and simplify the model by moving extraMInUse out of
lockextra to getExtraM, where we know the M will actually be used.

While we're here, remove the nilokay argument from getExtraM, which is
always false.

Fixes #60540.

Change-Id: I7a5d97456b3bc6ea1baeb06b5b2975e3b8dd96a0
Reviewed-on: https://go-review.googlesource.com/c/go/+/499677
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
Run-TryBot: Michael Pratt <mpratt@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2023-06-01 14:05:01 +00:00
Michael Pratt
65dcddeb4e doc/go1.21: document PGO GA and devirtualization
For #59959.
For #58645.

Change-Id: I574153ef2fd61a5e90ec281fca065c42fce22cc1
Reviewed-on: https://go-review.googlesource.com/c/go/+/498263
Reviewed-by: Eli Bendersky <eliben@google.com>
Run-TryBot: Michael Pratt <mpratt@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2023-06-01 13:54:10 +00:00
Tobias Klauser
b25dff2efe doc/go1.21: document that os.DirFS implements fs.Read{File,Dir}FS
Also add a missing </a> in the preceding section.

For #53761

Change-Id: I8e64b86b5b32067f954d58cf9adf86cb4d2eeb2b
Reviewed-on: https://go-review.googlesource.com/c/go/+/499735
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Auto-Submit: Eli Bendersky <eliben@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Eli Bendersky <eliben@google.com>
2023-06-01 12:43:18 +00:00
Russ Cox
b100e127ca cmd/go: delete cmd/go/internal/slices in favor of slices
Some files already use "slices", others use "cmd/go/internal/slices".
(Some files are using more than slices.Clip and must use "slices".)
Use "slices" consistently and delete cmd/go/internal/slices.

Change-Id: I69ec680106ad2924276f7473e6547a3a907efc96
Reviewed-on: https://go-review.googlesource.com/c/go/+/499715
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Russ Cox <rsc@golang.org>
2023-06-01 02:52:19 +00:00