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>
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]
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.
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>
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.
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>
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.
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>
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>
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.
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>
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>
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.
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>
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.
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>
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>
Joel Sing [Sun, 5 Jan 2020 14:52:19 +0000 (01:52 +1100)]
syscall: resync various riscv64 structs with x/sys/unix
For some reason the existing versions have additional padding - manually resync these
structs with those in x/sys/unix, also bringing in pollFd which does not currently
exist for linux/riscv64.
Cross checked with the output from 'go tool cgo -godefs' on a linux/riscv64 machine.
Joel Sing [Sun, 5 Jan 2020 14:48:43 +0000 (01:48 +1100)]
syscall: provide Renameat as a wrapper around renameat2 on riscv64
linux/riscv64 does not provide a renameat syscall and there is no SYS_RENAMEAT
defined in the syscall package. Provide Renameat as a wrapper around renameat2
instead.
Joel Sing [Sun, 5 Jan 2020 13:18:56 +0000 (00:18 +1100)]
syscall: fix riscv64 syscall assembly
RISCV has no instruction to store an immediate value to memory, or to
subtract an immediate value. An immediate needs to be moved to a register
first, or in the case of $0, the zero value register (ZERO or R0) can be
used instead. Restore the original riscv-go code so that it compiles.
Joel Sing [Fri, 30 Aug 2019 15:02:04 +0000 (01:02 +1000)]
cmd/link: skip symbol references when looking for missing symbols
ErrorUnresolved attempts to find the missing symbol in another ABI,
in order to provide more friendly error messages. However, in doing so
it checks the same ABI and can find the symbol reference for the symbol
that it is currently reporting the unresolved error for. Avoid this by
ignoring SXREF symbols, which is the same behaviour used when linking
is performed.
Fixes #33979
Change-Id: I3cb2477b2ad4baa7c2007323b983eb29404b0aac
Reviewed-on: https://go-review.googlesource.com/c/go/+/192597
TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Austin Clements <austin@google.com>
Run-TryBot: Joel Sing <joel@sing.id.au>
Joel Sing [Tue, 31 Dec 2019 14:44:54 +0000 (01:44 +1100)]
cmd/internal/obj/riscv: correct CALL reloc symbol handling
Move the CALL reloc symbol back to p.From.Sym, rather than p.To.Sym - while
p.To.Sym is the correct final location, the call to lowerJALR flips the p.To
and p.From addresses (and proves that this form of obj.Prog rewriting is not
a good idea).
Joel Sing [Tue, 31 Dec 2019 14:28:22 +0000 (01:28 +1100)]
cmd/internal/obj/riscv: handle MOV rewrites in separate pass
Handle the rewriting of MOV pseudo-instructions in a separate pass. This allows
AMOV to be more readily used by other code, including AGETCALLERPC and ARET
implementations.
Cherry Zhang [Mon, 30 Dec 2019 16:26:17 +0000 (11:26 -0500)]
runtime: don't use R11 in nanotime1/walltime1 on ARM
R11 a.k.a. REGTMP is the temp register used by the assembler. It
may be clobbered if the assembler needs to synthesize
instructions. In particular, in nanotime1/walltime1, the load of
global variable runtime.iscgo clobbers it. So, avoid using R11
to hold a long-lived value.
Fixes #36309.
Change-Id: Iec2ab9d664532cad8fbf58da17f580e64a744f62
Reviewed-on: https://go-review.googlesource.com/c/go/+/212641 Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com> Reviewed-by: Andrew G. Morgan <agm@google.com> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Daniel Martí [Sun, 13 Oct 2019 12:18:03 +0000 (13:18 +0100)]
doc: document atexit_sleep_ms flag in race_detector
It was pointed out to me that the thread sanitizer library has many more
flags than the ones documented in this doc page. In particular, I was
able to make use of GORACE=atexit_sleep_ms=10 to reduce the amount that
'go test -race' will sleep before finishing.
I'm sure that this flag will be useful to others in the future, so add
it here. This is still not a complete list, but we can simply add useful
flags that work when we think they deserve a mention.
Michael Matloob [Mon, 30 Dec 2019 21:56:00 +0000 (16:56 -0500)]
cmd/go: convert TestRunInternal to the script test framework
This conversion is a bit weird, because the original test runs in the cmd/go
directory, while the script test runs in the GOPATH directory. So even though
it's not necessary for the new test, it changes dircectory to $WORK, so that
its error message regexp can have four components like the original, just
changing the old gopath directory 'testdata' the new one 'gopath'.
Part of converting all tests to script framework to improve test parallelism.
Updates #36320
Updates #17751
Change-Id: Ie5b029c43dc22167278d3104b37c0b57c61326be
Reviewed-on: https://go-review.googlesource.com/c/go/+/212814
Run-TryBot: Michael Matloob <matloob@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Jay Conrod <jayconrod@google.com>
Michael Matloob [Mon, 30 Dec 2019 22:10:23 +0000 (17:10 -0500)]
cmd/go: convert TestCoveragePattern to the script framework
This test already runs in parallel, but still convert it to the
script framework so we can delete the testdata/src directory and
remove any ambiguity about which tests can run in parallel.
Updates #36320
Change-Id: I6470979bd8bad0631dc6ead0d4eb9c83878356e8
Reviewed-on: https://go-review.googlesource.com/c/go/+/212815
Run-TryBot: Michael Matloob <matloob@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Jay Conrod <jayconrod@google.com>
The error that's tested in this test is also tested in list_test_err.txt
which uses go list -test -deps. Because both commands are just loading
packages, the difference is not meaningful.
Updates #36320
Updates #17751
Change-Id: Ie712a77d64e8985dd908a1afb515ed3ecc0a9985
Reviewed-on: https://go-review.googlesource.com/c/go/+/212937
Run-TryBot: Michael Matloob <matloob@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Jay Conrod <jayconrod@google.com>
Michael Matloob [Mon, 30 Dec 2019 23:49:27 +0000 (18:49 -0500)]
cmd/go: convert TestPluginNonMain to script framework
TestPluginNonMain was broken before this change! (It provided the
wrong directory for testdep/p2: testdata/testdep/p2 instead of
testdata/src/testdep/p2).
Change-Id: Ib815f119bae1d758b500cd8ad82c016cb630d71e
Reviewed-on: https://go-review.googlesource.com/c/go/+/212938
Run-TryBot: Michael Matloob <matloob@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Jay Conrod <jayconrod@google.com>
Michael Matloob [Mon, 30 Dec 2019 22:51:16 +0000 (17:51 -0500)]
cmd/go: convert tests using testdata/src/syntaxerror to scripts
This includes TestMatchesNoTestsDoesNotOverrideBuildFailure
and TestErrorMessageForSyntaxErrorInTestGoFileSaysFAIL.
Convert the tests that use the testdata/src/syntaxerror directory
to the script framework.
Part of converting all tests to script framework to improve
test parallelism.
Updates #36320
Updates #17751
Change-Id: I2b2b616e8c124996ae8c8e5b737f15bb493ec588
Reviewed-on: https://go-review.googlesource.com/c/go/+/212816
Run-TryBot: Michael Matloob <matloob@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Jay Conrod <jayconrod@google.com>
There should be only one copy, otherwise it may lead to confusion,
or changes made in the wrong place. This CL removes the old copies
from this repo since they're no longer used.
Updates #29206
Change-Id: I41adfb2c34ed3d870fb7a671f48ccc8f90863feb
Reviewed-on: https://go-review.googlesource.com/c/go/+/213157
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Jay Conrod <jayconrod@google.com>
Austin Clements [Thu, 2 Jan 2020 20:23:26 +0000 (15:23 -0500)]
doc/go1.14: mention sync.Mutex changes
Change-Id: Icd92d115e5d7f00b2100598baf2522ebebcdb223
Reviewed-on: https://go-review.googlesource.com/c/go/+/213125 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Cherry Zhang [Fri, 27 Dec 2019 17:02:00 +0000 (12:02 -0500)]
runtime: ensure memmove write pointer atomically on ARM64
If a pointer write is not atomic, if the GC is running
concurrently, it may observe a partially updated pointer, which
may point to unallocated or already dead memory. Most pointer
writes, like the store instructions generated by the compiler,
are already atomic. But we still need to be careful in places
like memmove. In memmove, we don't know which bits are pointers
(or too expensive to query), so we ensure that all aligned
pointer-sized units are written atomically.
Rhys Hiltner [Wed, 18 Dec 2019 00:40:46 +0000 (16:40 -0800)]
runtime: emit trace event in direct semaphore handoff
When a goroutine yields the remainder of its time to another goroutine
during direct semaphore handoff (as in an Unlock of a sync.Mutex in
starvation mode), it needs to signal that change to the execution
tracer. The discussion in CL 200577 didn't reach consensus on how best
to describe that, but pointed out that "traceEvGoSched / goroutine calls
Gosched" could be confusing.
Emit a "traceEvGoPreempt / goroutine is preempted" event in this case,
to allow the execution tracer to find a consistent event ordering
without being both specific and inaccurate about why the active
goroutine has changed.
Dmitri Shuralyov [Wed, 1 Jan 2020 05:00:00 +0000 (00:00 -0500)]
doc: 2020 is the Year of the Gopher
Starting with 2014 (golang.org/cl/46660043), we have enjoyed 6
consecutive years of the gopher. Now, the slice¹ of gophers is
ready to make its way into the next decade, as 2020 is the new
Year of the Gopher.
Tobias Klauser [Fri, 20 Dec 2019 22:34:23 +0000 (23:34 +0100)]
internal/poll: use correct fcntl implementations
Use the libc fcntl (via syscall.fcntl) on aix and solaris like it is
already done for darwin.
For the syscall-based fcntl implementation use FcntlSyscall from
internal/syscall/unix in order to get fcntl64 on 32-bit Linux
systems.
On aix, fcntl with F_DUPFD_CLOEXEC is not supported. Thus, defined
F_DUPFD_CLOEXEC = 0 in the syscall package and check its value before
calling fcntl(fd, syscall.F_DUPFD_CLOEXEC, 0).
On js/wasm, fcntl is not supported thus let its implementation return
ENOSYS directly.
Updates #36211
Change-Id: I96a2ea79e5c4eed2fefd94d0aefd72c940825682
Reviewed-on: https://go-review.googlesource.com/c/go/+/212278
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Change-Id: I25fbd63f10ea9892589ad44cc45761926aff0648
Reviewed-on: https://go-review.googlesource.com/c/go/+/212841 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Michael Anthony Knyszek [Thu, 26 Dec 2019 19:49:39 +0000 (19:49 +0000)]
runtime: check whether scavAddr is in inUse on scavengeOne fast path
This change makes it so that we check whether scavAddr is actually
mapped before trying to look at the summary for the fast path, since we
may segfault if that that part of the summary is not mapped in.
Previously this wasn't a problem because we would conservatively map
all memory for the summaries between the lowest mapped heap address and
the highest one.
Michael Anthony Knyszek [Thu, 19 Dec 2019 17:44:58 +0000 (17:44 +0000)]
runtime: disable pageAlloc tests on OpenBSD in short mode
This change disables pageAlloc tests on OpenBSD in short mode because
pageAlloc holds relatively large virtual memory reservations and we make
two during the pageAlloc tests. The runtime may also be carrying one
such reservation making the virtual memory requirement for testing the
Go runtime three times as much as just running a Go binary.
This causes problems for folks who just want to build and test Go
(all.bash) on OpenBSD but either don't have machines with at least 4ish
GiB of RAM (per-process virtual memory limits are capped at some
constant factor times the amount of physical memory) or their
per-process virtual memory limits are low for other reasons.
Fixes #36210.
Change-Id: I8d89cfde448d4cd2fefff4ad6ffed90de63dd527
Reviewed-on: https://go-review.googlesource.com/c/go/+/212177
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Bryan C. Mills <bcmills@google.com>
Ariel Mashraki [Tue, 24 Dec 2019 14:28:16 +0000 (16:28 +0200)]
doc/go1.14: change hash/maphash package link
Package name and documentation link were wrong.
Change-Id: I274906afc3cf7a3d88e3da76549cd6ab008fd0c7
Reviewed-on: https://go-review.googlesource.com/c/go/+/212538 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Ian Lance Taylor [Fri, 20 Dec 2019 21:05:24 +0000 (13:05 -0800)]
internal/syscall/unix: use fcntl64 on 32-bit GNU/Linux systems
Patch up runtime testing to use the libc fcntl function on Darwin,
which is what we should be doing anyhow. This is similar to how
we handle fcntl on AIX and Solaris.
Fixes #36211
Change-Id: I47ad87e11df043ce21496a0d59523dad28960f76
Reviewed-on: https://go-review.googlesource.com/c/go/+/212299
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Ian Lance Taylor [Fri, 13 Dec 2019 01:00:08 +0000 (17:00 -0800)]
misc/cgo/test: tweak to pass with GCC 10
The test for issue 8945 was marked to only run on gccgo, but there was
no reason for that. It broke for gccgo using GCC 10, because GCC 10
defaults to -fno-common. Make the test run on gc, and split it into
test.go and testx.go to make it work with GCC 10.
The test for issue 9026 used two identical structs which GCC 10 turns
into the same type. The point of the test is not that the structs are
identical, but that they are handled in a particular order. So make
them different.
Updates #8945
Updates #9026
Change-Id: I000fb02f88f346cfbbe5dbefedd944a2c64e8d8e
Reviewed-on: https://go-review.googlesource.com/c/go/+/211217
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Than McIntosh <thanm@google.com>
Dan Scales [Thu, 19 Dec 2019 01:27:27 +0000 (17:27 -0800)]
runtime: make sure BP is saved in nanotime1/walltime1, else frame pointer may not be preserved
nanotime1 and walltime1 do not preserve BP on linux amd64. Previously, this
did not cause a problem, because nanotime/walltime do preserve the BP. But now
with mid-stack inlining, nanotime/walltime are usually inlined, so BP is not
preserved. So, the BP is now wrong in any function after a call to
nanotime()/walltime() on amd64. That means the frame pointer on the stack can
be wrong for any further function call made after the nanotime() call (notably
runtime.main and various GC functions). [386 doesn't use framepointer.]
Fix is to set a frame size of 8 for nanotime1 and walltime1, which means the
standard prolog/epilog that saves/restore BP in the stack frame is added.
I noticed this while investigating issue 16638 (use frame pointers for
runtime.Callers). This change would needed for progress on that issue (which
doesn't have a high priority). Verified that this fix works/is useful for issue
16638.
Change-Id: I19e19ef2c1a517d737a34928baae034f2eb0b2c2
Reviewed-on: https://go-review.googlesource.com/c/go/+/212079
Run-TryBot: Dan Scales <danscales@google.com> Reviewed-by: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Bryan C. Mills [Fri, 20 Dec 2019 04:17:55 +0000 (23:17 -0500)]
cmd/go/internal/modfetch/codehost: replace a dubious call to semver.Max
The documentation for RecentTag indicates that it returns an actual
tag, not a canonicalized prefix+version blob equivalent to a tag,
so the canonicalization due to semver.Max seems like a bug here.
Fortunately, RecentTag is not currently ever actually used as a tag,
so the removal of metadata does not result in a user-facing bug.
Nonetheless, it may be a subtle source of confusion for maintainers
in the future.
Updates #32700
Change-Id: I525423c1c0c7ec7c36c09e53b180034474f74e5a
Reviewed-on: https://go-review.googlesource.com/c/go/+/212202
Run-TryBot: Bryan C. Mills <bcmills@google.com> Reviewed-by: Jay Conrod <jayconrod@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Bryan C. Mills [Thu, 19 Dec 2019 20:46:06 +0000 (15:46 -0500)]
cmd/go: relax validation for replacements for gopkg.in paths
The 'go' command normally requires the 'go.mod' files for replacement
modules to have a major version compatible with the module they are
replacing.
However, prior to CL 206761, the 'go' command erroneously allowed
unversioned paths (which imply major version 0 or 1) to replace
'gopkg.in' paths with any major-version suffix.
An analysis of proxy.golang.org suggests that these replacements,
while uncommon, are not unheard-of. Rather than breaking the modules
that rely on them, we will continue to allow the erroneous replacement
paths for this particular pairing.
Updates #34254
Change-Id: Icb4e745981803edaa96060f17a8720a058219ab1
Reviewed-on: https://go-review.googlesource.com/c/go/+/212105
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Jay Conrod <jayconrod@google.com>
Jay Conrod [Thu, 19 Dec 2019 18:00:28 +0000 (13:00 -0500)]
cmd/go: in 'go list -m', print effective go.mod file
When the -modfile flag is in use (either explicitly or from GOFLAGS),
'go list -m' will now print the effective go.mod file for the main
module in the GoMod field in -f or -json output.
Fixes #36220
Updates #34506
Change-Id: I89c2ee40f20e07854bb37c6e4e13eeea0cce7b0d
Reviewed-on: https://go-review.googlesource.com/c/go/+/212100
Run-TryBot: Jay Conrod <jayconrod@google.com> Reviewed-by: Bryan C. Mills <bcmills@google.com>
Daniel Martí [Wed, 18 Dec 2019 10:05:59 +0000 (10:05 +0000)]
text/template: indirect interfaces before slicing
The recently added slice function used indirectInterface, but then
forgot to actually call reflect.Value.Slice on its result. Calling the
Slice method on the original Value without indirectInterface would
result in a panic, if our slice was indeed behind an interface.
Fix that, and add test cases for all three built-in functions that work
with slices.
Fixes #36199.
Change-Id: I9a18f4f604a3b29967eefeb573f8960000936b88
Reviewed-on: https://go-review.googlesource.com/c/go/+/211877
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Rob Pike <r@golang.org>
Cherry Zhang [Wed, 18 Dec 2019 20:19:05 +0000 (15:19 -0500)]
runtime: use innermost frame's func name for async preemption check
We don't asynchronously preempt if we are in the runtime. We do
this by checking the function name. However, it failed to take
inlining into account. If a runtime function gets inlined into
a non-runtime function, it can be preempted, and bad things can
happen. One instance of this is dounlockOSThread inlined into
UnlockOSThread which is in turn inlined into a non-runtime
function.
Fix this by using the innermost frame's function name.