1
0
mirror of https://github.com/golang/go synced 2024-11-26 18:26:48 -07:00
Commit Graph

48188 Commits

Author SHA1 Message Date
Paul E. Murphy
da7496d841 os/signal: increase test timeouts on ppc64*/linux
TestSignalTrace can take a bit longer to run on some
ppc64{,le} machines. I was only able to reproduce the
timeout reliably on a POWER8/ppc64le ubuntu 16.04 host.

Bump the timeout to 5 seconds.  This should be more than
sufficient for a test which occasionally takes a bit
longer to run on these builders.

Fixes #45773

Change-Id: I4177bb986561f714aabfa5b0ca44b1c90b1cd94f
Reviewed-on: https://go-review.googlesource.com/c/go/+/315049
Run-TryBot: Paul Murphy <murp@ibm.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Trust: Lynn Boger <laboger@linux.vnet.ibm.com>
2021-05-04 17:37:39 +00:00
Michael Anthony Knyszek
d83baa1aa2 cmd/dist,cmd/go: set GOTRACEBACK to "system" for testing
If we're testing through dist, we're testing the implementation of Go,
so we're interested in any package failing with potential runtime
issues. In these cases, we'd like to have as much relevant detail as
possible, but currently runtime stack frames and goroutines are
suppressed due to the default GOTRACEBACK setting.

So, try to set GOTRACEBACK to system if it's unset. Check if it's unset
first so we don't override the user asking for a lower or higher level.

This change was brought up in the context of #45916, since there's an
apparent deadlock (or something!) in the runtime that appears when
running other code, but it's difficult to see exactly where it's
blocked. However, this change is very generally useful.

This change also runs scripted tests with GOTRACEBACK=system, upgrading
from GOTRACEBACK=all. Often, script tests can trigger failures deep in
the runtime in interesting ways because they start many individual Go
processes, so being able to identify points of interest in the runtime
is quite useful.

For #45916.

Change-Id: I3d50658d0d0090fb4c9182b87200d266c7f8f915
Reviewed-on: https://go-review.googlesource.com/c/go/+/316469
Trust: Michael Knyszek <mknyszek@google.com>
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2021-05-04 17:32:31 +00:00
Ariel Mashraki
10d625d5b4 database/sql: add NullInt16 and NullByte
Fixes #40082

Change-Id: I01cd4d0e23c0376a6ee6e0b196c9f840cd662325
Reviewed-on: https://go-review.googlesource.com/c/go/+/311572
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
Reviewed-by: Daniel Theophanes <kardianos@gmail.com>
Run-TryBot: Emmanuel Odeke <emmanuel@orijtech.com>
TryBot-Result: Go Bot <gobot@golang.org>
2021-05-04 17:31:29 +00:00
Ian Lance Taylor
371ea545c0 net/url: avoid string concatenation in resolvePath
ame                  old time/op    new time/op    delta
String-12               8.09µs ± 7%    8.20µs ± 5%     ~     (p=0.347 n=20+19)
ResolvePath-12           223ns ± 8%     170ns ± 7%  -23.84%  (p=0.000 n=20+19)
QueryEscape/#00-12      72.9ns ± 5%    73.6ns ± 6%     ~     (p=0.337 n=20+20)
QueryEscape/#01-12       467ns ± 5%     467ns ± 7%     ~     (p=0.612 n=19+20)
QueryEscape/#02-12       257ns ± 8%     262ns ± 8%     ~     (p=0.080 n=20+20)
QueryEscape/#03-12       553ns ±12%     568ns ± 8%   +2.73%  (p=0.048 n=20+19)
QueryEscape/#04-12      4.45µs ± 7%    4.52µs ± 5%     ~     (p=0.163 n=20+20)
PathEscape/#00-12        119ns ± 9%     121ns ± 6%     ~     (p=0.140 n=20+20)
PathEscape/#01-12        458ns ± 7%     483ns ± 4%   +5.49%  (p=0.000 n=20+20)
PathEscape/#02-12        255ns ± 7%     257ns ± 7%     ~     (p=0.560 n=20+20)
PathEscape/#03-12        556ns ± 8%     559ns ± 8%     ~     (p=0.799 n=20+20)
PathEscape/#04-12       4.14µs ± 6%    4.28µs ± 8%   +3.30%  (p=0.003 n=20+20)
QueryUnescape/#00-12    72.2ns ± 8%    74.9ns ± 5%   +3.66%  (p=0.006 n=20+19)
QueryUnescape/#01-12     223ns ± 7%     230ns ± 8%   +2.84%  (p=0.016 n=20+20)
QueryUnescape/#02-12     200ns ± 7%     203ns ±10%     ~     (p=0.533 n=20+20)
QueryUnescape/#03-12     480ns ± 7%     500ns ± 8%   +4.15%  (p=0.006 n=20+20)
QueryUnescape/#04-12    2.61µs ± 8%    2.70µs ± 7%   +3.39%  (p=0.009 n=20+20)
PathUnescape/#00-12     74.6ns ± 6%    75.4ns ± 6%     ~     (p=0.425 n=20+20)
PathUnescape/#01-12      226ns ± 3%     227ns ± 8%     ~     (p=0.453 n=15+20)
PathUnescape/#02-12      202ns ±11%     202ns ± 6%     ~     (p=0.963 n=20+20)
PathUnescape/#03-12      484ns ± 9%     494ns ± 9%     ~     (p=0.078 n=20+19)
PathUnescape/#04-12     2.60µs ± 6%    2.61µs ± 8%     ~     (p=0.776 n=20+19)
Split-12                6.47ns ± 0%    6.47ns ± 0%     ~     (p=0.760 n=18+18)

name                  old alloc/op   new alloc/op   delta
String-12               1.50kB ± 0%    1.50kB ± 0%     ~     (all equal)
ResolvePath-12           24.0B ± 0%     16.0B ± 0%  -33.33%  (p=0.000 n=20+20)
QueryEscape/#00-12       8.00B ± 0%     8.00B ± 0%     ~     (all equal)
QueryEscape/#01-12       64.0B ± 0%     64.0B ± 0%     ~     (all equal)
QueryEscape/#02-12       32.0B ± 0%     32.0B ± 0%     ~     (all equal)
QueryEscape/#03-12       64.0B ± 0%     64.0B ± 0%     ~     (all equal)
QueryEscape/#04-12        832B ± 0%      832B ± 0%     ~     (all equal)
PathEscape/#00-12        16.0B ± 0%     16.0B ± 0%     ~     (all equal)
PathEscape/#01-12        64.0B ± 0%     64.0B ± 0%     ~     (all equal)
PathEscape/#02-12        32.0B ± 0%     32.0B ± 0%     ~     (all equal)
PathEscape/#03-12        64.0B ± 0%     64.0B ± 0%     ~     (all equal)
PathEscape/#04-12         704B ± 0%      704B ± 0%     ~     (all equal)
QueryUnescape/#00-12     8.00B ± 0%     8.00B ± 0%     ~     (all equal)
QueryUnescape/#01-12     24.0B ± 0%     24.0B ± 0%     ~     (all equal)
QueryUnescape/#02-12     24.0B ± 0%     24.0B ± 0%     ~     (all equal)
QueryUnescape/#03-12     64.0B ± 0%     64.0B ± 0%     ~     (all equal)
QueryUnescape/#04-12      320B ± 0%      320B ± 0%     ~     (all equal)
PathUnescape/#00-12      8.00B ± 0%     8.00B ± 0%     ~     (all equal)
PathUnescape/#01-12      24.0B ± 0%     24.0B ± 0%     ~     (all equal)
PathUnescape/#02-12      24.0B ± 0%     24.0B ± 0%     ~     (all equal)
PathUnescape/#03-12      64.0B ± 0%     64.0B ± 0%     ~     (all equal)
PathUnescape/#04-12       320B ± 0%      320B ± 0%     ~     (all equal)

name                  old allocs/op  new allocs/op  delta
String-12                 63.0 ± 0%      63.0 ± 0%     ~     (all equal)
ResolvePath-12            3.00 ± 0%      2.00 ± 0%  -33.33%  (p=0.000 n=20+20)
QueryEscape/#00-12        1.00 ± 0%      1.00 ± 0%     ~     (all equal)
QueryEscape/#01-12        1.00 ± 0%      1.00 ± 0%     ~     (all equal)
QueryEscape/#02-12        1.00 ± 0%      1.00 ± 0%     ~     (all equal)
QueryEscape/#03-12        1.00 ± 0%      1.00 ± 0%     ~     (all equal)
QueryEscape/#04-12        2.00 ± 0%      2.00 ± 0%     ~     (all equal)
PathEscape/#00-12         1.00 ± 0%      1.00 ± 0%     ~     (all equal)
PathEscape/#01-12         1.00 ± 0%      1.00 ± 0%     ~     (all equal)
PathEscape/#02-12         1.00 ± 0%      1.00 ± 0%     ~     (all equal)
PathEscape/#03-12         1.00 ± 0%      1.00 ± 0%     ~     (all equal)
PathEscape/#04-12         2.00 ± 0%      2.00 ± 0%     ~     (all equal)
QueryUnescape/#00-12      1.00 ± 0%      1.00 ± 0%     ~     (all equal)
QueryUnescape/#01-12      1.00 ± 0%      1.00 ± 0%     ~     (all equal)
QueryUnescape/#02-12      1.00 ± 0%      1.00 ± 0%     ~     (all equal)
QueryUnescape/#03-12      1.00 ± 0%      1.00 ± 0%     ~     (all equal)
QueryUnescape/#04-12      1.00 ± 0%      1.00 ± 0%     ~     (all equal)
PathUnescape/#00-12       1.00 ± 0%      1.00 ± 0%     ~     (all equal)
PathUnescape/#01-12       1.00 ± 0%      1.00 ± 0%     ~     (all equal)
PathUnescape/#02-12       1.00 ± 0%      1.00 ± 0%     ~     (all equal)
PathUnescape/#03-12       1.00 ± 0%      1.00 ± 0%     ~     (all equal)
PathUnescape/#04-12       1.00 ± 0%      1.00 ± 0%     ~     (all equal)

Fixes #43587

Change-Id: I66c47e78e92555180ce3554a2d4a21038362c41e
Reviewed-on: https://go-review.googlesource.com/c/go/+/282673
Trust: Ian Lance Taylor <iant@golang.org>
Trust: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
2021-05-04 16:10:58 +00:00
Bryan C. Mills
62d424d794 cmd: update x/tools to pull in CL 315570
Since x/tools is now lazy, this removes a significant fraction of
otherwise-irrelevant dependencies from the go.sum file.

The remaining extraneous go.sum lines come from the dependency on
github.com/google/pprof. Since that module is outside of the Go
project proper, I do not plan to submit a PR to make it lazy until
after the Go 1.17 release.

For #36460
Updates #36905

Change-Id: I214492cf931fca797817124ecdcbccd4ebb7505b
Reviewed-on: https://go-review.googlesource.com/c/go/+/316452
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Alexander Rakoczy <alex@golang.org>
2021-05-04 15:37:42 +00:00
Bryan C. Mills
eab0c46af7 cmd/go/internal/modload: remove outdated comments and redundant tests
The outdated comment in modfile.go was missed in CL 315409.

Upon a closer look at the test case in mod_go_version_vendor.txt, it
is almost completely redundant with the new test in
mod_vendor_goversion.txt. Make it completely redundant and remove it.

Updates #36876

Change-Id: Ibcd1f6b426460aaafbd6dc0be93078547904572b
Reviewed-on: https://go-review.googlesource.com/c/go/+/316209
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2021-05-04 15:30:20 +00:00
Bryan C. Mills
0816511d3b all: update x/crypto to pull in CL 316109
Because x/crypto is now lazy, this removes the remaining checksums for
older-than-selected dependencies from src/go.sum.

It also removes a significant fraction of the irrelevant checksums
from src/cmd/go.sum.

For #36460
Updates #36905

Change-Id: I33af5fc638aa1d1c66df3a1d86542912e95a7f50
Reviewed-on: https://go-review.googlesource.com/c/go/+/316451
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Alexander Rakoczy <alex@golang.org>
2021-05-04 15:28:49 +00:00
Bryan C. Mills
8e38b80b64 cmd: update x/text to pull in CL 315571
Because x/text is now lazy, the go.sum file no longer needs a checksum
for the go.mod file for the outdated x/tools required by x/text.

For #36460
Updates #36905

Change-Id: Id7395e61909af3889c1615dc33139e5bb45504c5
Reviewed-on: https://go-review.googlesource.com/c/go/+/316490
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Alexander Rakoczy <alex@golang.org>
2021-05-04 15:28:42 +00:00
Bryan C. Mills
1bbe78bb6d cmd: update x/mod to pull in CL 316113
Even though x/mod is now lazy, this has no immediate effect on the
size of cmd/go.sum: all of the existing dependencies are still pulled
in via the dependency on x/tools, which is itself not yet lazy (that's
CL 315570).

For #36460
Updates #36905

Change-Id: I7bce5fe2596a2d71e4df08f5d5f4cb8dcdb8512c
Reviewed-on: https://go-review.googlesource.com/c/go/+/316489
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Alexander Rakoczy <alex@golang.org>
2021-05-04 15:28:35 +00:00
Bryan C. Mills
86e42c2fbf cmd/go: suppress SSH password prompts when fetching modules or repos
We were already setting GIT_SSH_COMMAND (if unset) to explicitly
include 'ControlMaster=no' in order to disable connection pooling.
Now we also set 'BatchMode=yes' to suppress password prompts for
password-protected keys.

While we're here, we also set GCM_INTERACTIVE=never to suppress
similar prompts from the Git Credential Manager for Windows.

Fixes #44904

Change-Id: Iebb050079ff7dd54d5b944c459ae212e9e6f2579
Reviewed-on: https://go-review.googlesource.com/c/go/+/300157
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2021-05-04 15:03:06 +00:00
Keith Randall
5e4f9b077f cmd/compile: when compiling with -N, avoid entry block
Lots of constant SSA values we put in the entry block so that
CSE can easily combine them. With -N, however, we don't run CSE, so
putting values in the entry block only serves to extend their lifetime
for no benefit.

Fixes #45897. The number of live SSA values per block goes from >5K to 22.
Memory use goes from ~3GB to ~400MB.

Change-Id: I620b423611790a900e0d4cd270eac5dbdddf2a2b
Reviewed-on: https://go-review.googlesource.com/c/go/+/316369
Trust: Keith Randall <khr@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
2021-05-04 14:38:36 +00:00
David Chase
0921211403 cmd/compile: preserve/translate names for parameters
This is part of getting debugging into good shape
with the register ABI.  (This may generate a backport
for 1.16, there was some regression there as well.)

This is not necessarily fully-baked yet; my goal is to
make it work "well enough" for actual debugging, then
revisit the metrics, which are currently ignorant
of registers used for passing parameters (currently,
rejects them as a valid option).

Updates #40724.

Change-Id: Ib649adf39f947b7b54895c5bf181cf48ca4d38a0
Reviewed-on: https://go-review.googlesource.com/c/go/+/311689
Trust: David Chase <drchase@google.com>
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2021-05-04 13:37:39 +00:00
Tobias Klauser
830e63a7a3 syscall: add //go:build lines to assembly files
Change-Id: Ie296af523d70def269f9fb2ae35dfd2893abb2d9
Reviewed-on: https://go-review.googlesource.com/c/go/+/315275
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-05-04 12:47:05 +00:00
Tobias Klauser
45600bcd61 os, syscall: use wait6 to avoid wait/kill race on netbsd
Follow CL 23967 and CL 24021 which did the same on linux and freebsd,
respectively.

Updates #13987
Updates #16028

Change-Id: I95b13d8ddde4cea1ef4fb7d655f1ad1a219d13aa
Reviewed-on: https://go-review.googlesource.com/c/go/+/315281
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-05-04 12:44:42 +00:00
EndlessCheng
138d2c9b88 strconv: fix a typo
Change-Id: I17911dc95fb2126b41dc95f8839c4b3fa8f35d12
GitHub-Last-Rev: 88e1203293
GitHub-Pull-Request: golang/go#45933
Reviewed-on: https://go-review.googlesource.com/c/go/+/316689
Reviewed-by: Robert Griesemer <gri@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-05-04 03:22:47 +00:00
Joe Tsai
e3769299cd strconv: add QuotedPrefix
QuotedPrefix is similar to Unquote, but returns the quoted string verbatim
and ignores any data after the quoted string.

Fixes #45033

Change-Id: I9f69fe9e3e45cbe9e63581cf1b457facb625045d
Reviewed-on: https://go-review.googlesource.com/c/go/+/314775
Trust: Joe Tsai <joetsai@digital-static.net>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
2021-05-04 00:56:00 +00:00
Colin Arnott
2422c5eae5 sync/atomic: add (*Value).Swap and (*Value).CompareAndSwap
The functions SwapPointer and CompareAndSwapPointer can be used to
interact with unsafe.Pointer, however generally it is prefered to work
with Value, due to its safer interface. As such, they have been added
along with glue logic to maintain invariants Value guarantees.

To meet these guarantees, the current implementation duplicates much of
the Store function. Some of this is due to inexperience with concurrency
and desire for correctness, but the lack of generic programming
functionality does not help.

Fixes #39351

Change-Id: I1aa394b1e70944736ac1e19de49fe861e1e46fba
Reviewed-on: https://go-review.googlesource.com/c/go/+/241678
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2021-05-04 00:15:27 +00:00
Ian Lance Taylor
496d7c6914 text/template: add lock for Template.tmpl to fix data race
This adds a new lock protecting "tmpl".

This is a copy of https://golang.org/cl/257817 by Andreas Fleig,
updated for current tip, and updated to start running the
html/template TestEscapeRace test.

Thanks to @bep for providing the test case.

Fixes #39807

Change-Id: Ic8874484290283a49116812eeaffb8608346dc70
Reviewed-on: https://go-review.googlesource.com/c/go/+/316669
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2021-05-04 00:03:39 +00:00
Cherry Zhang
731a015ab8 internal/syscall/unix: use internal/abi.FuncPC for syscall wrapper
Following CL 313230, this is for internal/syscall/unix package.

Updates #45702.

Change-Id: Ie6d8c1923dfeae56896212393c5c2a6e257648d2
Reviewed-on: https://go-review.googlesource.com/c/go/+/316649
Trust: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
2021-05-03 22:59:55 +00:00
Colin Arnott
e8eb1d8269 math: add MaxUint, MinInt, MaxInt
Since we have int8 to int64 min max and uint8 to uint64 max constants,
we should probably have some for the word size types too. This change
also adds tests to validate the correctness of all integer limit
values.

Fixes #28538

Change-Id: Idd25782e98d16c2abedf39959b7b66e9c4c0c98b
Reviewed-on: https://go-review.googlesource.com/c/go/+/247058
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Robert Griesemer <gri@golang.org>
2021-05-03 22:44:33 +00:00
Brad Fitzpatrick
ed5ebd32b3 os: update some docs to reference fs.ErrFoo instead of os.ErrFoo
Change-Id: I8b771f407028406a6ec9a1f2500c806054961267
Reviewed-on: https://go-review.googlesource.com/c/go/+/313569
Trust: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-05-03 22:01:04 +00:00
Eddie Scholtz
ddb648fdf6 archive/zip: add File.OpenRaw, Writer.CreateRaw, Writer.Copy
These new methods provide support for cases where performance is a
primary concern. For example, copying files from an existing zip to a
new zip without incurring the decompression and compression overhead.
Using an optimized, external compression method and writing the output
to a zip archive. And compressing file contents in parallel and then
sequentially writing the compressed bytes to a zip archive.

TestWriterCopy is copied verbatim from https://github.com/rsc/zipmerge

Fixes #34974

Change-Id: Iade5bc245ba34cdbb86364bf59f79f38bb9e2eb6
Reviewed-on: https://go-review.googlesource.com/c/go/+/312310
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Carlos Amedee <carlos@golang.org>
2021-05-03 21:11:47 +00:00
Dmitri Shuralyov
9f347035ef cmd/api: disallow silent API additions after api/go1.n.txt is created
At this time, the golang.org/s/release process arranges such that the
api/go1.n.txt file is created when a Go 1.N Beta 1 release is being cut.
The API check is currently configured so that tests don't fail visibly
even if api/go1.n.txt becomes a subset of the actual API additions in
the upcoming Go 1.N release as long as 'go version' has "devel" in it.
The first time that 'go version' output drops the "devel" substring
during testing is after the release-branch.go1.N branch is created
as part of the process to cut a Go 1.N Release Candidate 1 release.

The month or so between Beta 1 and RC 1 is well into the freeze and
deliberate API changes are rare and very intentional. There seems to
be agreement that it's healthy to make the API check stricter during
that time period. Doing so will ensure that api/go1.n.txt cannot get
stale after creation without anyone noticing, and may catch CLs that
don't have the intended diff on the API.

This CL changes behavior to be simple and clear: from the moment
an api/go1.n.txt file corresponding to the current Go version in
development is added to the tree, silent API additions stop being
permitted.

This CL also moves the magical "override the value of -allow_new flag
if runtime.Version() contains 'devel' string" behavior from cmd/api
command to the run.go script that calls it, making the CLI of cmd/api
itself less surprising.

Fixes #43956.

Change-Id: I89468207573f7ccdbc9f12625dcdd3ef2bcf8f10
Reviewed-on: https://go-review.googlesource.com/c/go/+/315350
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
Trust: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Alexander Rakoczy <alex@golang.org>
2021-05-03 19:14:16 +00:00
Bryan C. Mills
791854700d all: update x/net to pull in CL 316129
As a side effect, this also upgrades x/sys to the version currently
required by the latest x/net.

Because x/net is now lazy, it no longer requires checksums for
older-than-selected versions of x/sys, x/term, and x/text.

For #36460
Updates #36905

Change-Id: I242815e202aa7d482fc3983a6717bece10ea8111
Reviewed-on: https://go-review.googlesource.com/c/go/+/316251
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2021-05-03 18:23:49 +00:00
Bryan C. Mills
a144af9136 cmd: update x/term to pull in CL 316112
Even though x/term is now lazy, this has no overall effect (yet) on
the contents of cmd/go.sum, because the dependency that would be
pruned out (an old version of x/sys) is still transitively required
through x/crypto, x/sys, and/or x/tools.

Once those modules are also lazy (CL 316109, CL 316111, and CL 315570
respectively), the extra go.sum entries for x/sys will drop out.

For #36460
Updates #36905

Change-Id: I79e715328f7c417ea20ae8fe4f8e0e3eb71ee6c7
Reviewed-on: https://go-review.googlesource.com/c/go/+/316250
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2021-05-03 18:23:31 +00:00
David Chase
8a4b7294af cmd/compile: fix possible nil deref added in CL 270943
In the event allocSpan returned a nil, this would crash.
Cleaned up the code and comments slightly, too.

Change-Id: I6231d4b4c14218e6956b4a97a205adc3206f59ec
Reviewed-on: https://go-review.googlesource.com/c/go/+/316429
Trust: David Chase <drchase@google.com>
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2021-05-03 18:17:42 +00:00
Cuong Manh Le
7f9febd4a1 cmd/compile: fix linux-amd64-noopt builder
CL 312214 added unsafe.{Add,Slice}, which may appears in expression that
evaluating requires function calls. "mayCall" does not handle that
case, causing linux-amd64-noopt builder failed.

Fixes #45917

Change-Id: I900aefb702122480be621355def3d2c20eadbe70
Reviewed-on: https://go-review.googlesource.com/c/go/+/316170
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2021-05-03 17:49:50 +00:00
David Chase
90ec257735 cmd/compile: make the stack allocator more careful about register args.
Assignment between input parameters causes them to have more than
one "Name", and running this backwards from names to values can end
up confusing (conflating) parameter spill slots.

Around 105a6e9518, this cases a stack overflow running
go test -race encoding/pem
because two slice parameters spill (incorrectly) into the same
stack slots (in the AB?I-defined parameter spill area).

This also tickles a failure in cue, which turned out to be
easier to isolate.

Fixes #45851.
Updates #40724.

Change-Id: I39c56815bd6abb652f1ccbe83c47f4f373a125c3
Reviewed-on: https://go-review.googlesource.com/c/go/+/313212
Trust: David Chase <drchase@google.com>
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2021-05-03 17:46:12 +00:00
Roland Shoemaker
b584230889 net/http: use relative path in Location redirect
If the cleaned path did not match the requested path, ServeMux.Handler
would return a Location header which reflected the hostname in the
request, possibly leading to an incorrect redirect. Instead the
Location header should be relative, like the other cases in
ServeMux.Handler.

Change-Id: I2c220d925e708061bc128f0bdc96cca7a32764d3
Reviewed-on: https://go-review.googlesource.com/c/go/+/313950
Trust: Roland Shoemaker <roland@golang.org>
Trust: Katie Hockman <katie@golang.org>
Run-TryBot: Roland Shoemaker <roland@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Katie Hockman <katie@golang.org>
2021-05-03 17:34:10 +00:00
Alessandro Arzilli
169155d61e cmd/compile: preserve argument order in debug_info
When regabi is used sorting by stack offset will not preserve the order
of function arguments. Trust that variables are already ordered
correctly when creating debug_info entries.

Fixes #45720

Change-Id: I1dbdd185975273f70244a23302d34f082347603d
Reviewed-on: https://go-review.googlesource.com/c/go/+/315280
Reviewed-by: Than McIntosh <thanm@google.com>
Trust: Jeremy Faller <jeremy@golang.org>
2021-05-03 16:42:22 +00:00
Than McIntosh
472f519fe2 cmd/compile/internal/ssagen: fix misleading comment
Fix up a slightly stale comment in the part of ssa generation that
zeros ambiguously live variables: with the advent of the register ABI,
the ir.Func "Dcl" slice is no longer entirely sorted by frame offset,
although this is still the case for the local vars in Dcl.

Change-Id: I633f43d16f0d4e0b444193a6edb6b2aa1154eea7
Reviewed-on: https://go-review.googlesource.com/c/go/+/316309
Trust: Than McIntosh <thanm@google.com>
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2021-05-03 16:31:10 +00:00
Dan Scales
d75fbac54d cmd/compile: add edge from lock rank edge from forceGC to traceStackTab
This edge can happen when forcegchelper() calls
goparkunlock(&forcegc.lock, ...) while holding the forcegc lock.
goparkunlock() eventually calls park_m(). In park_m(), traceGoPark()
(which leads to (*traceStackTable).put() and acquires the traceStackTab
lock) can be called before the forcegc lock is released.

Fixes #45774

Change-Id: If0fceab596712eb9ec0b9b47326778bc0ff80913
Reviewed-on: https://go-review.googlesource.com/c/go/+/316029
Run-TryBot: Dan Scales <danscales@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Trust: Carlos Amedee <carlos@golang.org>
2021-05-03 16:25:05 +00:00
Robert Griesemer
7b768d43d0 math: replace float32/64 extrema with exact expressions
Follow-up on https://golang.org/cl/315170.

Updates #44057.
Updates #44058.

Change-Id: I0b071e8ee7a1c97aae2436945cc9583cde3b40b0
Reviewed-on: https://go-review.googlesource.com/c/go/+/315969
Trust: Robert Griesemer <gri@golang.org>
Trust: Emmanuel Odeke <emmanuel@orijtech.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Russ Cox <rsc@golang.org>
2021-05-03 16:23:09 +00:00
Cherry Zhang
be1da9cdee cmd/link: unify text segment write
Currently we have two code paths of writing the text segment. They
are semantically the same:

- if we split text sections, we write all ".text" sections as
  text and the the rest as data.
- if we do not split text sections, we write the first section
  as text and the rest as data. The first section is named ".text"
  and is the only one in this case.

Unify the code.

Change-Id: Ic639eed625615be3c8a8d41f5b47e901552f587a
Reviewed-on: https://go-review.googlesource.com/c/go/+/316049
Trust: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
2021-05-03 16:20:10 +00:00
Cherry Zhang
8327d2150f cmd/compile: add traceback argument info to ABI0 assembly functions
For ABI0 assembly functions that have Go declarations, generate
traceback argument info and attach it to the assembly functions.
So we can print argument in tracebacks if e.g. assembly function
panics.

Only do this for ABI0 functions, as for ABIInternal assembly
functions it is likely that they never spill arguments to memory.

Change-Id: I7e601ccd9aded5e6af2f02be975bf81ff9948f4d
Reviewed-on: https://go-review.googlesource.com/c/go/+/315870
Trust: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
2021-05-03 15:53:36 +00:00
Cuong Manh Le
844e1fc6f1 cmd/compile: make typecheckaste correctly report invalid use of "..."
Currently, when "..." argument is passed to non-variadic function, the
compiler may skip that check, but continue checking whether the number
of arguments matches the function signature.

That causes the sanity check which was added in CL 255241 trigger.

Instead, we should report an invalid use of "...", which matches the
behavior of new type checker and go/types.

Fixes #45913

Change-Id: Icbb254052cbcd756bbd41f966c2c8e316c44420f
Reviewed-on: https://go-review.googlesource.com/c/go/+/315796
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2021-05-03 15:03:57 +00:00
Lynn Boger
9ed736ac2a cmd/link/internal: fix use of DynlinkingGo with ppc64le trampolines
When creating programs with large text sections on ppc64le,
trampolines are needed for calls that are too far; however
they are not created if the code is generated such that the TOC
register r2 is initialized and maintained in the code because
then the external linker can create the trampolines. Previously
the function DynlinkingGo was used to determine this but in the
case where plugins are used, this could return true even though
r2 is not valid.

To fix this problem I've added a new function r2Valid which returns
true when the build options indicate that the r2 is
initialized and maintained. Because of the ways that
DynlinkingGo is used I wanted to maintain its previous
behavior.

Fixes #45850

Change-Id: I6d902eba6ad41757aa6474948b79acdbd479cb38
Reviewed-on: https://go-review.googlesource.com/c/go/+/315289
Trust: Lynn Boger <laboger@linux.vnet.ibm.com>
Run-TryBot: Lynn Boger <laboger@linux.vnet.ibm.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
2021-05-03 12:26:15 +00:00
Lynn Boger
30674ae91b cmd/dist: disable misc/cgo/testsanitizers on ppc64le
A while back in this release the sanitizer tests were enabled
for ppc64le, where previously they were never run. This
uncovered some errors in these tests on ppc64le. One linker
fix was made but there are still bugs in how tsan is made to
work within the code, especially in how signals are enabled
with cgo.

Some attempts were made to make this work but intermittent
failures continue to happen with the Trybots so I am just
going to disable this test for ppc64le within cmd/dist.

Updates #45040

Change-Id: I5392368ccecd4079ef568d0c645c9f7c94016d99
Reviewed-on: https://go-review.googlesource.com/c/go/+/315430
Run-TryBot: Lynn Boger <laboger@linux.vnet.ibm.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Cherry Zhang <cherryyz@google.com>
2021-05-03 12:20:09 +00:00
Bryan C. Mills
2c9f5a1da8 cmd: update x/arch to pull in CL 315572
Because x/arch is now lazy, this removes the checksum for rsc.io/pdf
from the go.sum file: the requirements of rsc.io/pdf are known not to
be relevant to any package imported within the cmd packages.

For #36460
Updates #36905

Change-Id: I3abb6a8029cd0c9099b592ccb01ca5606c93edec
Reviewed-on: https://go-review.googlesource.com/c/go/+/316110
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2021-05-03 01:35:44 +00:00
Tobias Klauser
abb110bf3d os/user: implement (*User).GroupIds on solaris
It seems like getgrouplist is supported since Solaris 11.3 (released in
2016):
https://docs.oracle.com/cd/E86824_01/html/E54766/getgrouplist-3c.html

Use it to implement (*User).GroupIds on solaris, like on other Unix
platforms.

Unfortunately it looks like getgrouplist was added to illumos only
fairly recently, see
f2c438c505

Thus, don't use it on GOOS=illumos for now.

Updates #14709

Change-Id: Ibfcdbfca6b7d1af96630512d08921e5637ca76d4
Reviewed-on: https://go-review.googlesource.com/c/go/+/315278
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-05-02 21:27:08 +00:00
Tobias Klauser
b177b2d51e os, syscall: use wait6 to avoid wait/kill race on dragonfly
Follow CL 23967 and CL 24021 which did the same on linux and freebsd,
respectively.

Updates #13987
Updates #16028

Change-Id: Ia30ef8b5cffd8f9eb75c29ee5fe350dac2be6d44
Reviewed-on: https://go-review.googlesource.com/c/go/+/315279
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-05-02 21:26:09 +00:00
Tobias Klauser
7eb2d30883 syscall: add //go:build lines to files generated with with mksyscall_libc.pl
Change-Id: I2e02d02d9208fc2dbf01c0cea4a67c288967cd07
Reviewed-on: https://go-review.googlesource.com/c/go/+/315276
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-05-02 21:24:28 +00:00
Kevin Burke
bb09f8a29b time: make time.Time print a valid Go string with %#v
Previously calling fmt.Sprintf("%#v", t) on a time.Time value would
yield a result like:

    time.Time{wall:0x0, ext:63724924180, loc:(*time.Location)(nil)}

which does not compile when embedded in a Go program, and does not
tell you what value is represented at a glance.

This change adds a GoString method that returns much more legible
output:

    "time.Date(2009, time.February, 5, 5, 0, 57, 12345600, time.UTC)"

which gives you more information about the time.Time and also can be
usefully embedded in a Go program without additional work.

Update Quote() to hex escape non-ASCII characters (copying logic
from strconv), which makes it safer to embed them in the output of
GoString().

Fixes #39034.

Change-Id: Ic985bafe4e556f64e82223c643f65143c9a45c3b
Reviewed-on: https://go-review.googlesource.com/c/go/+/267017
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Emmanuel Odeke <emmanuel@orijtech.com>
2021-05-02 20:59:26 +00:00
Matthew Dempsky
fadad851a3 cmd/compile: implement unsafe.Add and unsafe.Slice
Updates #19367.
Updates #40481.

Change-Id: Iabd2afdd0d520e5d68fd9e6dedd013335a4b3886
Reviewed-on: https://go-review.googlesource.com/c/go/+/312214
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Trust: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Keith Randall <khr@golang.org>
2021-05-02 20:38:13 +00:00
Ian Lance Taylor
0d32d9e8a8 os: document that Windows Symlink to missing target creates file symlink
Fixes #39183

Change-Id: Iec4a5a561182ade57dc7dc24247710005d6b9f21
Reviewed-on: https://go-review.googlesource.com/c/go/+/314275
Trust: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
Run-TryBot: Emmanuel Odeke <emmanuel@orijtech.com>
TryBot-Result: Go Bot <gobot@golang.org>
2021-05-02 18:22:19 +00:00
Vitaly Zdanevich
352a322a83 path/filepath: fix documentation typo (was "each each")
Change-Id: I8dcf6c4489e16e91b8685c31569297cfeb700f9d
GitHub-Last-Rev: f6b40e0298
GitHub-Pull-Request: golang/go#45905
Reviewed-on: https://go-review.googlesource.com/c/go/+/316009
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Kevin Burke <kev@inburke.com>
Trust: Kevin Burke <kev@inburke.com>
2021-05-02 18:13:38 +00:00
Cherry Zhang
053fe2f485 cmd/link: emit better error for duplicated definition
Print the packages where the duplicates come from.

Change-Id: Ib3dc9aa0a3f5ddd97b03744be6d01d4bfcb33996
Reviewed-on: https://go-review.googlesource.com/c/go/+/315949
Trust: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
2021-05-01 19:17:47 +00:00
Cherry Zhang
d7473fd907 cmd/link: mangle ABI name for shared linkage
Currently, when ABI wrappers are used, we don't use ABI aliases.
One exception is shared linkage. When loading a shared library, if
a symbol has only one ABI, and the name is not mangled, we don't
know what ABI it is, so we have to use ABI aliases.

This CL makes it always mangle ABIInternal function name in shared
linkage, so we know what ABI to choose when loading a shared
library. And we now can fully stop using ABI aliases when ABI
wrappers are used.

Change-Id: Id15d9cd72a59f391f54574710ebba7dc44cb6e23
Reviewed-on: https://go-review.googlesource.com/c/go/+/315869
Trust: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
2021-05-01 19:17:12 +00:00
Rob Findley
879db69ce2 go/types: list errors by default in TestManual
This is a port of CL 315729 to go/types, adjusted for the slightly
different test set-up in go/types.

Added a TODO to reconcile these differences.

Change-Id: I71cae712d8fc23b7311ce35e09168b258e07fa35
Reviewed-on: https://go-review.googlesource.com/c/go/+/315850
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2021-05-01 11:43:19 +00:00
Rob Findley
a9db5a7386 go/types: simplify use of TestManual
This is a 1:1 port of CL 315689 to go/types.

Change-Id: If71186b3719be8433c9d21b22c51ffde2cadd55b
Reviewed-on: https://go-review.googlesource.com/c/go/+/315849
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2021-05-01 11:42:49 +00:00