]> Cypherpunks repositories - gostls13.git/log
gostls13.git
5 years agotext/template/parse: remove redundant return
Ariel Mashraki [Thu, 23 Jan 2020 21:00:29 +0000 (23:00 +0200)]
text/template/parse: remove redundant return

Change the `itemChar` clause to be like all other clauses
that don't return a different state function than the default.

Change-Id: I56c863a7d699c1264b24b42ef23138ec47eaacd8
Reviewed-on: https://go-review.googlesource.com/c/go/+/216117
Reviewed-by: Rob Pike <r@golang.org>
Run-TryBot: Rob Pike <r@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years agocrypto/x509: mitigate CVE-2020-0601 verification bypass on Windows
Filippo Valsorda [Tue, 21 Jan 2020 19:45:15 +0000 (14:45 -0500)]
crypto/x509: mitigate CVE-2020-0601 verification bypass on Windows

An attacker can trick the Windows system verifier to use a poisoned set
of elliptic curve parameters for a trusted root, allowing it to generate
spoofed signatures. When this happens, the returned chain will present
the unmodified original root, so the actual signatures won't verify (as
they are invalid for the correct parameters). Simply double check them
as a safety measure and mitigation.

Windows users should still install the system security patch ASAP.

This is the same mitigation adopted by Chromium:

https://chromium-review.googlesource.com/c/chromium/src/+/1994434

Change-Id: I2c734f6fb2cb51d906c7fd77034318ffeeb3e146
Reviewed-on: https://go-review.googlesource.com/c/go/+/215905
Run-TryBot: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ryan Sleevi <sleevi@google.com>
Reviewed-by: Katie Hockman <katie@golang.org>
5 years agocmd/link: ensure cgo cflags do not leak into tvOS test
Carlos Amedee [Wed, 22 Jan 2020 20:30:52 +0000 (15:30 -0500)]
cmd/link: ensure cgo cflags do not leak into tvOS test

Running the 'TestBuildForTvOS' test with CGO_CFLAGS set
with certain values would cause the test to fail. all.bash
would fail when CGO_CFLAGS was set to '-mmacosx-version-min=10.10'
because the --macosx-version-min flag is incompatible with tvOS.
The change guards against using an unintended flag in the unit test.

Updates #35459

Change-Id: Ifc43f3ebfb23d37aabeaac2ea9efae5b877991bf
Reviewed-on: https://go-review.googlesource.com/c/go/+/215957
Run-TryBot: Carlos Amedee <carlos@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agotime: document how Parse handles two-digit years
Kirill Tatchihin [Thu, 23 Jan 2020 16:14:40 +0000 (16:14 +0000)]
time: document how Parse handles two-digit years

Fixes #36549

Change-Id: Ia803330fc046d5807bbefd67acb419cb81640a13
GitHub-Last-Rev: bd354319083bf80c250e1915f2be6860d2f7d14b
GitHub-Pull-Request: golang/go#36584
Reviewed-on: https://go-review.googlesource.com/c/go/+/214980
Reviewed-by: Rob Pike <r@golang.org>
5 years agocmd/go: add a control case to the mod_vendor_trimpath test
Bryan C. Mills [Thu, 23 Jan 2020 17:51:26 +0000 (12:51 -0500)]
cmd/go: add a control case to the mod_vendor_trimpath test

In reviewing CL 215940, it took me a while to find the control
condition for the test, which was located in build_cache_trimpath.txt.

We could consolidate the two tests, but since they check for
regressions of separate issues (with separate root-causes), I think it
makes sense to keep them separate.

However, I would like the control condition to be present in the same
source file, so that we'll be more likely to update both cases if the
behavior of one of them is changed.

Updates #36566

Change-Id: Ic588f1dfb7977dd78d1d5ef61b9841e22bad82e6
Reviewed-on: https://go-review.googlesource.com/c/go/+/216018
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
5 years agocmd/go: make Script/test_regexps less flaky under load
Daniel Martí [Tue, 21 Jan 2020 10:21:17 +0000 (10:21 +0000)]
cmd/go: make Script/test_regexps less flaky under load

With the command below, I was able to reproduce failures within the
first 50 or so runs:

go test -c -o test && stress -p 32 ./test -test.run Script/test_regexp

When printing the full failure output, we'd see:

BenchmarkX
    BenchmarkX: x_test.go:13: LOG: X running N=1
BenchmarkX/Y
    BenchmarkX/Y: x_test.go:15: LOG: Y running N=1
    BenchmarkX/Y: x_test.go:15: LOG: Y running N=100
    BenchmarkX/Y: x_test.go:15: LOG: Y running N=10000
    BenchmarkX/Y: x_test.go:15: LOG: Y running N=1000000
    BenchmarkX/Y: x_test.go:15: LOG: Y running N=100000000
    BenchmarkX/Y: x_test.go:15: LOG: Y running N=1000000000
BenchmarkX/Y          1000000000          0.000050 ns/op
    BenchmarkX/Y: x_test.go:15: LOG: Y running N=1
    BenchmarkX/Y: x_test.go:15: LOG: Y running N=30
    BenchmarkX/Y: x_test.go:15: LOG: Y running N=1207
    BenchmarkX/Y: x_test.go:15: LOG: Y running N=120700
    BenchmarkX/Y: x_test.go:15: LOG: Y running N=12070000
    BenchmarkX/Y: x_test.go:15: LOG: Y running N=1000000000
BenchmarkX/Y          1000000000          0.000715 ns/op

In other words, the N values aren't required to be exact. It seems like
they are cut short if the machine is under stress. That's the exact
scenario we reproduce above, since I used -p=32 on my laptop with only 4
real CPU cores.

First, don't require each line to be present. Instead, use patterns
that span multiple lines, so that we can just match the first and last
N= lines.

Second, don't require the last N= lines to be exact; simply require
them to have a reasonably large number of digits.

Fixes #36664.

Change-Id: I7a9818f1a07099fa6482a26da2ac5cbea0f8ab30
Reviewed-on: https://go-review.googlesource.com/c/go/+/215578
Run-TryBot: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years agocmd/go: unify trimpath logic for -mod=vendor, -mod=mod
Jay Conrod [Wed, 22 Jan 2020 23:46:11 +0000 (15:46 -0800)]
cmd/go: unify trimpath logic for -mod=vendor, -mod=mod

If a package has a module with a version, the package's directory is
replaced with the module path and version, followed by the package's
path within the module.

This is a follow up to CL 214945. We no longer check whether the
module has a directory (with -mod=vendor, it does not).

Updates #36566

Change-Id: I5bc952b13bc7b4659f58ee555bd6c6a087eb7792
Reviewed-on: https://go-review.googlesource.com/c/go/+/215940
Run-TryBot: Jay Conrod <jayconrod@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
5 years agoruntime: add missing code for linux/riscv64
Joel Sing [Wed, 22 Jan 2020 16:42:07 +0000 (03:42 +1100)]
runtime: add missing code for linux/riscv64

Makes linux/riscv64 runtime buildable.

Updates #27532

Change-Id: I91bcadaaecb8ff3ffd70fcb437b2b6e4bbe11eda
Reviewed-on: https://go-review.googlesource.com/c/go/+/215839
Run-TryBot: Joel Sing <joel@sing.id.au>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
5 years agocmd/internal/obj/riscv: restore the ADDI instruction in jalrToSym
Joel Sing [Wed, 22 Jan 2020 16:31:49 +0000 (03:31 +1100)]
cmd/internal/obj/riscv: restore the ADDI instruction in jalrToSym

While this instruction is not needed for the relocation (the lower immediate
can be patched directly into the JALR instruction), other code currently
depends on the jump sequence being 12 bytes (or three instructions) long.
Put the ADDI instruction back until these can be found and fixed.

Updates #27532

Change-Id: Idb73d716be8eb2eb796591b30f1ec4dc104f2bf8
Reviewed-on: https://go-review.googlesource.com/c/go/+/215840
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years agocmd/internal/obj/riscv: add missing instructions to the ternary expansion list
Joel Sing [Wed, 22 Jan 2020 16:33:54 +0000 (03:33 +1100)]
cmd/internal/obj/riscv: add missing instructions to the ternary expansion list

Updates #27532

Change-Id: I5beb7941c204755948350b181c713b046bc4f1f1
Reviewed-on: https://go-review.googlesource.com/c/go/+/215841
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years agocmd/dist: print error if GOROOT is inside a module
Jay Conrod [Wed, 22 Jan 2020 23:30:03 +0000 (15:30 -0800)]
cmd/dist: print error if GOROOT is inside a module

Fixes #36701

Change-Id: I22738235e7a7ee06bc5d748213aab523aad8cf12
Reviewed-on: https://go-review.googlesource.com/c/go/+/215939
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Marwan Sulaiman <marwan.sameer@gmail.com>
5 years agoRevert "net/http: support gzip, x-gzip Transfer-Encodings"
Filippo Valsorda [Wed, 22 Jan 2020 01:06:37 +0000 (01:06 +0000)]
Revert "net/http: support gzip, x-gzip Transfer-Encodings"

This reverts commit e6c12c3d0296251f1d5a96ebde811dbfd4a914fe.

Reason for revert: the assumption that a T-E of "gzip" implies
"chunked" seems incorrect. The RFC does state that one "MUST apply
chunked as the final transfer coding" but that should be interpreted to
mean that a "chunked" encoding must be listed as the last one, not that
one should be assumed to be there if not. This is confirmed by the
alternative option to chunking on the server side being to "terminate
the message by closing the connection".

The issue seems confirmed by the fact that the code in the body of
#29162 fails with the following error:

    net/http: HTTP/1.x transport connection broken: http: failed to gunzip body: unexpected EOF

This late in the cycle, revert rather than fix, also because we don't
apparently have tests for the correct behavior.

Change-Id: I920ec928754cd8e96a06fb7ff8a53316c0f959e5
Reviewed-on: https://go-review.googlesource.com/c/go/+/215757
Run-TryBot: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Katie Hockman <katie@golang.org>
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
5 years agoruntime: document special memmove requirements
Austin Clements [Mon, 6 Jan 2020 16:10:26 +0000 (11:10 -0500)]
runtime: document special memmove requirements

Unlike C's memmove, Go's memmove must be careful to do indivisible
writes of pointer values because it may be racing with the garbage
collector reading the heap.

We've had various bugs related to this over the years (#36101, #13160,
 #12552). Indeed, memmove is a great target for optimization and it's
easy to forget the special requirements of Go's memmove.

The CL documents these (currently unwritten!) requirements. We're also
adding a test that should hopefully keep everyone honest going
forward, though it's hard to be sure we're hitting all cases of
memmove.

Change-Id: I2f59f8d8d6fb42d2f10006b55d605b5efd8ddc24
Reviewed-on: https://go-review.googlesource.com/c/go/+/213418
Reviewed-by: Cherry Zhang <cherryyz@google.com>
5 years agoruntime: don't skip checkTimers if we would clear deleted timers
Ian Lance Taylor [Wed, 22 Jan 2020 00:50:56 +0000 (16:50 -0800)]
runtime: don't skip checkTimers if we would clear deleted timers

The timers code used to have a problem: if code started and stopped a
lot of timers, as would happen with, for example, lots of calls to
context.WithTimeout, then it would steadily use memory holding timers
that had stopped but not been removed from the timer heap.
That problem was fixed by CL 214299, which would remove all deleted
timers whenever they got to be more than 1/4 of the total number of
timers on the heap.

The timers code had a different problem: if there were some idle P's,
the running P's would have lock contention trying to steal their timers.
That problem was fixed by CL 214185, which only acquired the timer lock
if the next timer was ready to run or there were some timers to adjust.

Unfortunately, CL 214185 partially undid 214299, in that we could now
accumulate an increasing number of deleted timers while there were no
timers ready to run. This CL restores the 214299 behavior, by checking
whether there are lots of deleted timers without acquiring the lock.

This is a performance issue to consider for the 1.14 release.

Change-Id: I13c980efdcc2a46eb84882750c39e3f7c5b2e7c3
Reviewed-on: https://go-review.googlesource.com/c/go/+/215722
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years agocmd/dist: mark cgo as disabled on linux/riscv64
Joel Sing [Wed, 22 Jan 2020 16:46:00 +0000 (03:46 +1100)]
cmd/dist: mark cgo as disabled on linux/riscv64

cgo is not currently supported on this platform.

Updates #27532 and #36641

Change-Id: I4b35f887e869ebc5c156dd754b1c79897a8c5800
Reviewed-on: https://go-review.googlesource.com/c/go/+/215838
Reviewed-by: Cherry Zhang <cherryyz@google.com>
5 years agocmd/dist: detect gohostarch on riscv64 hosts
Joel Sing [Wed, 22 Jan 2020 16:30:14 +0000 (03:30 +1100)]
cmd/dist: detect gohostarch on riscv64 hosts

Updates #27532

Change-Id: I66c194499bb7b831b569c66d0736fa7205eedd80
Reviewed-on: https://go-review.googlesource.com/c/go/+/215837
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agocmd/internal/obj/riscv: implement prologue and epilogue
Joel Sing [Sun, 3 Nov 2019 17:32:32 +0000 (04:32 +1100)]
cmd/internal/obj/riscv: implement prologue and epilogue

Based on riscv-go port.

Updates #27532

Change-Id: If552225552bf8d27c29b08de31146dd34986a3a1
Reviewed-on: https://go-review.googlesource.com/c/go/+/204630
Run-TryBot: Joel Sing <joel@sing.id.au>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
5 years agocmd/go: add -d flag to mod_get_test
Jay Conrod [Tue, 21 Jan 2020 22:50:36 +0000 (14:50 -0800)]
cmd/go: add -d flag to mod_get_test

'go get all' was run in this test without -d. This caused some std
packages to be reinstalled if the test is run in a slightly different
configuration than make.bash was run. run.bash would fail in some
situations because of this. Nothing in the cmd/go tests should modify
installed std or cmd packages.

Updates #35459

Change-Id: Idd259a27d55502923b7fc54f361a77f0ac11eea2
Reviewed-on: https://go-review.googlesource.com/c/go/+/215721
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
5 years agocmd/internal/obj/riscv: populate DWARF register mapping for riscv64
Joel Sing [Sat, 18 Jan 2020 15:19:06 +0000 (02:19 +1100)]
cmd/internal/obj/riscv: populate DWARF register mapping for riscv64

Updates #27532

Change-Id: If147242c45d5c2d5cdc5b0428db32eeec13a958a
Reviewed-on: https://go-review.googlesource.com/c/go/+/215377
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years agocmd/internal/obj/riscv: correctly split immediates for FLW/FLD/FSW/FSD
Joel Sing [Thu, 16 Jan 2020 15:51:40 +0000 (02:51 +1100)]
cmd/internal/obj/riscv: correctly split immediates for FLW/FLD/FSW/FSD

The FLW/FLD/FSW/FSD instructions can have immediates that exceed 12-bits and
therefore cannot be encoded in the RISCV instruction. Handle these as we do
for other load/store instructions. Also add test coverage for all load/store
instructions with large immediates.

Fixes compilation issue reported by Carlos Eduardo de Paula.

Updates #27532

Change-Id: Ifa62f19493b3acaba5a90ac31d2df209a3afea81
Reviewed-on: https://go-review.googlesource.com/c/go/+/215037
Reviewed-by: Carlos Eduardo de Paula <me@carlosedp.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years agonet/http/httputil: add docs about X-Forwarded-For in ReverseProxy
Kévin Dunglas [Tue, 21 Jan 2020 21:48:41 +0000 (21:48 +0000)]
net/http/httputil: add docs about X-Forwarded-For in ReverseProxy

ReverseProxy automatically sets the X-Forwarded-For header, if the request
already contains a X-Forwarded-For header, the value of the client IP is
appended to the existing header value.
This behavior isn't documented anywhere, and can lead to IP spoofing
security issues is the client is untrusted (the most common situation).
This PR documents this behavior.

For future versions, I proposed #36678 that implements a more secure
default behavior and adds support for other forwarded headers.

Change-Id: Ief14f5063caebfccb87714f54cffa927c714e5fd
GitHub-Last-Rev: fd0bd29a181861ffdb1106b42f59f9489999ccb3
GitHub-Pull-Request: golang/go#36672
Reviewed-on: https://go-review.googlesource.com/c/go/+/215617
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agoruntime: fix wrong offset when calling ppc64x nanotime syscall
Carlos Eduardo Seo [Fri, 17 Jan 2020 20:59:59 +0000 (17:59 -0300)]
runtime: fix wrong offset when calling ppc64x nanotime syscall

There is a wrong offset when getting the results of a clock_gettime
syscall. Although the syscall will never be called in native ppc64x,
QEMU doesn't implement VDSO, so it will return wrong values.

Fixes #36592

Change-Id: Icf838075228dcdd62cf2c1279aa983e5993d66ee
Reviewed-on: https://go-review.googlesource.com/c/go/+/215397
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
5 years agotest: disable test for #36516 when cgo is not enabled
Tobias Klauser [Sun, 19 Jan 2020 19:05:15 +0000 (20:05 +0100)]
test: disable test for #36516 when cgo is not enabled

CL 214679 added a -race test which shouldn't be run when cgo is not
enabled.

Fixes the nocgo builder.

Change-Id: Iceddf802c4ef6c0de2c3a968e86342303d2d27d8
Reviewed-on: https://go-review.googlesource.com/c/go/+/215477
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years agoreflect: correct riscv64 assembly
Joel Sing [Sun, 19 Jan 2020 15:00:44 +0000 (02:00 +1100)]
reflect: correct riscv64 assembly

R0 is not a thing in riscv64 assembly - use ZERO (rather than X0) since
the rest of this currently uses ABI names.

Updates #27532

Change-Id: I28fb68e9f80d05231a07c5921e7062777234e2c5
Reviewed-on: https://go-review.googlesource.com/c/go/+/215437
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agoruntime: add support for linux/riscv64
Joel Sing [Sun, 3 Nov 2019 17:58:37 +0000 (04:58 +1100)]
runtime: add support for linux/riscv64

Based on riscv-go port.

Updates #27532

Change-Id: If522807a382130be3c8d40f4b4c1131d1de7c9e3
Reviewed-on: https://go-review.googlesource.com/c/go/+/204632
Run-TryBot: Joel Sing <joel@sing.id.au>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
5 years agonet: document *OpError.Err must not be nil
Yasser Abdolmaleki [Fri, 26 Jul 2019 03:44:06 +0000 (20:44 -0700)]
net: document *OpError.Err must not be nil

The point of *net.OpError is to add details to an underlying lower
level error. It makes no sense to have an OpError without an Err and
a nil *OpError.Err will cause *OpError.Error() method to panic.

Fixes #33007

Change-Id: If4fb2501e02dad110a095b73e18c47312ffa6015
Reviewed-on: https://go-review.googlesource.com/c/go/+/187677
Reviewed-by: Rob Pike <r@golang.org>
5 years agocmd/compile: implement compiler for riscv64
Joel Sing [Sun, 3 Nov 2019 17:40:47 +0000 (04:40 +1100)]
cmd/compile: implement compiler for riscv64

Based on riscv-go port.

Updates #27532

Change-Id: Ia329daa243db63ff334053b8807ea96b97ce3acf
Reviewed-on: https://go-review.googlesource.com/c/go/+/204631
Run-TryBot: Joel Sing <joel@sing.id.au>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
5 years agoreflect: add support for riscv64
Joel Sing [Sun, 3 Nov 2019 18:09:14 +0000 (05:09 +1100)]
reflect: add support for riscv64

Based on riscv-go port.

Update #27532

Change-Id: I791924f71078fd8dfe9c2fc03a3f21a3bc673721
Reviewed-on: https://go-review.googlesource.com/c/go/+/204634
Run-TryBot: Joel Sing <joel@sing.id.au>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
5 years agotesting: clarify that Cleanup is run after subtests complete.
Roger Peppe [Fri, 17 Jan 2020 09:06:13 +0000 (09:06 +0000)]
testing: clarify that Cleanup is run after subtests complete.

It's good to be explicit, as it's not necessarily obvious (and indeed
the behavior has changed recently with https://go-review.googlesource.com/c/go/+/214822)
without an associated doc comment change).

Change-Id: I99d6398bf15b404b1b1b196e712e926e363251e9
Reviewed-on: https://go-review.googlesource.com/c/go/+/215217
Reviewed-by: Paul Jolly <paul@myitcv.org.uk>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agocmd/compile: change the "bogus line" to be 1
David Chase [Fri, 17 Jan 2020 17:03:55 +0000 (12:03 -0500)]
cmd/compile: change the "bogus line" to be 1

The previous value was "too bogus" and caused objdump to crash.
Updated infinite loop test results (only run if -args -f) in ssa/debug_test.go
Probably also fixes #36621 but that bug needs more info to tell for certain.

Fixes #36570

Change-Id: I51144641d25d559308a98d726d87806bd340cc5a
Reviewed-on: https://go-review.googlesource.com/c/go/+/215297
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
5 years agocmd/compile: mark ... argument to checkptrArithmetic as not escaping
Keith Randall [Tue, 14 Jan 2020 17:50:43 +0000 (09:50 -0800)]
cmd/compile: mark ... argument to checkptrArithmetic as not escaping

Fixes #36516

Change-Id: Ibf4f86fb3a25fa30e0cd54e2dd2e12c60ee75ddb
Reviewed-on: https://go-review.googlesource.com/c/go/+/214679
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
5 years agocmd/go: trim paths from vendored packages with -trimpath
Jay Conrod [Wed, 15 Jan 2020 21:29:46 +0000 (16:29 -0500)]
cmd/go: trim paths from vendored packages with -trimpath

In CL 199821, we stopped setting the module directory for vendored
packages when -mod=vendor is used. This broke -trimpath, since we
replace the module directory with a string derived from the module
path and version. A comment in CL 202977 makes it clear that the
module directory should not be set.

With this change, -trimpath falls back to replacing the package
directory with the package path if the module directory is not set. We
also fall back to replacing the package directory if the module
version is not set to avoid adding a meaningless @ only for the main
module.

As a consequence of this change, file names in vendored packages will
not have module versions, so file names will be a little different
between -mod=mod and -mod=vendor.

Fixes #36566

Change-Id: I0e9cd76d36a2028a49d0b6697ea9a9b3140d7ff3
Reviewed-on: https://go-review.googlesource.com/c/go/+/214945
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
5 years agotesting: don't run Cleanup functions until parallel subtests complete
Ian Lance Taylor [Tue, 14 Jan 2020 23:28:47 +0000 (15:28 -0800)]
testing: don't run Cleanup functions until parallel subtests complete

Fixes #31651

Change-Id: Idbab0c4355fcc58520e210126795223435cf0078
Reviewed-on: https://go-review.googlesource.com/c/go/+/214822
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agoruntime: ignore power notification error seen on Windows Docker
Ian Lance Taylor [Wed, 15 Jan 2020 14:38:16 +0000 (06:38 -0800)]
runtime: ignore power notification error seen on Windows Docker

Fixes #36557

Change-Id: Ia8125f382d5e14e5612da811268a58971cc9ac08
Reviewed-on: https://go-review.googlesource.com/c/go/+/214917
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Jason A. Donenfeld <Jason@zx2c4.com>
Reviewed-by: Austin Clements <austin@google.com>
5 years agocmd/compile: use a sync.Pool and string interning when printing types
Josh Bleecher Snyder [Tue, 14 Jan 2020 13:08:47 +0000 (05:08 -0800)]
cmd/compile: use a sync.Pool and string interning when printing types

CL 214239 improved type printing, but introduced performance regressions:
3-5% memory increase, 1-2% CPU time increase.

There were two primary sources of the memory regression:

* allocating a bytes.Buffer for every type to print
* always printing to that buffer, even when we could return a constant string

This change addresses both of those regressions.
The sync.Pool allows buffer re-use.
String interning prevents allocation for re-used strings.

It addresses some, but not all, of the CPU time regression.

Memory performance impact vs master:

name        old alloc/op      new alloc/op      delta
Template         37.6MB ± 0%       36.3MB ± 0%  -3.30%  (p=0.008 n=5+5)
Unicode          28.7MB ± 0%       28.3MB ± 0%  -1.55%  (p=0.008 n=5+5)
GoTypes           127MB ± 0%        122MB ± 0%  -4.38%  (p=0.008 n=5+5)
Compiler          584MB ± 0%        568MB ± 0%  -2.72%  (p=0.008 n=5+5)
SSA              1.99GB ± 0%       1.95GB ± 0%  -1.97%  (p=0.008 n=5+5)
Flate            23.5MB ± 0%       22.8MB ± 0%  -2.84%  (p=0.008 n=5+5)
GoParser         29.2MB ± 0%       28.0MB ± 0%  -4.17%  (p=0.008 n=5+5)
Reflect          81.9MB ± 0%       78.6MB ± 0%  -4.09%  (p=0.008 n=5+5)
Tar              35.3MB ± 0%       34.1MB ± 0%  -3.29%  (p=0.008 n=5+5)
XML              45.5MB ± 0%       44.3MB ± 0%  -2.61%  (p=0.008 n=5+5)
[Geo mean]       82.4MB            79.9MB       -3.09%

name        old allocs/op     new allocs/op     delta
Template           394k ± 0%         363k ± 0%  -7.73%  (p=0.008 n=5+5)
Unicode            340k ± 0%         329k ± 0%  -3.25%  (p=0.008 n=5+5)
GoTypes           1.41M ± 0%        1.28M ± 0%  -9.54%  (p=0.008 n=5+5)
Compiler          5.77M ± 0%        5.39M ± 0%  -6.58%  (p=0.008 n=5+5)
SSA               19.1M ± 0%        18.1M ± 0%  -5.13%  (p=0.008 n=5+5)
Flate              247k ± 0%         228k ± 0%  -7.50%  (p=0.008 n=5+5)
GoParser           325k ± 0%         295k ± 0%  -9.24%  (p=0.008 n=5+5)
Reflect           1.04M ± 0%        0.95M ± 0%  -8.48%  (p=0.008 n=5+5)
Tar                365k ± 0%         336k ± 0%  -7.93%  (p=0.008 n=5+5)
XML                449k ± 0%         417k ± 0%  -7.10%  (p=0.008 n=5+5)
[Geo mean]         882k              818k       -7.26%

Memory performance going from 52c4488471ed52085a29e173226b3cbd2bf22b20,
which is the commit preceding CL 214239, to this change:

name        old alloc/op      new alloc/op      delta
Template         36.5MB ± 0%       36.3MB ± 0%  -0.37%  (p=0.008 n=5+5)
Unicode          28.3MB ± 0%       28.3MB ± 0%  -0.06%  (p=0.008 n=5+5)
GoTypes           123MB ± 0%        122MB ± 0%  -0.64%  (p=0.008 n=5+5)
Compiler          571MB ± 0%        568MB ± 0%  -0.51%  (p=0.008 n=5+5)
SSA              1.96GB ± 0%       1.95GB ± 0%  -0.13%  (p=0.008 n=5+5)
Flate            22.8MB ± 0%       22.8MB ± 0%    ~     (p=0.421 n=5+5)
GoParser         28.1MB ± 0%       28.0MB ± 0%  -0.37%  (p=0.008 n=5+5)
Reflect          78.8MB ± 0%       78.6MB ± 0%  -0.32%  (p=0.008 n=5+5)
Tar              34.3MB ± 0%       34.1MB ± 0%  -0.35%  (p=0.008 n=5+5)
XML              44.3MB ± 0%       44.3MB ± 0%  +0.05%  (p=0.032 n=5+5)
[Geo mean]       80.1MB            79.9MB       -0.27%

name        old allocs/op     new allocs/op     delta
Template           372k ± 0%         363k ± 0%  -2.46%  (p=0.008 n=5+5)
Unicode            333k ± 0%         329k ± 0%  -0.97%  (p=0.008 n=5+5)
GoTypes           1.33M ± 0%        1.28M ± 0%  -3.71%  (p=0.008 n=5+5)
Compiler          5.53M ± 0%        5.39M ± 0%  -2.50%  (p=0.008 n=5+5)
SSA               18.3M ± 0%        18.1M ± 0%  -1.22%  (p=0.008 n=5+5)
Flate              234k ± 0%         228k ± 0%  -2.44%  (p=0.008 n=5+5)
GoParser           305k ± 0%         295k ± 0%  -3.23%  (p=0.008 n=5+5)
Reflect            980k ± 0%         949k ± 0%  -3.12%  (p=0.008 n=5+5)
Tar                345k ± 0%         336k ± 0%  -2.69%  (p=0.008 n=5+5)
XML                425k ± 0%         417k ± 0%  -1.72%  (p=0.008 n=5+5)
[Geo mean]         838k              818k       -2.41%

Remaining CPU time regression, that is,
the change from before CL 214239 to this change:

name        old time/op       new time/op       delta
Template          208ms ± 2%        209ms ± 1%    ~     (p=0.181 n=47+46)
Unicode          82.9ms ± 2%       81.9ms ± 2%  -1.25%  (p=0.000 n=50+48)
GoTypes           709ms ± 3%        714ms ± 3%  +0.77%  (p=0.003 n=48+49)
Compiler          3.31s ± 2%        3.32s ± 2%    ~     (p=0.271 n=48+48)
SSA               10.8s ± 1%        10.9s ± 1%  +0.61%  (p=0.000 n=46+47)
Flate             134ms ± 2%        134ms ± 1%  +0.41%  (p=0.002 n=48+46)
GoParser          166ms ± 2%        167ms ± 2%  +0.41%  (p=0.010 n=46+48)
Reflect           440ms ± 4%        444ms ± 4%  +1.05%  (p=0.002 n=50+49)
Tar               183ms ± 2%        184ms ± 2%    ~     (p=0.074 n=45+45)
XML               247ms ± 2%        248ms ± 2%  +0.67%  (p=0.001 n=49+48)
[Geo mean]        425ms             427ms       +0.34%

name        old user-time/op  new user-time/op  delta
Template          271ms ± 2%        271ms ± 2%    ~     (p=0.654 n=48+48)
Unicode           117ms ± 2%        116ms ± 3%    ~     (p=0.458 n=47+45)
GoTypes           952ms ± 3%        963ms ± 2%  +1.11%  (p=0.000 n=48+49)
Compiler          4.50s ± 5%        4.49s ± 7%    ~     (p=0.894 n=50+50)
SSA               15.0s ± 2%        15.1s ± 2%  +0.46%  (p=0.015 n=50+49)
Flate             166ms ± 2%        167ms ± 2%  +0.40%  (p=0.005 n=49+48)
GoParser          202ms ± 2%        203ms ± 2%  +0.60%  (p=0.002 n=49+47)
Reflect           583ms ± 3%        588ms ± 3%  +0.82%  (p=0.001 n=49+46)
Tar               223ms ± 2%        224ms ± 2%  +0.37%  (p=0.046 n=48+46)
XML               310ms ± 2%        311ms ± 2%  +0.46%  (p=0.009 n=50+49)
[Geo mean]        554ms             556ms       +0.36%

Change-Id: I85951a6538373ef4309a2cc366cc1ebaf1f4582d
Reviewed-on: https://go-review.googlesource.com/c/go/+/214818
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
5 years agocrypto/tls: stop a timeout timer
Brad Fitzpatrick [Wed, 15 Jan 2020 19:29:33 +0000 (19:29 +0000)]
crypto/tls: stop a timeout timer

I noticed this leak while writing CL 214977.

Change-Id: I7566952b8e4bc58939d23435aea86576fc58ddca
Reviewed-on: https://go-review.googlesource.com/c/go/+/214978
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agomath, math/big: add support for riscv64
Joel Sing [Sun, 3 Nov 2019 18:06:56 +0000 (05:06 +1100)]
math, math/big: add support for riscv64

Based on riscv-go port.

Updates #27532

Change-Id: Id8ae7d851c393ec3702e4176c363accb0a42587f
Reviewed-on: https://go-review.googlesource.com/c/go/+/204633
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agoruntime: re-enable TestArenaCollision on darwin in race mode
Tobias Klauser [Thu, 9 Jan 2020 09:57:46 +0000 (10:57 +0100)]
runtime: re-enable TestArenaCollision on darwin in race mode

Go 1.14 will drop support for macOS 10.10, see #23011

This reverts CL 155097

Updates #26475
Updates #29340

Change-Id: I64d0275141407313b73068436ee81d13eacc4c76
Reviewed-on: https://go-review.googlesource.com/c/go/+/214058
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agospec: add missing space in EBNF
yah01 [Wed, 15 Jan 2020 01:34:43 +0000 (01:34 +0000)]
spec: add missing space in EBNF

Fixes #36520

Change-Id: I698ab235f82f7c81caa09318c954847cf3833153
GitHub-Last-Rev: 368a1dc7889c2370fba272bcb45d94822b60d7b9
GitHub-Pull-Request: golang/go#36559
Reviewed-on: https://go-review.googlesource.com/c/go/+/214821
Reviewed-by: Robert Griesemer <gri@golang.org>
5 years agostrings: update Join parameter name for clarity
Thomas Symborski [Mon, 23 Dec 2019 23:55:43 +0000 (23:55 +0000)]
strings: update Join parameter name for clarity

Change-Id: I83f806e76ef4d268b187bd273d78ceb41b7e8fa5
GitHub-Last-Rev: ee82eaae64536cecb631df328aafe2541f71d3f2
GitHub-Pull-Request: golang/go#36194
Reviewed-on: https://go-review.googlesource.com/c/go/+/211799
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years agodoc: fix up some HTML issues in go_spec.html
Rob Pike [Mon, 13 Jan 2020 05:03:12 +0000 (16:03 +1100)]
doc: fix up some HTML issues in go_spec.html

The HTML linter 'tidy' reports:

go_spec.html:2556: Warning: unescaped & which should be written as &amp;
go_spec.html:3293: Warning: unescaped & or unknown entity "&s1"
go_spec.html:3293: Warning: unescaped & or unknown entity "&a"
go_spec.html:3294: Warning: unescaped & or unknown entity "&s2"
go_spec.html:3294: Warning: unescaped & or unknown entity "&a"
go_spec.html:2045: Warning: trimming empty <p>
go_spec.html:4526: Warning: trimming empty <ul>
go_spec.html:4533: Warning: trimming empty <ul>
go_spec.html:4539: Warning: trimming empty <ul>

This CL fixes all but the <ul> ones, which I think should be fixed
but are defended by a comment.

Change-Id: I0ca88f5e80755024801877ab1298025ecf8f10c5
Reviewed-on: https://go-review.googlesource.com/c/go/+/214457
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
5 years agoruntime: keep P's first timer when in new atomically accessed field
Ian Lance Taylor [Mon, 13 Jan 2020 20:17:26 +0000 (12:17 -0800)]
runtime: keep P's first timer when in new atomically accessed field

This reduces lock contention when only a few P's are running and
checking for whether they need to run timers on the sleeping P's.
Without this change the running P's would get lock contention
while looking at the sleeping P's timers. With this change a single
atomic load suffices to determine whether there are any ready timers.

Change-Id: Ie843782bd56df49867a01ecf19c47498ec827452
Reviewed-on: https://go-review.googlesource.com/c/go/+/214185
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: David Chase <drchase@google.com>
5 years agoruntime: better approximate total cost of scavenging
Michael Anthony Knyszek [Mon, 13 Jan 2020 17:18:51 +0000 (17:18 +0000)]
runtime: better approximate total cost of scavenging

Currently, the scavenger is paced according to how long it takes to
scavenge one runtime page's worth of memory. However, this pacing
doesn't take into account the additional cost of actually using a
scavenged page. This operation, "sysUsed," is a counterpart to the
scavenging operation "sysUnused." On most systems this operation is a
no-op, but on some systems like Darwin and Windows we actually make a
syscall. Even on systems where it's a no-op, the cost is implicit: a
more expensive page fault when re-using the page.

On Darwin in particular the cost of "sysUnused" is fairly close to the
cost of "sysUsed", which skews the pacing to be too fast. A lot of
soon-to-be-allocated memory ends up scavenged, resulting in many more
expensive "sysUsed" operations, ultimately slowing down the application.

The way to fix this problem is to include the future cost of "sysUsed"
on a page in the scavenging cost. However, measuring the "sysUsed" cost
directly (like we do with "sysUnused") on most systems is infeasible
because we would have to measure the cost of the first access.

Instead, this change applies a multiplicative constant to the measured
scavenging time which is based on a per-system ratio of "sysUnused" to
"sysUsed" costs in the worst case (on systems where it's a no-op, we
measure the cost of the first access). This ultimately slows down the
scavenger to a more reasonable pace, limiting its impact on performance
but still retaining the memory footprint improvements from the previous
release.

Fixes #36507.

Change-Id: I050659cd8cdfa5a32f5cc0b56622716ea0fa5407
Reviewed-on: https://go-review.googlesource.com/c/go/+/214517
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
5 years agoC: add missing name
Koya IWAMURA [Tue, 14 Jan 2020 06:57:49 +0000 (15:57 +0900)]
C: add missing name

Even though I contributed to golang/go[^1], the rule[^2] did not reflect my name in CONTRIBUTORS, so I added it.

[^1]: https://go-review.googlesource.com/c/go/+/164199
[^2]: https://github.com/golang/build/blob/e21a90b/cmd/updatecontrib/updatecontrib.go#L118

Change-Id: I5d6b5684d61ea5da679519a9e703d977470de175
Reviewed-on: https://go-review.googlesource.com/c/go/+/214617
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agoRevert "os: handle long path in RemoveAll for windows"
Ian Lance Taylor [Mon, 13 Jan 2020 23:34:53 +0000 (23:34 +0000)]
Revert "os: handle long path in RemoveAll for windows"

This reverts CL 214437.

Does not fix the issue, and the test was wrong so it did not detect that it did not fix the issue.

Updates #36375

Change-Id: I6a4112035a1e90f4fdafed6fdf4ec9dfc718b571
Reviewed-on: https://go-review.googlesource.com/c/go/+/214601
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agotime: add a sentence about distant times to time.Time.Unix
Rob Pike [Thu, 9 Jan 2020 05:22:31 +0000 (16:22 +1100)]
time: add a sentence about distant times to time.Time.Unix

Since Durations only span 290 years, they are not good for
manipulating very remote times. I bounced off this problem recently
while doing some astronomical calculations and it took me a while to
realize I could get a 64-bit seconds value from time.Time.Unix and
subtract two of them to evaluate the interval.

I thought it worth adding a sentence to make this clear. It didn't
occur to me for quite a while that "Unix time" spans a huge range in
the Go library.

Change-Id: I76c75dc951dfd6bcf86e8b0be3cfec518a3ecdee
Reviewed-on: https://go-review.googlesource.com/c/go/+/213977
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
5 years agospec: uniformly format empty interfaces as "interface{}"
Robert Griesemer [Mon, 13 Jan 2020 21:01:28 +0000 (13:01 -0800)]
spec: uniformly format empty interfaces as "interface{}"

Fixes #36526.

Change-Id: Ic51a287579f139422cc1a7b2fb82d6732114b031
Reviewed-on: https://go-review.googlesource.com/c/go/+/214597
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agoos: handle long path in RemoveAll for windows
Constantin Konstantinidis [Sat, 11 Jan 2020 18:53:20 +0000 (19:53 +0100)]
os: handle long path in RemoveAll for windows

Fixes #36375

Change-Id: I407a1db23868880b83e73bc136d274659483fb69
Reviewed-on: https://go-review.googlesource.com/c/go/+/214437
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agocmd/compile: print recursive types correctly
Keith Randall [Thu, 9 Jan 2020 22:58:18 +0000 (14:58 -0800)]
cmd/compile: print recursive types correctly

Change the type printer to take a map of types that we're currently
printing. When we happen upon a type that we're already in the middle
of printing, print a reference to it instead.

A reference to another type is built using the offset of the first
byte of that type's string representation in the result. To facilitate
that computation (and it's probably more efficient, regardless), we
print the type to a buffer as we go, and build the string at the end.

It would be nice to use string.Builder instead of bytes.Buffer, but
string.Builder wasn't around in Go 1.4, and we'd like to bootstrap
from that version.

Fixes #29312

Change-Id: I49d788c1fa20f770df7b2bae3b9979d990d54803
Reviewed-on: https://go-review.googlesource.com/c/go/+/214239
Reviewed-by: Robert Griesemer <gri@golang.org>
5 years agohtml: update URL in comment
fujimoto kyosuke [Sun, 12 Jan 2020 06:49:19 +0000 (06:49 +0000)]
html: update URL in comment

The comment contained a link that had a file name and ID that no longer existed, so change to the URL of the corresponding part of the latest page.

Change-Id: I74e0885aabf470facc39b84035f7a83fef9c6a8e
GitHub-Last-Rev: 5681c84d9f1029449da6860c65a1d9a128296e85
GitHub-Pull-Request: golang/go#36514
Reviewed-on: https://go-review.googlesource.com/c/go/+/214181
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agoruntime: don't let P's timer heap get clogged with deleted timers
Ian Lance Taylor [Fri, 10 Jan 2020 07:03:25 +0000 (23:03 -0800)]
runtime: don't let P's timer heap get clogged with deleted timers

Whenever more than 1/4 of the timers on a P's heap are deleted,
remove them from the heap.

Change-Id: Iff63ed3d04e6f33ffc5c834f77f645c52c007e52
Reviewed-on: https://go-review.googlesource.com/c/go/+/214299
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
5 years agocmd/go/internal/modload: fix an erroneous comment about the test repo
Bryan C. Mills [Fri, 10 Jan 2020 14:37:32 +0000 (09:37 -0500)]
cmd/go/internal/modload: fix an erroneous comment about the test repo

Updates #36489

Change-Id: I1ca215ba0a64a31d662134385b8be46bb4ba4434
Reviewed-on: https://go-review.googlesource.com/c/go/+/214282
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
5 years agoruntime: add tests for checkptr
Matthew Dempsky [Thu, 9 Jan 2020 23:26:01 +0000 (15:26 -0800)]
runtime: add tests for checkptr

We had a few test cases to make sure checkptr didn't have certain
false positives, but none to test for any true positives. This CL
fixes that.

Updates #22218.

Change-Id: I24c02e469a4af43b1748829a9df325ce510f7cc4
Reviewed-on: https://go-review.googlesource.com/c/go/+/214238
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
5 years agocmd/compile: emit only '/' in DWARF file names
Jeremy Faller [Fri, 10 Jan 2020 16:36:44 +0000 (11:36 -0500)]
cmd/compile: emit only '/' in DWARF file names

Make file names consistent, using only forward slashes in the path.

Fixes #36495

Change-Id: I337119d6dff233ab9d4bfe757147ec25961ae021
Reviewed-on: https://go-review.googlesource.com/c/go/+/214286
Run-TryBot: Jeremy Faller <jeremy@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agocmd: update golang.org/x/mod to v0.2.0 (latest)
Jay Conrod [Fri, 10 Jan 2020 18:05:54 +0000 (13:05 -0500)]
cmd: update golang.org/x/mod to v0.2.0 (latest)

This pulls in two new commits: a fix for a test broken on plan9 and a
correction to a comment.

Change-Id: I31cf046a5073872714c758894732b2fcc800ab6b
Reviewed-on: https://go-review.googlesource.com/c/go/+/214289
Run-TryBot: Jay Conrod <jayconrod@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years agoruntime: don't skip timer when adjustTimers sees a modified timer
Ian Lance Taylor [Fri, 10 Jan 2020 18:10:32 +0000 (10:10 -0800)]
runtime: don't skip timer when adjustTimers sees a modified timer

When adjustTimers sees a timerModifiedEarlier or timerModifiedLater,
it removes it from the heap, leaving a new timer at that position
in the heap. We were accidentally skipping that new timer in our loop.
In some unlikely cases this could cause adjustTimers to look at more
timers than necessary.

Change-Id: Ic71e54c175ab7d86a7fa46f1497aca71ed1c43cc
Reviewed-on: https://go-review.googlesource.com/c/go/+/214338
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years agosrc/go.mod: update x/crypto to drop broken poly1305 arm assembly
Filippo Valsorda [Thu, 9 Jan 2020 15:23:25 +0000 (10:23 -0500)]
src/go.mod: update x/crypto to drop broken poly1305 arm assembly

This imports CL 213880.

Fixes #35511

Change-Id: I55d18713bdac8fa556ba5a2aced922f80d1ac970
Reviewed-on: https://go-review.googlesource.com/c/go/+/214078
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agocrypto/x509: this change modifies C.CopyPEMRoots to static function
bxq2011hust [Fri, 10 Jan 2020 07:03:21 +0000 (07:03 +0000)]
crypto/x509: this change modifies C.CopyPEMRoots to static function

Change-Id: Ic7997d1f747152afec78e8e439770166029f34ec
GitHub-Last-Rev: 6a07f25056c960dc8684cd6eac22cd3405a936c8
GitHub-Pull-Request: golang/go#36491
Reviewed-on: https://go-review.googlesource.com/c/go/+/214298
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agomisc/cgo/test: re-enable darwin cgo tests in race mode
Tobias Klauser [Thu, 9 Jan 2020 09:48:14 +0000 (10:48 +0100)]
misc/cgo/test: re-enable darwin cgo tests in race mode

Go 1.14 will drop support for macOS 10.10, see #23011

This reverts CL 125304

Updates #26475
Updates #26513

Change-Id: Ia13eef30f22d67103f7ae45424124fbb116e1261
Reviewed-on: https://go-review.googlesource.com/c/go/+/214057
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agodoc/go1.14: preannounce dropping macOS 10.11 support
Ian Lance Taylor [Thu, 5 Dec 2019 19:36:39 +0000 (11:36 -0800)]
doc/go1.14: preannounce dropping macOS 10.11 support

Go 1.14 will be the last to support macOS 10.11.
Go 1.15 will require macOS 10.12 (Sierra).

Updates #23011

Change-Id: I8fff555e5b8fffe088e7e960e77fac9558cb74e4
Reviewed-on: https://go-review.googlesource.com/c/go/+/210137
Reviewed-by: Andrew Bonventre <andybons@golang.org>
5 years agoruntime: change checkptr to use throw instead of panic
Matthew Dempsky [Thu, 9 Jan 2020 22:01:41 +0000 (14:01 -0800)]
runtime: change checkptr to use throw instead of panic

Updates #34964.

Change-Id: I5afb2c1e77a9a47358a1d0d108c4a787d7172b94
Reviewed-on: https://go-review.googlesource.com/c/go/+/214217
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
5 years agocmd/go: remove references to 1.13 in 'go help modules'
Jay Conrod [Thu, 9 Jan 2020 21:22:01 +0000 (16:22 -0500)]
cmd/go: remove references to 1.13 in 'go help modules'

In "Module support" section, there were two mentions of "Go 1.13",
assuming that's the latest version. Rather than update these to 1.14,
this CL changes those to "The go command".

Also, a minor change in wording for finding go.mod files.

Change-Id: Id194be9405b540f221464814e71c361a22cc0f55
Reviewed-on: https://go-review.googlesource.com/c/go/+/214140
Run-TryBot: Jay Conrod <jayconrod@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years agodoc/go1.14: -d=checkptr is not yet recommended on Windows
Austin Clements [Thu, 9 Jan 2020 17:44:52 +0000 (12:44 -0500)]
doc/go1.14: -d=checkptr is not yet recommended on Windows

Hopefully we'll have the remaining safety violations in the standard
library ironed out by 1.15.

We also fix a minor (but important) typo while we're here.

Updates #34964, #34972.

Change-Id: Ic72fd4d9411b749f8c0cea87e95ab68347009893
Reviewed-on: https://go-review.googlesource.com/c/go/+/214118
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agoCONTRIBUTORS: first round of updates for Go 1.14
Dmitri Shuralyov [Wed, 8 Jan 2020 18:50:30 +0000 (13:50 -0500)]
CONTRIBUTORS: first round of updates for Go 1.14

This update was automatically generated using the updatecontrib command:

cd gotip
go run golang.org/x/build/cmd/updatecontrib

With minor manual changes based on publicly available information
to canonicalize letter case and formatting for a few names.

Actions taken (relative to CONTRIBUTORS at origin/master):

Added Aaron Beitch <aaronb@arista.com>
Added Adam Shelton <aashelt90@gmail.com>
Added Aditya Harindar <aditya.harindar@gmail.com>
Added Alec Benzer <alec.benzer@gmail.com>
Added Alex Buchanan <buchanae@gmail.com>
Added Alex Gaynor <alex@alloy.us>
Added Alex Harford <alex.harford@saucelabs.com>
Added Alex Zhirov <azhirov@google.com>
Added Alexandr Mayorskiy <a.mayorskiy@corp.mail.ru>
Added An Xiao <hac@zju.edu.cn>
Added Andrei Enshin <b1os@bk.ru>
Added Andrew Medvedev <andrew.y.medvedev@gmail.com>
Added Andrew Stormont <astormont@racktopsystems.com>
Added Antonio Huete Jimenez <tuxillo@quantumachine.net>
Added Arda Güçlü <ardaguclu@gmail.com>
Added Artem Alekseev <artem.alekseev@intel.com>
Added Ayan George <ayan@ayan.net>
Added Barnaby Keene <accounts@southcla.ws>
Added Ben Toews <mastahyeti@gmail.com>
Added Benjamin Wuethrich <benjamin.wuethrich@gmail.com>
Added Brandon Philips <brandon@ifup.org>
Added Carlos Amedee <carlos@golang.org>
Added Changkun Ou <hi@changkun.us>
Added Chauncy Cullitan <chauncyc@google.com>
Added Clint J. Edwards <clint.j.edwards@gmail.com>
Added Daisuke Suzuki <daisuzu@gmail.com>
Added Dan Scales <danscales@google.com>
Added David Bond <davidsbond93@gmail.com>
Added Denis Isaev <idenx@yandex.com>
Added Domas Tamašauskas <puerdomus@gmail.com>
Added Duco van Amstel <duco.vanamstel@gmail.com>
Added Eduardo Villaseñor <evillasrmx@gmail.com>
Added Eric Biggers <ebiggers@google.com>
Added Eric Brown <browne@vmware.com>
Added Eric Rutherford <erutherford@gmail.com>
Added Gabriel Rosenhouse <rosenhouse@gmail.com>
Added George Hartzell <hartzell@alerce.com>
Added Gert Cuykens <gert.cuykens@gmail.com>
Added Ghazni Nattarshah <ghazni.nattarshah@gmail.com>
Added GitHub User DQNEO (188741) <dqneoo@gmail.com>
Added GitHub User Matts966 (28551465) <Matts966@users.noreply.github.com>
Added GitHub User ajz01 (4744634) <ajzdenek@gmail.com>
Added GitHub User andig (184815) <cpuidle@gmx.de>
Added GitHub User jinmiaoluo (39730824) <jinmiaoluo@icloud.com>
Added GitHub User maltalex (10195391) <code@bit48.net>
Added GitHub User po3rin (29445112) <abctail30@gmail.com>
Added GitHub User pokutuna (57545) <popopopopokutuna@gmail.com>
Added GitHub User ramenjuniti (32011829) <ramenjuniti@gmail.com>
Added GitHub User skanehira (7888591) <sho19921005@gmail.com>
Added GitHub User witchard (4994659) <witchard@hotmail.co.uk>
Added GitHub User zikaeroh (48577114) <zikaeroh@gmail.com>
Added Günther Noack <gnoack@google.com>
Added Hasit Bhatt <hasit.p.bhatt@gmail.com>
Added Howard Zhang <howard.zhang@arm.com>
Added Huan Du <i@huandu.me>
Added Ignacio Hagopian <jsign.uy@gmail.com>
Added Ilya Sinelnikov <sidhmangh@gmail.com>
Added Irbe Krumina <irbekrm@gmail.com>
Added Isfan Azhabil <isfan.azhabil@tokopedia.com>
Added Ivan Trubach <mr.trubach@icloud.com>
Added Jaap Aarts <jaap.aarts1@gmail.com>
Added Jeremy Faller <jeremy@golang.org>
Added Johan Jansson <johan.jansson@iki.fi>
Added John Papandriopoulos <jpap.code@gmail.com>
Added Jorge L. Fatta <jorge.fatta@auth0.com>
Added Josa Gesell <josa@gesell.me>
Added Julian Tibble <julian.tibble@gmail.com>
Added Jun Zhang <jim.zoumo@gmail.com>
Added Jędrzej Szczepaniak <jbszczepaniak@gmail.com>
Added Kalman Bekesi <kalmanb@google.com>
Added Katharine Berry <ktbry@google.com>
Added Keisuke Kishimoto <keisuke.kishimoto@gmail.com>
Added Kevan Swanberg <kevswanberg@gmail.com>
Added Koki Tomoshige <tomocy.dev@gmail.com>
Added Liz Rice <liz@lizrice.com>
Added Lorenz Brun <lorenz@brun.one>
Added Luke Young <bored-engineer@users.noreply.github.com>
Added Marc Sanmiquel <marcsanmiquel@gmail.com>
Added Marko Kungla <marko.kungla@gmail.com>
Added Mikhail Fesenko <proggga@gmail.com>
Added Mohit Verma <vmohit.93@gmail.com>
Added Moritz Fain <moritz@fain.io>
Added Nathan Dias <nathan.dias@orijtech.com>
Added Nikita Vanyasin <nikita.vanyasin@gmail.com>
Added Nuno Cruces <ncruces@users.noreply.github.com>
Added Oliver Powell <oliverpowell84@gmail.com>
Added Panos Georgiadis <pgeorgiadis@suse.de>
Added Pantelis Sampaziotis <psampaz@gmail.com>
Added Paulo Gomes <paulo.gomes.uk@gmail.com>
Added Prashant Agrawal <prashant.a.vjti@gmail.com>
Added Ricardo Seriani <ricardo.seriani@gmail.com>
Added Rob Findley <rfindley@google.com>
Added Robin Zhong <robin@robinzhong.co>
Added Rohan Challa <rohan@golang.org>
Added Roman Kollár <roman.kollar.0@gmail.com>
Added Ruixin Bao <ruixin.bao@ibm.com>
Added Sardorbek Pulatov <sardorbek.pulatov@outlook.com>
Added Scott Ragan <ragansa@fb.com>
Added Sean Liao <seankhliao@gmail.com>
Added Sebastian Chlopecki <sebsebmc@gmail.com>
Added Sebastian Kinne <skinne@google.com>
Added Sergei Lemeshkin <sergeilem@gmail.com>
Added Serhat Giydiren <serhatgiydiren@gmail.com>
Added Shivashis Padhi <shivashispadhi@gmail.com>
Added Simarpreet Singh <simar@linux.com>
Added Simon Ferquel <simon.ferquel@docker.com>
Added Simon Rozman <simon@rozman.si>
Added Sjoerd Siebinga <sjoerd.siebinga@gmail.com>
Added Spencer Kocot <spencerkocot@gmail.com>
Added Srinidhi Kaushik <shrinidhi.kaushik@gmail.com>
Added Sven Taute <sven.taute@gmail.com>
Added Tao Qingyun <qingyunha@gmail.com>
Added Tianji Wu <the729@gmail.com>
Added Tomas Dabasinskas <tomas@dabasinskas.net>
Added Ville Skyttä <ville.skytta@iki.fi>
Added Vitaly Zdanevich <zdanevich.vitaly@ya.ru>
Added Vladimir Evgrafov <evgrafov.vladimir@gmail.com>
Added Vojtech Bocek <vbocek@gmail.com>
Added Wang Xuerui <git@xen0n.name>
Added William Poussier <william.poussier@gmail.com>
Added Xiangdong Ji <xiangdong.ji@arm.com>
Added Yuichi Nishiwaki <yuichi.nishiwaki@gmail.com>
Added Ziheng Liu <lzhfromustc@gmail.com>
Used GitHub User DQNEO (188741) form for DQNEO <dqneoo@gmail.com> https://github.com/golang/go/commit/f07059d949 [go]
Used GitHub User Matts966 (28551465) form for Matts966 <Matts966@users.noreply.github.com> https://github.com/golang/tools/commit/d89860af [tools]
Used GitHub User ajz01 (4744634) form for ajz01 <ajzdenek@gmail.com> https://github.com/golang/go/commit/57ad6ef15d [go]
Used GitHub User andig (184815) form for andig <cpuidle@gmx.de> https://github.com/golang/go/commit/cf630586ca [go sys]
Used GitHub User jinmiaoluo (39730824) form for jinmiaoluo <jinmiaoluo@icloud.com> https://github.com/golang/go/commit/c7e73ef60a [go]
Used GitHub User maltalex (10195391) form for maltalex <code@bit48.net> https://github.com/golang/sys/commit/c709ea0 [sys]
Used GitHub User po3rin (29445112) form for po3rin <abctail30@gmail.com> https://github.com/golang/go/commit/bf865823ba [go]
Used GitHub User pokutuna (57545) form for pokutuna <popopopopokutuna@gmail.com> https://github.com/golang/go/commit/46e0d724b3 [go]
Used GitHub User ramenjuniti (32011829) form for ramenjuniti <ramenjuniti@gmail.com> https://github.com/golang/go/commit/f9dd99cae3 [go]
Used GitHub User skanehira (7888591) form for skanehira <sho19921005@gmail.com> https://github.com/golang/go/commit/87805c92fd [go]
Used GitHub User utkarsh-extc (53217283) form for utkarsh-extc <53217283+utkarsh-extc@users.noreply.github.com> https://github.com/golang/sys/commit/51ab0e2 [sys]
Used GitHub User witchard (4994659) form for witchard <witchard@hotmail.co.uk> https://github.com/golang/go/commit/42db1da8e9 [go]
Used GitHub User zikaeroh (48577114) form for zikaeroh <zikaeroh@gmail.com> https://github.com/golang/tools/commit/e84277c2 [tools]
Used GitHub name "Adam Shelton" for Adam <aashelt90@gmail.com> https://github.com/golang/exp/commit/c286b88 [exp]
Used GitHub name "Andrew Bonventre" for Andrew <andybons@golang.org> https://github.com/golang/go/commit/8bbfc51d9a [arch blog build crypto debug exp gddo go image lint mobile net oauth2 perf playground proposal.git review sync sys talks term text time tools tour website]
Used GitHub name "David Bond" for davidsbond <davidsbond93@gmail.com> https://github.com/golang/go/commit/b421b85841 [go]
Used GitHub name "Eduardo Villaseñor" for galaxy-designer <evillasrmx@gmail.com> https://github.com/golang/tools/commit/db047d72 [tools]
Used GitHub name "George Hartzell" for hartzell <hartzell@alerce.com> https://github.com/golang/tools/commit/5eefd052 [tools]
Used GitHub name "Ignacio Hagopian" for jsign <jsign.uy@gmail.com> https://github.com/golang/go/commit/4d4ddd862d [go]
Used GitHub name "Ivan Markin" for nogoegst <nogoegst@users.noreply.github.com> https://github.com/golang/go/commit/a1addf15df [go]
Used GitHub name "Jun Zhang" for zoumo <jim.zoumo@gmail.com> https://github.com/golang/tools/commit/81ca6dc7 [tools]
Used GitHub name "Keiji Yoshida" for yosssi <yoshida.keiji.84@gmail.com> https://github.com/golang/lint/commit/ac6833c [lint]
Used GitHub name "Koki Tomoshige" for tomocy <tomocy.dev@gmail.com> https://github.com/golang/go/commit/2f04903fec [go]
Used GitHub name "Michalis Kargakis" for kargakis <mkargaki@redhat.com> https://github.com/golang/go/commit/e243d242d7 [go]
Used GitHub name "Nikita Vanyasin" for nikita-vanyasin <nikita.vanyasin@gmail.com> https://github.com/golang/go/commit/c3e8a20a65 [go]
Used GitHub name "Roberto Clapis" for Roberto <empijei@users.noreply.github.com> https://github.com/golang/go/commit/963776e689 [go]
Used GitHub name "Robin Eklind" for mewmew <rnd0x00@gmail.com> https://github.com/golang/go/commit/b8620afb8d [arch blog go proposal.git]
Used GitHub name "Sergei Lemeshkin" for sergeilem <sergeilem@gmail.com> https://github.com/golang/go/commit/a3a1bdff79 [go]
Used GitHub name "Vladimir Evgrafov" for vovapi <evgrafov.vladimir@gmail.com> https://github.com/golang/go/commit/207a0b7933 [go]

Updates #12042

Change-Id: I1ba3c17108491316255f914c3a71f69fc6f4341a
Reviewed-on: https://go-review.googlesource.com/c/go/+/213824
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Carlos Amedee <carlos@golang.org>
5 years agoruntime: add scavtrace debug flag and remove scavenge info from gctrace
Michael Anthony Knyszek [Fri, 27 Dec 2019 16:48:23 +0000 (16:48 +0000)]
runtime: add scavtrace debug flag and remove scavenge info from gctrace

Currently, scavenging information is printed if the gctrace debug
variable is >0. Scavenging information is also printed naively, for
every page scavenged, resulting in a lot of noise when the typical
expectation for GC trace is one line per GC.

This change adds a new GODEBUG flag called scavtrace which prints
scavenge information roughly once per GC cycle and removes any scavenge
information from gctrace. The exception is debug.FreeOSMemory, which may
force an additional line to be printed.

Fixes #32952.

Change-Id: I4177dcb85fe3f9653fd74297ea93c97c389c1811
Reviewed-on: https://go-review.googlesource.com/c/go/+/212640
Run-TryBot: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years agocmd/go: explicitly reject 'list -u' and 'list -versions' when '-mod=vendor' is set
Bryan C. Mills [Thu, 9 Jan 2020 16:19:16 +0000 (11:19 -0500)]
cmd/go: explicitly reject 'list -u' and 'list -versions' when '-mod=vendor' is set

The information requested by these flags is not available from the
vendor directory.

Noticed while diagnosing #36478.

Updates #33848

Change-Id: I2b181ba5c27f01fdd6277d8d0ab1003c05774ff7
Reviewed-on: https://go-review.googlesource.com/c/go/+/214081
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
5 years agocmd/go/internal/modload: do not disable Query for -mod=readonly
Bryan C. Mills [Thu, 9 Jan 2020 14:39:48 +0000 (09:39 -0500)]
cmd/go/internal/modload: do not disable Query for -mod=readonly

'go list -m' allows explicit module@version arguments,
which it resolves (using Query) but does not add to the build list.
Similarly, 'go list -u' resolves versions without modifying the build list.

These explicit operations should be allowed even when '-mod=readonly' is set.

Updates #36478

'go list' and 'go mod download' do not

Change-Id: I5d2735729ad573635b9c1902d5d3a8bd960b8a76
Reviewed-on: https://go-review.googlesource.com/c/go/+/214077
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
5 years agoruntime: protect against external code calling ExitProcess
Austin Clements [Wed, 8 Jan 2020 14:58:42 +0000 (09:58 -0500)]
runtime: protect against external code calling ExitProcess

On Windows, we implement asynchronous preemption using SuspendThread
to suspend other threads in our process. However, SuspendThread is
itself actually asynchronous (it enqueues a kernel "asynchronous
procedure call" and returns). Unfortunately, Windows' ExitProcess API
kills all threads except the calling one and then runs APCs. As a
result, if SuspendThread and ExitProcess are called simultaneously,
the exiting thread can be suspended and the suspending thread can be
exited, leaving behind a ghost process consisting of a single thread
that's suspended.

We've already protected against the runtime's own calls to
ExitProcess, but if Go code calls external code, there's nothing
stopping that code from calling ExitProcess. For example, in #35775,
our own call to racefini leads to C code calling ExitProcess and
occasionally causing a deadlock.

This CL fixes this by introducing synchronization between calling
external code on Windows and preemption. It adds an atomic field to
the M that participates in a simple CAS-based synchronization protocol
to prevent suspending a thread running external code. We use this to
protect cgocall (which is used for both cgo calls and system calls on
Windows) and racefini.

Tested by running the flag package's TestParse test compiled in race
mode in a loop. Before this change, this would reliably deadlock after
a few minutes.

Fixes #35775.
Updates #10958, #24543.

Change-Id: I50d847abcdc2688b4f71eee6a75eca0f2fee892c
Reviewed-on: https://go-review.googlesource.com/c/go/+/213837
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: David Chase <drchase@google.com>
5 years agocmd/go: make "finding" logging deterministic
Bryan C. Mills [Tue, 7 Jan 2020 20:33:08 +0000 (15:33 -0500)]
cmd/go: make "finding" logging deterministic

In CL 204777, I made the "finding" messages in cachingRepo only print
after a “longish” delay, on the theory that they would help diagnose
slow or stuck fetches.

However, as I've been testing Go 1.14 beta 1, I've found that these
messages are mostly just noise, and the fact that they are so
nondeterministic causes both confusion and test flakes (#35539).

Moreover, it currently triggers once for each candidate module, when
what we're usually after is actually a specific package within the
module.

So let's log the package operation unconditionally instead of the
module fetches nondeterministically.

Fixes #35539
Updates #26152

Change-Id: I41a1c772465b2f0b357d3402bc372b6907773741
Reviewed-on: https://go-review.googlesource.com/c/go/+/213679
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
5 years agoruntime: overwrite asyncPreempt PC when injecting sigpanic on Windows
Cherry Zhang [Wed, 8 Jan 2020 23:23:51 +0000 (18:23 -0500)]
runtime: overwrite asyncPreempt PC when injecting sigpanic on Windows

On Windows, it might be possible that SuspendThread suspends a
thread right between when an exception happens and when the
exception handler runs. (This is my guess. I don't know the
implementation detail of Windows exceptions to be sure.) In this
case, we may inject a call to asyncPreempt before the exception
handler runs. The exception handler will inject a sigpanic call,
which will make the stack trace looks like

sigpanic
asyncPreempt
actual panicking function

i.e. it appears asyncPreempt panicked.

Instead, just overwrite the PC, without pushing another frame.

Fixes #35773.

Change-Id: Ief4e964dcb7f45670b5f93c4dcf285cc1c737514
Reviewed-on: https://go-review.googlesource.com/c/go/+/213879
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
5 years agocmd/go: adjust heuristics for skipping +incompatible versions
Bryan C. Mills [Fri, 20 Dec 2019 22:12:38 +0000 (17:12 -0500)]
cmd/go: adjust heuristics for skipping +incompatible versions

We know of at least one module (github.com/stripe/stripe-go) that has
a run of +incompatible versions, followed by a run of versions with
go.mod files, followed by another run of +incompatible versions.

We want the heuristics for showing +incompatible versions to reflect
the authors' current intent, and it seems clear that the current
intent of the authors of that module is for users of the unversioned
import path to still be on +incompatible versions.

To respect that intent, we need to keep checking for +incompatible
versions even after we have seen a lower major version with an
explicit go.mod file.

However, we still don't want to download every single version of the
module to check it. A given major version should have a consistent,
canonical import path, so the path (as inferred by the presence or
absence of a go.mod file) should be the same for every release across
that major version.

To avoid unnecessary overhead — and to allow module authors to correct
accidental changes to a major version's import path — we check only
the most recent release of each major version. If a release
accidentally changes the import path in either direction (by deleting
or adding a go.mod file), it can be corrected by issuing a single
subsequent release of that major version to restore the correct path.

I manually verified that, with this change,
github.com/stripe/stripe-go@latest reverts to v68.7.0+incompatible
as it was in Go 1.13.
The other regression tests for #34165 continue to pass.

Updates #34165

Change-Id: I5daff3cd2123f94c7c49519babf4eecd509f169e
Reviewed-on: https://go-review.googlesource.com/c/go/+/212317
Reviewed-by: Jay Conrod <jayconrod@google.com>
5 years agocmd/compile: give every really deep type a unique name
Keith Randall [Tue, 7 Jan 2020 01:17:33 +0000 (17:17 -0800)]
cmd/compile: give every really deep type a unique name

This avoids the security problem in #29312 where two very deep, but
distinct, types are given the same name. They both make it to the
linker which chooses one, and the use of the other is now type unsafe.

Instead, give every very deep type its own name. This errs on the
other side, in that very deep types that should be convertible to each
other might now not be. But at least that's not a security hole.

Update #29312.

Change-Id: Iac0ebe73fdc50594fd6fbf7432eef65f9a053126
Reviewed-on: https://go-review.googlesource.com/c/go/+/213517
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
5 years agonet/http: document that ParseForm consumes Request.Body
Luka Zitnik [Tue, 24 Dec 2019 00:08:11 +0000 (01:08 +0100)]
net/http: document that ParseForm consumes Request.Body

Fixes #35620

Change-Id: I71bc56ec7a7507d14b4f013177b4b816bb1a2094
Reviewed-on: https://go-review.googlesource.com/c/go/+/212458
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agoruntime: use FP offsets for pipe/pipe2 on freebsd/arm64 and linux/arm64
Joel Sing [Tue, 7 Jan 2020 06:14:51 +0000 (17:14 +1100)]
runtime: use FP offsets for pipe/pipe2 on freebsd/arm64 and linux/arm64

This is more readable and less error-prone than using RSP offsets.

Suggested during review of CL 212765.

Change-Id: I070190abeeac8eae5dbd414407602619d9d57422
Reviewed-on: https://go-review.googlesource.com/c/go/+/213577
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
5 years agocmd/go: fix TestScript/test_main_twice
Michael Matloob [Tue, 7 Jan 2020 21:25:34 +0000 (16:25 -0500)]
cmd/go: fix TestScript/test_main_twice

The TMPDIR environment variable isn't always available. Use $WORK/tmp
instead, to fix this test on Windows.

Change-Id: I521c470430c6eea4d1f2fc7db749d38178a03a13
Reviewed-on: https://go-review.googlesource.com/c/go/+/213680
Run-TryBot: Michael Matloob <matloob@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years agocmd/go: fix test broken by incorrect comments
Michael Matloob [Tue, 7 Jan 2020 19:43:00 +0000 (14:43 -0500)]
cmd/go: fix test broken by incorrect comments

I accidentally used // instead of #.

Change-Id: I2c9b9d40dd83994ce80fc837e8d992d3807f3e24
Reviewed-on: https://go-review.googlesource.com/c/go/+/213659
Run-TryBot: Michael Matloob <matloob@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
5 years agocmd/go: convert import comment tests to script framework
Michael Matloob [Mon, 6 Jan 2020 19:26:28 +0000 (14:26 -0500)]
cmd/go: convert import comment tests to script framework

Part of converting all tests to script framework to improve
test parallelism.

Updates #36320
Updates #17751

Change-Id: I30230ca3b4d8b037ea861db952b89e706ed8706d
Reviewed-on: https://go-review.googlesource.com/c/go/+/213425
Run-TryBot: Michael Matloob <matloob@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
5 years agocmd/go: convert TestImportCycle to the script framework
Michael Matloob [Mon, 6 Jan 2020 20:06:10 +0000 (15:06 -0500)]
cmd/go: convert TestImportCycle to the script framework

This test already calls tg.Parallel

Part of converting all tests to script framework to improve
test parallelism.

Updates #36320
Updates #17751

Change-Id: I4cdb2464cd3e51f1369558c238925f036ce8d828
Reviewed-on: https://go-review.googlesource.com/c/go/+/213426
Run-TryBot: Michael Matloob <matloob@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
5 years agocmd/go: convert tests using testdata/src/testrace to script framework
Michael Matloob [Thu, 2 Jan 2020 20:47:45 +0000 (15:47 -0500)]
cmd/go: convert tests using testdata/src/testrace to script framework

Part of converting all tests to script framework to improve
test parallelism.

Updates #36320
Updates #17751

Change-Id: Id4c2c58167d5cfc80b0d81ca9ce3db678242c06c
Reviewed-on: https://go-review.googlesource.com/c/go/+/213128
Run-TryBot: Michael Matloob <matloob@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
5 years agonet/http: avoid writing to Transport.ProxyConnectHeader
Bryan C. Mills [Tue, 7 Jan 2020 17:03:28 +0000 (12:03 -0500)]
net/http: avoid writing to Transport.ProxyConnectHeader

Previously, we accidentally wrote the Proxy-Authorization header for
the initial CONNECT request to the shared ProxyConnectHeader map when
it was non-nil.

Fixes #36431

Change-Id: I5cb414f391dddf8c23d85427eb6973f14c949025
Reviewed-on: https://go-review.googlesource.com/c/go/+/213638
Run-TryBot: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years agocmd/go: convert TestTestRegexps to the script framework
Michael Matloob [Thu, 2 Jan 2020 21:42:43 +0000 (16:42 -0500)]
cmd/go: convert TestTestRegexps to the script framework

It's hard to convert this one exactly because I don't think
we can guarantee that the grep command exists to filter stdout,
so I've tried to replicate the intent of the test.

Part of converting all tests to script framework to improve
test parallelism.

Updates #36320
Updates #17751

Change-Id: Ib593799ef7634ce12efb3ff357eb34475e2ea321
Reviewed-on: https://go-review.googlesource.com/c/go/+/213130
Run-TryBot: Michael Matloob <matloob@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
5 years agocmd/go: convert TestCoverageImportMainLoop and TestGoTestMain
Michael Matloob [Mon, 30 Dec 2019 20:47:54 +0000 (15:47 -0500)]
cmd/go: convert TestCoverageImportMainLoop and TestGoTestMain

Convert these two tests to the script framework.

Updates #17751
Updates #36320

Change-Id: I9cc14360fab949dab91f9e5e667be85002ef5926
Reviewed-on: https://go-review.googlesource.com/c/go/+/212811
Run-TryBot: Michael Matloob <matloob@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
5 years agocmd/go: remove tests using testdata/flag_test.go
Michael Matloob [Fri, 3 Jan 2020 22:03:42 +0000 (17:03 -0500)]
cmd/go: remove tests using testdata/flag_test.go

Part of converting all tests to script framework to improve
test parallelism.

Updates #36320
Updates #17751

Change-Id: I6573185cf14f298c51f76265f18a75e4960ce791
Reviewed-on: https://go-review.googlesource.com/c/go/+/213220
Run-TryBot: Michael Matloob <matloob@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
5 years agoruntime: correct assembly for openbsd/arm64
Joel Sing [Mon, 6 Jan 2020 17:25:57 +0000 (04:25 +1100)]
runtime: correct assembly for openbsd/arm64

Correct the pipe and pipe2 implementations by using the correct RSP offsets,
used to store and return the file descriptor array.

Fix setNonblock by using the correct immediate value for O_NONBLOCK and
replace EOR (exclusive OR) with ORR.

Also correct the write1 implementation, which has a uintptr value for the fd
argument.

Change-Id: Ibca77af44b649e8bb330ca54f9c36a7a8b0f9cea
Reviewed-on: https://go-review.googlesource.com/c/go/+/212765
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
5 years agoruntime: fix typo in comment
Julian Tibble [Tue, 7 Jan 2020 10:26:48 +0000 (10:26 +0000)]
runtime: fix typo in comment

Change-Id: I96db053184e5e72864514d5421a97774545cc2dd
GitHub-Last-Rev: f1451ab626563f82f1703a559e4cb6d66665a7b6
GitHub-Pull-Request: golang/go#36425
Reviewed-on: https://go-review.googlesource.com/c/go/+/213597
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agoruntime: correct setNonblock on linux/arm64
Joel Sing [Mon, 6 Jan 2020 17:31:23 +0000 (04:31 +1100)]
runtime: correct setNonblock on linux/arm64

The current code uses EOR (exclusive OR), which will result in the O_NONBLOCK
flag being toggled rather than being set. Other implementations use OR, hence
this is likely a bug.

Change-Id: I5dafa9c572452070bd37789c8a731ad6d04a86cd
Reviewed-on: https://go-review.googlesource.com/c/go/+/212766
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years agoruntime: avoid potential deadlock when tracing memory code
Dan Scales [Tue, 19 Nov 2019 21:58:28 +0000 (13:58 -0800)]
runtime: avoid potential deadlock when tracing memory code

In reclaimChunk, the runtime is calling traceGCSweepDone() while holding the mheap
lock. traceGCSweepDone() can call traceEvent() and traceFlush(). These functions
not only can get various trace locks, but they may also do memory allocations
(runtime.newobject) that may end up getting the mheap lock. So, there may be
either a self-deadlock or a possible deadlock between multiple threads.

It seems better to release the mheap lock before calling traceGCSweepDone(). It is
fine to release the lock, since the operations to get the index of the chunk of
work to do are atomic. We already release the lock to call sweep, so there is no
new behavior for any of the callers of reclaimChunk.

With this change, mheap is a leaf lock (no other lock is ever acquired while it
is held).

Testing: besides normal all.bash, also ran all.bash with --long enabled, since
it does longer tests of runtime/trace.

Change-Id: I4f8cb66c24bb8d424f24d6c2305b4b8387409248
Reviewed-on: https://go-review.googlesource.com/c/go/+/207846
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
5 years agoos: document that File.Seek works on directories, but not portably
Brad Fitzpatrick [Mon, 6 Jan 2020 16:30:48 +0000 (16:30 +0000)]
os: document that File.Seek works on directories, but not portably

Updates #36019

Change-Id: I9fea2c3c5138e2233290979e4724f6e7b91da652
Reviewed-on: https://go-review.googlesource.com/c/go/+/213439
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agoruntime: test memmove writes pointers atomically
Cherry Zhang [Fri, 27 Dec 2019 17:02:50 +0000 (12:02 -0500)]
runtime: test memmove writes pointers atomically

In the previous CL we ensures that memmove writes pointers
atomically, so the concurrent GC won't observe a partially
updated pointer. This CL adds a test.

Change-Id: Icd1124bf3a15ef25bac20c7fb8933f1a642d897c
Reviewed-on: https://go-review.googlesource.com/c/go/+/212627
Reviewed-by: Austin Clements <austin@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years agocmd/go: convert some cgo-related testcases to script framework
Michael Matloob [Thu, 26 Dec 2019 22:47:26 +0000 (17:47 -0500)]
cmd/go: convert some cgo-related testcases to script framework

This change converts TestCoverageWithCgo and TestCgoConsistentResults
to the script framework.

Change-Id: Ic5a13f6dd6099d3d73a5cda8cbc724a79a3d2c58
Reviewed-on: https://go-review.googlesource.com/c/go/+/212621
Run-TryBot: Michael Matloob <matloob@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
5 years agocmd/go: convert TestGoTestWithoutTests to the script framework
Michael Matloob [Thu, 2 Jan 2020 20:39:28 +0000 (15:39 -0500)]
cmd/go: convert TestGoTestWithoutTests to the script framework

Part of converting all tests to script framework to improve
test parallelism.

Updates #36320
Updates #17751

Change-Id: Ibc3cb3823bd1c1b80058076f2c9933dc729447a5
Reviewed-on: https://go-review.googlesource.com/c/go/+/213127
Run-TryBot: Michael Matloob <matloob@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
5 years agocmd/go/testdata/script: delete trailing space in test
Michael Matloob [Mon, 6 Jan 2020 17:35:19 +0000 (12:35 -0500)]
cmd/go/testdata/script: delete trailing space in test

Addressing comment in golang.org/cl/212620. I submitted the
change before I addressed the comment.

Change-Id: I008fdb4fed1e0b2d24d739991fe10122695b90b6
Reviewed-on: https://go-review.googlesource.com/c/go/+/213419
Run-TryBot: Michael Matloob <matloob@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
5 years agocmd/go: convert TestIssue17119 to the script test framework
Michael Matloob [Mon, 30 Dec 2019 18:28:43 +0000 (13:28 -0500)]
cmd/go: convert TestIssue17119 to the script test framework

It's already parallel, but we might as well convert it and
get rid of the testdata/src dircetory completely.

Updates #36320

Change-Id: I75e335b32d64a8ddedd65e4337949b729c9e0fbe
Reviewed-on: https://go-review.googlesource.com/c/go/+/212877
Run-TryBot: Michael Matloob <matloob@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
5 years agocmd/go: convert some testcases to the script framework
Michael Matloob [Thu, 26 Dec 2019 21:06:49 +0000 (16:06 -0500)]
cmd/go: convert some testcases to the script framework

This change converts TestFatalInBenchmarkCauseNonZeroExitStatus,
TestBenchmarkLabels and TestWildCardsDoNotLookInUselessDirectories
to the script framework so they can run in parallel. These tests
used the testdata directory so they didn't call tg.parallel, because
they couldn't be sure the testdata directory wasn't being
modified while they were being run.

The tests are converted to the script framework instead of being modified
because the script framework tests are easier to read and are self-contained.

Also remove the directory src/cmd/go/testdata/src/badc. The testcase
that used it, "TestDisallowedCSourceFiles" was deleted in
golang.org/cl/19613.

Updates #17751

Change-Id: I0b9b417ae1a9b148067a3e5f8531229f3414f104
Reviewed-on: https://go-review.googlesource.com/c/go/+/212620
Run-TryBot: Michael Matloob <matloob@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
5 years agocmd/go: parallellize more test cases
Michael Matloob [Thu, 26 Dec 2019 20:03:12 +0000 (15:03 -0500)]
cmd/go: parallellize more test cases

Sprinkle in some more calls to tg.Parallel in the cmd/go
tests. These are the easy cases that don't operate in the
testdata directory.

I think the best thing to do for those tests that do operate
in testdata is to use the script tests. They're easier to
read and write, and jump into t.Parallel immediately.

Updates #17751

Change-Id: If8aeb8129cfdc0a9aa91f5a540f179790077fce5
Reviewed-on: https://go-review.googlesource.com/c/go/+/212618
Run-TryBot: Michael Matloob <matloob@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
5 years ago.github: add link to questions in ISSUE_TEMPLATE
Sean Liao [Mon, 6 Jan 2020 16:58:37 +0000 (16:58 +0000)]
.github: add link to questions in ISSUE_TEMPLATE

Add a link redirecting questions to the wiki page/forums

Change-Id: I05b784e6bb0c260cb01c4535ad05fb17ba80110e
GitHub-Last-Rev: a927ce5c69df7854ae919013b0e55ab4d356fc4c
GitHub-Pull-Request: golang/go#36413
Reviewed-on: https://go-review.googlesource.com/c/go/+/213440
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agocmd/go: convert TestGoGenerateBadImports to script framework
Michael Matloob [Mon, 30 Dec 2019 19:15:11 +0000 (14:15 -0500)]
cmd/go: convert TestGoGenerateBadImports to script framework

Part of converting all tests to script framework to improve
test parallelism.

Updates #36320
Updates #17751

Change-Id: Id1afafad2063d917fd55e08f0725ce3e93201c35
Reviewed-on: https://go-review.googlesource.com/c/go/+/212878
Run-TryBot: Michael Matloob <matloob@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
5 years agocmd/go: convert TestRunPkg to the script framework
Michael Matloob [Mon, 30 Dec 2019 19:55:57 +0000 (14:55 -0500)]
cmd/go: convert TestRunPkg to the script framework

Part of the effort to convert all non-parallel cmd/go tests to the script
framework.

Updates #17751
Updates #36320

Change-Id: I2bc0b1e5c03e2c49b5c79ac24a908a202840d5d4
Reviewed-on: https://go-review.googlesource.com/c/go/+/212879
Run-TryBot: Michael Matloob <matloob@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
5 years agonet: update renamed test name in comment
Brad Fitzpatrick [Mon, 6 Jan 2020 15:46:42 +0000 (15:46 +0000)]
net: update renamed test name in comment

TestSelfConnect from CL 5650071 was renamed TestTCPSelfConnect in CL 21447.

Change-Id: I0de110dbe1da77bfba540a1b51c139f3bedae67f
Reviewed-on: https://go-review.googlesource.com/c/go/+/213437
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
5 years agoRevert "cmd/link: skip symbol references when looking for missing symbols"
Austin Clements [Mon, 6 Jan 2020 15:32:43 +0000 (15:32 +0000)]
Revert "cmd/link: skip symbol references when looking for missing symbols"

This reverts commit 8adc1e00aa1a92a85b9d6f3526419d49dd7859dd.

Reason for revert: The test added in this commit fails on several
builders.

Fixes #36389. Re-opens #33979.

Change-Id: I31191098c36af00f7688749b3376686673b3ac68
Reviewed-on: https://go-review.googlesource.com/c/go/+/213417
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alberto Donizetti <alb.donizetti@gmail.com>