Damien Neil [Wed, 30 Nov 2022 01:07:02 +0000 (20:07 -0500)]
path/filepath: make Join("c:", "/a") return "c:/a" again
Historically, on Windows filepath.Join("c:", elt) does not insert
a path separator between "c:" and elt, but preserves leading slashes
in elt. Restore this behavior, which was inadvertently changed by
CL 444280.
Bryan C. Mills [Thu, 1 Dec 2022 20:37:50 +0000 (15:37 -0500)]
go/internal/gcimporter: in short tests, avoid creating export data for all of std
gcimporter.TestImportTypeparamTests still needs to create full export
data because it loads lots of source files from GOROOT/test that
expect to be able to import arbitrary subsets of the standard library,
so we now skip it in short mode.
On a clean build cache, this reduces
'go test -short cmd/compile/internal/importer go/internal/gcimporter'
on my machine from 21–28s per test to <6s per test.
Roland Shoemaker [Tue, 29 Nov 2022 21:19:27 +0000 (13:19 -0800)]
doc/go1.20: resolve root bundle package TODO
We're unlikely to get this package out of the door all that soon. For
now add a note that SetFallbackRoots will be most commonly used with
an TBA package, and link the tracking issue.
We could also just remove the "It will most commonly be used ..."
sentence.
Change-Id: Ie96134d757f5b4c69f1878d53c92b5ed602671e4
Reviewed-on: https://go-review.googlesource.com/c/go/+/454056 Reviewed-by: Julie Qiu <julieqiu@google.com>
Run-TryBot: Roland Shoemaker <roland@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Roland Shoemaker <roland@golang.org>
Russ Cox [Wed, 23 Nov 2022 21:30:11 +0000 (16:30 -0500)]
cmd/api: track darwin arm64 port
The darwin arm64 port was added in Go 1.16 and is a first-class port,
so it should be tracked by cmd/api. This CL does that, backfilling
API files as needed.
It also removes a spurious cgo.Incomplete API feature.
Change-Id: Idd995677915e81bf1c2e09be65b31e084b75f668
Reviewed-on: https://go-review.googlesource.com/c/go/+/453260 Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Russ Cox [Wed, 23 Nov 2022 18:45:56 +0000 (13:45 -0500)]
cmd/api: track deprecations
Deprecating an API creates notices that go out to potentially
millions of Go developers encouraging them to update their code.
The choice to deprecate an API is as important as the choice to
add a new API. We should track those and make them explicit.
This will also ensure that deprecations go through proposal review.
Russ Cox [Tue, 29 Nov 2022 20:13:52 +0000 (15:13 -0500)]
runtime/debug: more complete BuildInfo documentation
A potential user did not realize Deps included all transitive dependencies,
not just direct dependencies of the main module. Clarify that and add
various other useful information.
Bryan C. Mills [Thu, 1 Dec 2022 18:39:39 +0000 (13:39 -0500)]
go/internal/gcimporter: load cached export data for packages individually
Previously, we were using internal/goroot.PkgfileMap to locate
cached export data. However, PkgfileMap regenerates export data
for the entire standard library, whereas gcimporter may only need
a single package.
Under the new approach, we load the export data (still using
'go list -export') for each GOROOT package individually, avoiding work
to rebuild export data for packages that are not needed.
This is a tradeoff: if most packages in GOROOT are actually needed, we
end up making many more calls to 'go list', and may build packages
sequentially instead of in parallel (but with lower latency to start
using the export data from the earlier packages).
On my workstation, starting from a clean cache for each run,
this reduces the wall time of
'go test go/internal/gcimporter -run=TestImportedTypes'
from 22s real time (2m10s user time) to 6s real (27s user),
and only increases 'go test go/internal/gcimporter' from
28s real (2m16s user) to 30s real (2m19s user).
Michael Matloob [Tue, 29 Nov 2022 23:32:32 +0000 (18:32 -0500)]
cmd/dist: remove pkg/$GOOS_$GOARCH and pkg/obj at exit
pkg/obj will be empty, so just remove it.
pkg/$GOOS_$GOARCH will be empty unless the user has specified
GODEBUG=installgoroot=all, so check if it's empty, and if so, delete
it.
Also remove xreaddirfiles, which is unused.
Also remove the copy of pkg/$GOOS_$GOARCH in the cmd/go test
TestNewReleaseRebuildsStalePackagesInGOPATH. The directory is empty so
copying it has no effect.
For #47257
Change-Id: Ief90b882d157bd16078cd5d2b83a915bfc831f9a
Reviewed-on: https://go-review.googlesource.com/c/go/+/453496
Run-TryBot: Michael Matloob <matloob@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Michael Matloob <matloob@golang.org> Reviewed-by: Bryan Mills <bcmills@google.com>
Robert Griesemer [Thu, 1 Dec 2022 20:36:51 +0000 (12:36 -0800)]
doc/go1.20: document new semantics for comparable constraint
For #54202.
For #56548.
Change-Id: If2b9e41813c3e1c8d373469a40e1bd0bd5ea2b16
Reviewed-on: https://go-review.googlesource.com/c/go/+/454595 Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Bypass: Robert Griesemer <gri@google.com> Reviewed-by: Robert Griesemer <gri@google.com>
Michael Matloob [Wed, 30 Nov 2022 17:53:13 +0000 (12:53 -0500)]
go/internal/gcimporter: fix TestImportStdLib
The test attempted to find all stdlib packages by scanning
pkg/$GOOS_$GOARCH for .a files and then tried to import all of them.
Now that .a files are no longer being placed there, the test is a
noop. Fix this by using go list std (and filtering out testonly
packages) and trying to import all of those to recreate what the test
intended to do.
This also removes a dependency on the pkg/$GOOS_$GOARCH directory
which will stop being produced by dist in CL 453496.
For #47257
Change-Id: I7c1944a89db9da9269def3d64a11408a60d73d46
Reviewed-on: https://go-review.googlesource.com/c/go/+/453858 Reviewed-by: Michael Matloob <matloob@golang.org>
Run-TryBot: Michael Matloob <matloob@golang.org> Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Robert Griesemer [Thu, 1 Dec 2022 17:39:45 +0000 (09:39 -0800)]
go/types, types2: make the new comparable semantics the default
Ordinary interface types now satisfy comparable constraints. This
is a fully backward-compatible change: it simply permits additional
code to be valid that wasn't valid before.
This change makes the new comparable semantics the default behavior,
depending on the Go -lang version.
It also renames the flag types2.Config.AltComparableSemantics to
types2.Config.OldComparableSemantics and inverts its meaning
(or types.Config.oldComparableSemantics respectively).
Add new predicate Satisfies (matching the predicate Implements but
for constraint satisfaction), per the proposal description.
Adjust some existing tests by setting -oldComparableSemantics
and add some new tests that verify version-dependent behavior.
The compiler flag -oldcomparable may be used to temporarily
switch back to the Go 1.18/1.19 behavior should this change
cause problems, or to identify that a problem is unrelated
to this change. The flag will be removed for Go 1.21.
For #52509.
For #56548.
For #57011.
Change-Id: I8b3b3d9d492fc24b0693567055f0053ccb5aeb42
Reviewed-on: https://go-review.googlesource.com/c/go/+/454575
TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Robert Griesemer <gri@google.com>
Run-TryBot: Robert Griesemer <gri@google.com> Reviewed-by: Robert Findley <rfindley@google.com>
Bryan C. Mills [Wed, 16 Nov 2022 20:36:30 +0000 (15:36 -0500)]
cmd/go/internal/work: make formatOutput return an error that includes the import path
This refines the error output that was previously adjusted in CL 437298.
Longer term, we should consider unraveling the call chains involving
formatOutput to avoid passing so many parameters through so many
different formatting functions.
Roland Shoemaker [Thu, 1 Dec 2022 17:02:16 +0000 (09:02 -0800)]
archive/zip: tolerate compressed directories with zero uncompressed size
In CL 449955 we made reading of directories with associated file data
an error, since it is a "must not" in the zip specification. It turns
out that a number of implementations make the mistake of not setting
the correct compression method on directories (in particular the Java
jar tool does this when storing the META-INF directory). If the
compression method used is not 0 (stored) then the compressed size of
the directory can be > 0, despite the uncompressed size still being 0.
Since this mistake is not uncommon, we are forced to tolerate it. We
still fail if the recorded uncompressed size is > 0, which should be
a significantly harder mistake to make.
Change-Id: Ia732b10787f26ab937ac9cf9869ac3042efb8118
Reviewed-on: https://go-review.googlesource.com/c/go/+/454475 Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Roland Shoemaker <roland@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Roland Shoemaker <roland@golang.org>
Roland Shoemaker [Mon, 28 Nov 2022 16:51:32 +0000 (08:51 -0800)]
crypto/ecdsa: verify validity of signature parameters in Verify
CL 353849 removed validation of signature parameters being passed to
Verify which led to two distinct problems. If passed a R or S == 0,
encodeSignature would panic since it expects them to be non-zero.
encodeSignature would also normalize (i.e. make non-negative) parameters
by zero padding them, which would result in a signature being passed to
VerifyASN1 which did not match the input signature, resulting in success
in cases where it should've failed. This change re-adds the verification
that 0 < r,s < N before calling ecnodeSignature.
This was caught because tink runs the wycheproof ECDSA vectors against
Verify, where we only run the vectors against VerifyASN1. We should be
doing both.
Change-Id: I1dcf41626b4df2b43296e8b878dc607ff316a892
Reviewed-on: https://go-review.googlesource.com/c/go/+/453675
Auto-Submit: Roland Shoemaker <roland@golang.org> Reviewed-by: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Than McIntosh <thanm@google.com>
Run-TryBot: Roland Shoemaker <roland@golang.org>
Robert Griesemer [Wed, 30 Nov 2022 22:19:39 +0000 (14:19 -0800)]
go/types, types2: make the new comparable semantics the default
Ordinary interface types now satisfy comparable constraints.
This change makes the new comparable semantics the default behavior,
depending on the Go -lang version.
It also renames the flag types2.Config.AltComparableSemantics to
types2.Config.OldComparableSemantics and inverts its meaning
(or types.Config.oldComparableSemantics respectively).
Adjust some existing tests by setting -oldComparableSemantics
and add some new tests that verify version-dependent behavior.
The compiler flag -oldcomparable may be used to temporarily
switch back to the Go 1.18/1.19 behavior should this change
cause problems, or to identify that a problem is unrelated
to this change. The flag will be removed for Go 1.21.
For #52509.
For #56548.
Change-Id: Ic2b22db9433a8dd81dc1ed9d30835f0395fb7205
Reviewed-on: https://go-review.googlesource.com/c/go/+/453978 Reviewed-by: Robert Findley <rfindley@google.com> Reviewed-by: Robert Griesemer <gri@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Robert Griesemer <gri@google.com>
Cuong Manh Le [Thu, 24 Nov 2022 05:43:22 +0000 (12:43 +0700)]
cmd/compile: fix inline static init with derived types
CL 450136 added handling for simple calls in staticinit. If there's any
derived types conversion in the body of generic function called, that
conversion will require runtime dictionary, thus the optimization could
not happen.
Fixes #56923
Change-Id: I498cee9f8ab4397812ef79a6c2ab6c55e0ee4aef
Reviewed-on: https://go-review.googlesource.com/c/go/+/453315
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com> Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com> Reviewed-by: Gabriel Morency (Amgc63spaming) <morencyvincent8@gmail.com>
Matthew Dempsky [Wed, 30 Nov 2022 20:31:30 +0000 (12:31 -0800)]
cmd/cgo: walk {FuncType,TypeSpec}.TypeParams fields
This CL updates the cgo tool to walk the TypeParams fields for
function types and type declarations, so that C.xxx identifiers can
appear within type parameter lists.
Fixes #52542.
Change-Id: Id02a88d529d50fe59b0a834f415c2575204ffd1f
Reviewed-on: https://go-review.googlesource.com/c/go/+/453977
Run-TryBot: Matthew Dempsky <mdempsky@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Damien Neil [Wed, 30 Nov 2022 18:57:33 +0000 (13:57 -0500)]
net: reenable SRV tests with _ldap._tcp.google.com
TestLookupDotsWithRemoteSource and TestLookupGoogleSRV
were disabled because they look up the no-longer-present
SRV record for _xmpp-server._tcp.google.com.
Change the tests to look for _ldap._tcp.google.com and
reenable them.
Fixes #56708.
Change-Id: I26475fa3ff6fc008048a4e5f24f0e96ee12f655c
Reviewed-on: https://go-review.googlesource.com/c/go/+/453861
Run-TryBot: Damien Neil <dneil@google.com> Reviewed-by: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Michael Anthony Knyszek [Tue, 29 Nov 2022 21:23:40 +0000 (21:23 +0000)]
doc/go1.20: add runtime, runtime/trace, and runtime/pprof release notes
This change adds release notes for the "Runtime" section and updated
some of the release notes for runtime/trace and runtime/pprof after I
looked at the full list of runtime-related changes.
For #54202.
Change-Id: Id1395f4e6e02d3fcc248855ca98ad0ee26cae574
Reviewed-on: https://go-review.googlesource.com/c/go/+/454075
TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Robert Griesemer <gri@google.com> Reviewed-by: Austin Clements <austin@google.com>
Run-TryBot: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
Damien Neil [Wed, 30 Nov 2022 18:43:45 +0000 (13:43 -0500)]
net/http: deflake and fix TestWrappedResponseController
Read the full (empty) response body before closing it,
to avoid cancelling the request while the server handler
is still running.
Wrap the ResponseWriter before calling NewResponseController:
This test is intended to verify that wrapping the controller
works properly, but neglected to actually wrap the controller.
Keith Randall [Tue, 29 Nov 2022 23:00:11 +0000 (15:00 -0800)]
cmd/compile: disallow CMOV optimization with ptr arithmetic as an arg
if q != nil {
p = &q.f
}
Which gets rewritten to a conditional move:
tmp := &q.f
p = Select q!=nil, tmp, p
Unfortunately, we can't compute &q.f before we've checked if q is nil,
because if it is nil, &q.f is an invalid pointer (if f's offset is
nonzero but small).
Normally this is not a problem because the tmp variable above
immediately dies, and is thus not live across any safepoint. However,
if later there is another &q.f computation, those two computations are
CSEd, causing tmp to be used at both use points. That will extend
tmp's lifetime, possibly across a call.
Fixes #56990
Change-Id: I3ea31be93feae04fbe3304cb11323194c5df3879
Reviewed-on: https://go-review.googlesource.com/c/go/+/454155
TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@google.com>
Tim King [Wed, 23 Nov 2022 18:31:03 +0000 (10:31 -0800)]
spec: document conversion from slice to array
Document that a slice can be converted to either an array or a pointer
to an array of a matching underlying array type. This was documented in
the "Conversions from slice to array or array pointer" subsection, but
not in the list of conversion rules.
Updates #46505.
Change-Id: I16a89a63ef23c33580129952415e977a8f334009
Reviewed-on: https://go-review.googlesource.com/c/go/+/452936
TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Robert Griesemer <gri@google.com>
Run-TryBot: Tim King <taking@google.com>
Ian Lance Taylor [Tue, 22 Nov 2022 22:50:57 +0000 (14:50 -0800)]
reflect: correct tpoy in comment
Change-Id: I75aef6bf957939fae8b680214f5923dc2713a5cc
Reviewed-on: https://go-review.googlesource.com/c/go/+/452935 Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Russ Cox <rsc@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Ian Lance Taylor [Tue, 29 Nov 2022 19:37:10 +0000 (19:37 +0000)]
Revert "encoding/xml: disallow empty namespace when prefix is set"
This reverts CL 105636.
Reason for revert: Fails with existing XML data. At this stage in the release cycle we should revert, and try again next time with some way to support existing XML.
For #8068
Change-Id: Ia84cbf3a84878ac7190f72998545dee22c36c45e
Reviewed-on: https://go-review.googlesource.com/c/go/+/453996
Auto-Submit: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Heschi Kreinick <heschi@google.com> Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com> Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Cherry Mui [Tue, 29 Nov 2022 15:48:37 +0000 (10:48 -0500)]
doc/go1.20: revise linker release note
I misunderstood CL 420774. We didn't remove GO_LDSO, just that
make.bash no longer tries to set it automatically. If GO_LDSO is
explicitly set at make.bash, it is still used as the default
dynamic interpreter.
For #54202.
Change-Id: Ided775438b8e4b87a6acd9bc87657657dbd3d91c
Reviewed-on: https://go-review.googlesource.com/c/go/+/453601
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Cherry Mui <cherryyz@google.com> Reviewed-by: Than McIntosh <thanm@google.com>
Than McIntosh [Wed, 23 Nov 2022 11:47:14 +0000 (06:47 -0500)]
testing: remove stale builder names from windows tests
A couple of the windows runtime tests were being gated by "if
testenv.Builder() == ..." guards that referred to builders that have
long since been obsoleted (e.g. "windows-amd64-gce"). Use a more
generic guard instead, checking for windows-<goarch> prefix.
Change-Id: Ibdb9ce2b0cfe10bba986bd210a5b8ce5c1b1d675
Reviewed-on: https://go-review.googlesource.com/c/go/+/453035 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Ian Lance Taylor [Mon, 28 Nov 2022 18:33:04 +0000 (10:33 -0800)]
context: add lock in Cause to avoid race
Change-Id: I8d970e8db859bdd17390cfbc22cc2ba0d326ed0c
Reviewed-on: https://go-review.googlesource.com/c/go/+/453735
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com> Reviewed-by: Sameer Ajmani <sameer@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Russ Cox [Wed, 23 Nov 2022 19:16:53 +0000 (14:16 -0500)]
cmd/api: rewrite as package test
No one ever runs 'go tool api', because the invocation
has gotten unwieldy enough that it's not practical.
And we don't support it as a standalone tool for other
packages - it's not even in the distribution.
Making it an ordinary package test lets us invoke it
more easily from cmd/dist (as go test cmd/api -check)
and avoids the increasingly baroque code in run.go to
build a command line.
Left in cmd/api even though it's no longer a command
because (1) it uses a package from cmd/vendor and
(2) it uses internal/testenv. Otherwise it could be misc/api.
Brad Fitzpatrick [Sun, 27 Nov 2022 00:27:40 +0000 (16:27 -0800)]
doc/go1.20: fix HTML closing tag
Change-Id: I7e2519601bfe1a59a48e240ff67868b1d74d55d1
Reviewed-on: https://go-review.googlesource.com/c/go/+/453516 Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Rongrong [Mon, 21 Nov 2022 06:05:40 +0000 (14:05 +0800)]
syscall, runtime/internal/syscall: zero r2 before mips linux syscalls
All mips variant perform syscalls similarly. R2 (v0) holds r1 and R3
(v1) holds r2 of a syscall. The latter is only used by 2-ret syscalls.
A 1-ret syscall would not touch R3 but keeps it as is, making r2 be a
random value. Always reset it to 0 before SYSCALL to fix the issue.
Russ Cox [Tue, 22 Nov 2022 18:28:51 +0000 (13:28 -0500)]
cmd/compile: reenable inlstaticinit
This was disabled in CL 452676 out of an abundance of caution,
but further analysis has shown that the failures were not being
caused by this optimization. Instead the sequence of commits was:
CL 450136 cmd/compile: handle simple inlined calls in staticinit
...
CL 449937 archive/tar, archive/zip: return ErrInsecurePath for unsafe paths
...
CL 451555 cmd/compile: fix static init for inlined calls
The failures in question became compile failures in the first CL
and started building again after the last CL.
But in the interim the code had been broken by the middle CL.
CL 451555 was just the first time that the tests could run and fail.
For #30820.
Change-Id: I65064032355b56fdb43d9731be2f9f32ef6ee600
Reviewed-on: https://go-review.googlesource.com/c/go/+/452817 Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Russ Cox <rsc@golang.org>
Auto-Submit: Russ Cox <rsc@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Russ Cox [Tue, 22 Nov 2022 15:22:00 +0000 (10:22 -0500)]
reflect: remove deprecation notices from SliceHeader, StringHeader
There has been no proposal discussion about adding these notices.
Also, even if we did decide to add them, then since their replacements
are only appearing in Go 1.20, go.dev/wiki/Deprecation says that we
should wait until Go 1.22 to add the deprecation notice.
Tim King [Tue, 22 Nov 2022 21:52:11 +0000 (13:52 -0800)]
doc/go1.20: document adding to the timeformat vet analysis
Address the release notes TODO regarding the timeformat analyzer.
Change-Id: Ic132569d84d6e00eeed4ea49f2467e09af4b0756
Reviewed-on: https://go-review.googlesource.com/c/go/+/452915
Run-TryBot: Tim King <taking@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Alan Donovan <adonovan@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Robert Griesemer [Tue, 22 Nov 2022 00:36:14 +0000 (16:36 -0800)]
spec: add a link to Allocation section in section on append built-in
If needed, the built-in function append allocates a new underlying
array. While we (probably) don't want to specify exactly how much
is allocated (the prose is deliberately vague), if there's more
space allocated than needed (cap > len after allocation), that
extra space is zeroed. Use an explicit link to the section on
Allocation which explicitly states that newly allocated memory
is zeroed.
Fixes #56684.
Change-Id: I9805d37c263b87860ea703ad143f738a0846247e
Reviewed-on: https://go-review.googlesource.com/c/go/+/452619 Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Robert Griesemer <gri@google.com> Reviewed-by: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Joseph Tsai <joetsai@digital-static.net> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Robert Griesemer [Tue, 22 Nov 2022 00:02:20 +0000 (16:02 -0800)]
spec: document that trailing comma is valid after index in index expressions
At parse time we don't know if a[i] is an index expression or a
type (or function) instantiation. Because instantiations accept
a list of type arguments, and argument lists permit a trailing
comma, a[i,] is either an instantiation or index expression.
Document that a trailing comma is permitted in the syntax for
index expressions.
For comparison, the same problem arises with conversions which
cannot be distinguished from function calls at parse time. The
spec also permits a trailing comma for conversions T(x,). The
grammar adjustment is the same (see line 5239).
Fixes #55007.
Change-Id: Ib9101efe52031589eb95a428cc6dff940d939f9e
Reviewed-on: https://go-review.googlesource.com/c/go/+/452618 Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Matthew Dempsky <mdempsky@google.com> Reviewed-by: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Bryan C. Mills [Tue, 22 Nov 2022 20:31:06 +0000 (15:31 -0500)]
cmd/go: fix the DefaultCC check if CC is an absolute file missing an extension on Windows
This undoes the code (but not test) change from CL 451219, which turns
out to be slightly harmful on Windows (because it doesn't resolve the
file extension for an absolute CC path) and unnecessary elsewhere
(because calling LookPath on a fully-resolved executable path already
stats¹ that path before returning it).
Damien Neil [Fri, 11 Nov 2022 20:31:44 +0000 (12:31 -0800)]
all: enable disabled HTTP/2 tests
Update net/http to enable tests that pass with the latest update
to the vendored x/net.
Update a few tests:
Windows apparently doesn't guarantee that time.Since(time.Now())
is >=0, so to set a definitely-expired write deadline, use a time
firmly in the past rather than now.
Put a backoff loop on TestServerReadTimeout to avoid failures
when the timeout expires mid-TLS-handshake. (The TLS handshake
timeout is set to min(ReadTimeout, WriteTimeout, ReadHeaderTimeout);
there's no way to set a long TLS handshake timeout and a short
read timeout.)
Don't close the http.Server in TestServerWriteTimeout while the
handler may still be executing, since this can result in us
getting the wrong error.
Change the GOOS=js fake net implementation to properly return
ErrDeadlineExceeded when a read/write deadline is exceeded,
rather than EAGAIN.
Reason for revert: This change causes test failures (and possibly other
problems) for users depending on the existing validation behavior.
Rolling back the change for now to give us more time to consider its
impact. This landed late in the cycle and isn't urgent; it can wait
for 1.21 if we do want to make the change.
Fixes #56884
For #56732
Change-Id: I082023c67f1bbb933a617453ab92b67abba876ef
Reviewed-on: https://go-review.googlesource.com/c/go/+/452795
TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Damien Neil <dneil@google.com> Reviewed-by: Heschi Kreinick <heschi@google.com>
Than McIntosh [Tue, 22 Nov 2022 17:06:53 +0000 (12:06 -0500)]
cmd/dist: revise skip sequence added in CL 452763
Revise the code added in CL 452763 that skips some of the -race tests
on older windows builders. The old-style skip was doing a log.Printf,
which wound up being interpreted in "-list" mode. Fix is to pass in a
special rtPreFunc when registering the test (thanks Austin for the
fix suggestion).
Updates #56904.
Change-Id: Ia6ea31fb7f011b539173f47357ab3bf7389f256d
Reviewed-on: https://go-review.googlesource.com/c/go/+/452769 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Run-TryBot: Than McIntosh <thanm@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Than McIntosh <thanm@google.com>
Damien Neil [Mon, 21 Nov 2022 22:27:24 +0000 (14:27 -0800)]
archive/tar, archive/zip: disable ErrInsecurePath by default
This change is being made late in the release cycle.
Disable it by default. Insecure path checks may be enabled by setting
GODEBUG=tarinsecurepath=0 or GODEBUG=zipinsecurepath=0.
We can enable this by default in Go 1.21 after publicizing the change
more broadly and giving users a chance to adapt to the change.
For #55356.
Change-Id: I549298b3c85d6c8c7fd607c41de1073083f79b1d
Reviewed-on: https://go-review.googlesource.com/c/go/+/452616
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Damien Neil <dneil@google.com> Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Damien Neil <dneil@google.com>
Cherry Mui [Tue, 22 Nov 2022 16:25:08 +0000 (11:25 -0500)]
all: update vendored golang.org/x dependencies for Go 1.20 release
The Go 1.20 code freeze has recently started. This is a time to update
all golang.org/x/... module versions that contribute packages to the
std and cmd modules in the standard library to latest master versions.
This CL updates them with x/build/cmd/updatestd.
For #36905.
Change-Id: Ie0ec91daeb848f00f64686003012297161ad02fa
Reviewed-on: https://go-review.googlesource.com/c/go/+/452766
Run-TryBot: Cherry Mui <cherryyz@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Than McIntosh [Tue, 22 Nov 2022 15:42:25 +0000 (10:42 -0500)]
cmd/dist: skip -race w/ external linkage on windows 2008
Add a skip for the external-linkage part of the race detector test for
elderly versions of windows, until the underlying cause for the problem
can be determined.
Updates #56904.
Change-Id: I3e8650ff66f34efefabcd6bc343d57124539901b
Reviewed-on: https://go-review.googlesource.com/c/go/+/452763 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Than McIntosh <thanm@google.com>
Auto-Submit: Than McIntosh <thanm@google.com>
Bryan C. Mills [Tue, 22 Nov 2022 03:12:15 +0000 (22:12 -0500)]
cmd/go: remove special case for prebuilt cgo library cache keys
This was an oversight from CL 452457 that I noticed while
investigating #56889.
This change essentially undoes CL 335409, which is no longer needed
after CL 450739 because we no longer attempt to use cgo by default
when no C compiler is present.
Bryan C. Mills [Tue, 22 Nov 2022 05:27:07 +0000 (00:27 -0500)]
cmd/dist: skip the staleness check for 'cmd' when testing on aix-ppc64
The gcc toolchain on the aix-ppc64 builder apparently does not achieve
reproducible builds for packages that use cgo, which causes the
binaries in cmd that use package "net" (cmd/go, cmd/pprof, and
cmd/trace) to appear stale whenever the Go build cache is cleared.
For now, we work around the staleness by rebuilding std and simply not
checking whether cmd is stale.
Bryan C. Mills [Mon, 21 Nov 2022 22:18:07 +0000 (17:18 -0500)]
cmd/go: in TestScript/mod_outside, run 'go build' before checking cmd/addr2line staleness
If the build cache is cleaned (using 'go clean -cache' or similar), or
if a toolchain is freshly installed without warming the cache, the
build cache might not contain the dependencies needed to verify that
cmd/addr2line is not stale. In that case, the test should refill the
cache instead of failing.
Robert Findley [Tue, 15 Nov 2022 16:30:55 +0000 (11:30 -0500)]
doc/go1.20: document changes to the loopclosure vet analysis
Address the release notes TODO regarding the loopclosure analyzer,
documenting the new warning for parallel subtests.
In doing so, choose a structure for the vet section, opting for h4
headings. In recent years, we have used either h4 headings or simple
paragraphs to document vet changes. This year, I thought it worthwhile
to put the timeformat and loopclosure changes into separate sections.
Also document the improvements to reference capture detection introduced
in CL 452615.
Change-Id: I05886f7025d66bb7f2609f787f69d1a769ca6f5e
Reviewed-on: https://go-review.googlesource.com/c/go/+/450735
Run-TryBot: Robert Findley <rfindley@google.com> Reviewed-by: Tim King <taking@google.com> Reviewed-by: Alan Donovan <adonovan@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Matthew Dempsky [Tue, 22 Nov 2022 01:17:06 +0000 (17:17 -0800)]
cmd/compile: add -d=inlstaticinit debug flag
This CL adds -d=inlstaticinit to control whether static initialization
of inlined function calls (added in CL 450136) is allowed.
We've needed to fix it once already (CL 451555) and Google-internal
testing is hitting additional failure cases, so putting this
optimization behind a feature flag seems appropriate regardless.
Also, while we diagnose and fix the remaining cases, this CL also
disables the optimization to avoid miscompilations.
Updates #56894.
Change-Id: If52a358ad1e9d6aad1c74fac5a81ff9cfa5a3793
Reviewed-on: https://go-review.googlesource.com/c/go/+/452676 Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Bryan C. Mills [Mon, 21 Nov 2022 21:57:52 +0000 (16:57 -0500)]
cmd/go: do not install .a files for packages in std
As of CL 450739, we do not need install targets for cgo files when a C
compiler is not present because cgo is not enabled by default.
(Without a C compiler, builds will proceed with cgo disabled.)
Matthew Dempsky [Thu, 27 Oct 2022 00:01:24 +0000 (17:01 -0700)]
cmd/compile: reject anonymous interface cycles
This CL changes cmd/compile to reject anonymous interface cycles like:
type I interface { m() interface { I } }
We don't anticipate any users to be affected by this change in
practice. Nonetheless, this CL also adds a `-d=interfacecycles`
compiler flag to suppress the error. And assuming no issue reports
from users, we'll move the check into go/types and types2 instead.
Updates #56103.
Change-Id: I1f1dce2d7aa19fb388312cc020e99cc354afddcb
Reviewed-on: https://go-review.googlesource.com/c/go/+/445598
Run-TryBot: Matthew Dempsky <mdempsky@google.com> Reviewed-by: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Matthew Dempsky <mdempsky@google.com>
Than McIntosh [Mon, 21 Nov 2022 16:46:23 +0000 (11:46 -0500)]
testing: skip TestVectoredHandlerExceptionInNonGoThread on windows-amd64-2012-*
Modify skip rule for TestVectoredHandlerExceptionInNonGoThread to
trigger on both the base builder (windows-amd64-2012) and the newcc
canary builder (windows-amd64-2012-newcc).
Updates #49681.
Change-Id: I58109fc2e861b943cb66be0feec348671be84ab3
Reviewed-on: https://go-review.googlesource.com/c/go/+/452436
Run-TryBot: Than McIntosh <thanm@google.com>
Auto-Submit: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com>
qmuntal [Mon, 21 Nov 2022 12:56:19 +0000 (13:56 +0100)]
cmd/go,internal/platform: enable pie buildmode for windows/arm64
This CL adds windows/arm64 to the list of ports that supports PIE
build mode. It is probably an oversight that this port is not marked
as pie-capable because windows/arm64 only supports PIE build mode.
Fixes #56872
Change-Id: I2bdd3ac207280f47ddcf8c2582f13025dafb9278
Reviewed-on: https://go-review.googlesource.com/c/go/+/452415
Run-TryBot: Cherry Mui <cherryyz@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>