]> Cypherpunks repositories - gostls13.git/log
gostls13.git
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>
5 years agocmd/go: convert TestIssue7108 to the script framework
Michael Matloob [Mon, 30 Dec 2019 21:41:39 +0000 (16:41 -0500)]
cmd/go: convert TestIssue7108 to the script framework

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

Updates #36320
Updates #17751

Change-Id: Ic16a0c6c1eabeba003b9cff620e2911078fd6cf8
Reviewed-on: https://go-review.googlesource.com/c/go/+/212813
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/testdata: remove directory badmod
Michael Matloob [Fri, 3 Jan 2020 21:26:07 +0000 (16:26 -0500)]
cmd/go/testdata: remove directory badmod

It doesn't seem to be used anywhere.

Change-Id: If979b6d69c9bf5261afd980d96f67991c417d46d
Reviewed-on: https://go-review.googlesource.com/c/go/+/213218
Run-TryBot: Michael Matloob <matloob@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
5 years agosyscall: resync various riscv64 structs with x/sys/unix
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.

Updates #27532

Change-Id: I9fd2d3ad7222208a138773f4a9153c3c9cad7381
Reviewed-on: https://go-review.googlesource.com/c/go/+/212763
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
5 years agosyscall: provide Renameat as a wrapper around renameat2 on riscv64
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.

Updates #27532

Change-Id: I4864bdf0055e4272920583dcfb0efe2fd40adcbc
Reviewed-on: https://go-review.googlesource.com/c/go/+/212762
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
5 years agosyscall: fix riscv64 syscall assembly
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.

Updates #27532

Change-Id: I3c60e6f385c59679252a710dbba153357a367516
Reviewed-on: https://go-review.googlesource.com/c/go/+/212761
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
5 years agoall: fix typo in RuneSelf, runeSelf comments
Tim Cooper [Mon, 6 Jan 2020 02:16:26 +0000 (20:16 -0600)]
all: fix typo in RuneSelf, runeSelf comments

Fixes #36396

Change-Id: I52190f450fa9ac52fbf4ecdc814e954dc29029cd
Reviewed-on: https://go-review.googlesource.com/c/go/+/213377
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years agocmd/link: skip symbol references when looking for missing symbols
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>

5 years agocmd/internal/obj/riscv: correct CALL reloc symbol handling
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).

Updates #27532

Change-Id: Iaf9fa24b05bda32b963f8d243401c6cd82c1355c
Reviewed-on: https://go-review.googlesource.com/c/go/+/212759
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: handle MOV rewrites in separate pass
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.

Updates #27532

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

5 years agoruntime: don't use R11 in nanotime1/walltime1 on ARM
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>

5 years agodoc: document atexit_sleep_ms flag in race_detector
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.

Change-Id: If199d36fd80a0945af90055d110519e5dba27361
Reviewed-on: https://go-review.googlesource.com/c/go/+/200863
Reviewed-by: Heschi Kreinick <heschi@google.com>
5 years agocmd/go: clarify stderr behavior for 'go help mod download'
Jay Conrod [Fri, 3 Jan 2020 18:13:57 +0000 (13:13 -0500)]
cmd/go: clarify stderr behavior for 'go help mod download'

Fixes #36297

Change-Id: I2623e9ee386644eddfa9a348ba368c5f1a81f893
Reviewed-on: https://go-review.googlesource.com/c/go/+/213134
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
5 years agocmd/go: convert TestGoTestImportErrorStack to the script framework
Michael Matloob [Tue, 31 Dec 2019 00:45:29 +0000 (19:45 -0500)]
cmd/go: convert TestGoTestImportErrorStack to the script framework

The literal string match had to be turned into a regexp, otherwise
pretty straightforward.

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

Updates #36320
Updates #17751

Change-Id: I46f62312f02dc9adf83ed91c6f807420d29fbb12
Reviewed-on: https://go-review.googlesource.com/c/go/+/212939
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 TestGoBuildNotMain to script framework
Michael Matloob [Mon, 30 Dec 2019 21:36:39 +0000 (16:36 -0500)]
cmd/go: convert TestGoBuildNotMain to script framework

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

Updates #36320
Updates #17751

Change-Id: Icd62dc8db55bec52ad326bc370ee7e435aae2559
Reviewed-on: https://go-review.googlesource.com/c/go/+/212812
Run-TryBot: Michael Matloob <matloob@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
5 years agocmd/go: convert TestRunInternal to the script test framework
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>
5 years agocmd/go: convert TestCoveragePattern to the script framework
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>
5 years agocmd/go: remove TestGoTestDetectsTestOnlyImportCycles
Michael Matloob [Mon, 30 Dec 2019 23:18:07 +0000 (18:18 -0500)]
cmd/go: remove TestGoTestDetectsTestOnlyImportCycles

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>
5 years agocmd/go: convert TestPluginNonMain to script framework
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>
5 years agocmd/go: convert tests using testdata/src/syntaxerror to scripts
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>
5 years agodoc: remove root.html and conduct.html (moved to x/website)
Dmitri Shuralyov [Thu, 2 Jan 2020 22:23:24 +0000 (17:23 -0500)]
doc: remove root.html and conduct.html (moved to x/website)

root.html has been moved to the x/website repo in CL 180959
(commit golang/website@d83058ced3fadc3e8189107d2fb86c333c356b75).

conduct.html has been moved to the x/website repo in CL 207437
(commit golang/website@99763cba2e5b53679a96f69725f917feb319b799).

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>
5 years agoall: fix invalid invocations of Fatalf in goroutines
Emmanuel T Odeke [Thu, 2 Jan 2020 10:00:55 +0000 (02:00 -0800)]
all: fix invalid invocations of Fatalf in goroutines

Found by running the go vet pass 'testinggoroutine' that
I started in CL 212920.

Change-Id: Ic9462fac85dbafc437fe4a323b886755a67a1efa
Reviewed-on: https://go-review.googlesource.com/c/go/+/213097
Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agodoc: add section for checksum database to module reference doc
Katie Hockman [Fri, 13 Dec 2019 00:57:35 +0000 (09:57 +0900)]
doc: add section for checksum database to module reference doc

Updates #33637

Change-Id: Ia782b3fdc5a8873606b96120a34c9bf194a1a346
Reviewed-on: https://go-review.googlesource.com/c/go/+/211197
Reviewed-by: Jay Conrod <jayconrod@google.com>
5 years agodoc/go1.14: mention sync.Mutex changes
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>
5 years agoruntime: ensure memmove write pointer atomically on ARM64
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.

Fixes #36101.

Change-Id: I1b3ca24c6b1ac8a8aaf9ee470115e9a89ec1b00b
Reviewed-on: https://go-review.googlesource.com/c/go/+/212626
Reviewed-by: Austin Clements <austin@google.com>
5 years agoruntime: emit trace event in direct semaphore handoff
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.

Fixes #36186

Change-Id: Ic4ade19325126db2599aff6aba7cba028bb0bee9
Reviewed-on: https://go-review.googlesource.com/c/go/+/211797
Run-TryBot: Dan Scales <danscales@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
5 years agodoc: 2020 is the Year of the Gopher
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.

¹ https://en.wikipedia.org/w/index.php?title=List_of_English_terms_of_venery,_by_animal&oldid=932675028#G

Change-Id: I5f9598dbedb373bd13021964193fa9e44c67693e
Reviewed-on: https://go-review.googlesource.com/c/go/+/213017
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: David Symonds <dsymonds@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agointernal/poll: use correct fcntl implementations
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>
5 years agointernal/syscall/unix: use libc based fcntl for IsNonblock on aix and solaris
Tobias Klauser [Mon, 30 Dec 2019 14:50:50 +0000 (15:50 +0100)]
internal/syscall/unix: use libc based fcntl for IsNonblock on aix and solaris

On aix and solaris (like on darwin) use libc fcntl to implement
IsNonblock instead of Syscall(SYS_FCNTL, ...) which isn't supported.

Change-Id: I989b02aa0c90b7e2dae025572867dda277fef8be
Reviewed-on: https://go-review.googlesource.com/c/go/+/212600
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agocmd/compile: fix typo in comment
Josh Bleecher Snyder [Mon, 30 Dec 2019 16:35:40 +0000 (08:35 -0800)]
cmd/compile: fix typo in comment

Change-Id: I25fbd63f10ea9892589ad44cc45761926aff0648
Reviewed-on: https://go-review.googlesource.com/c/go/+/212841
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agosyscall: use fcntl64 on 32-bit GNU/Linux systems
Tobias Klauser [Sat, 28 Dec 2019 13:45:35 +0000 (14:45 +0100)]
syscall: use fcntl64 on 32-bit GNU/Linux systems

Use fcntl64Syscall in forkAndExecInChild1 to get fcntl64 on 32-bit Linux
systems.

Updates #36211

Change-Id: Id0e34359256beace970e72102fdace7a987ff2b0
Reviewed-on: https://go-review.googlesource.com/c/go/+/212598
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agoruntime: check whether scavAddr is in inUse on scavengeOne fast path
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.

This change also adds a test for this case.

Change-Id: I2b1d89b5e044dce81745964dfaba829f4becdc57
Reviewed-on: https://go-review.googlesource.com/c/go/+/212637
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
5 years agoio: show ErrUnexpectedEOF in ExampleReadAtLeast
Ian Lance Taylor [Mon, 23 Dec 2019 23:27:46 +0000 (15:27 -0800)]
io: show ErrUnexpectedEOF in ExampleReadAtLeast

Fixes #36245

Change-Id: I10ce50b0cc28b15f4e7be85b8f12cf9d0e4fac96
Reviewed-on: https://go-review.googlesource.com/c/go/+/212404
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
5 years agodoc/go1.14: mention increased number of EINTR errors
Ian Lance Taylor [Thu, 26 Dec 2019 23:57:13 +0000 (15:57 -0800)]
doc/go1.14: mention increased number of EINTR errors

Updates #36281

Change-Id: I3c4487caaf47566212dc62322b2e884e695ea7f1
Reviewed-on: https://go-review.googlesource.com/c/go/+/212657
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agoruntime: disable pageAlloc tests on OpenBSD in short mode
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>
5 years agointernal/poll: use fcntl64 on 32-bit GNU/Linux systems
Tobias Klauser [Tue, 24 Dec 2019 00:24:43 +0000 (01:24 +0100)]
internal/poll: use fcntl64 on 32-bit GNU/Linux systems

Use FcntlSyscall from internal/syscall/unix to get fcntl64 on 32-bit
Linux systems.

Updates #36211

Change-Id: If48a6e09606ca9f7f6e22f3e8dc9a25fb3ccaf65
Reviewed-on: https://go-review.googlesource.com/c/go/+/212537
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agodoc/go1.14: change hash/maphash package link
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>
5 years agonet: fix typo in dns client unix test
Isfan Azhabil [Tue, 24 Dec 2019 10:03:33 +0000 (10:03 +0000)]
net: fix typo in dns client unix test

Fix a typo DNS name, it should be [onion.vegetables.com](http://onion.vegetables.com/)

Change-Id: I4122a2305b8f5e774a834651e70c75b54e9386bd
GitHub-Last-Rev: 9907897944275c5f8c54c79667cbb1ef474539de
GitHub-Pull-Request: golang/go#36270
Reviewed-on: https://go-review.googlesource.com/c/go/+/212410
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agocmd/internal/obj/riscv: handle AGETCALLERPC
Joel Sing [Sun, 3 Nov 2019 17:31:20 +0000 (04:31 +1100)]
cmd/internal/obj/riscv: handle AGETCALLERPC

Updates #27532

Change-Id: Ib3e44ec524ed20bbfbbaf40df22cec335460f3ef
Reviewed-on: https://go-review.googlesource.com/c/go/+/204629
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: handle FEQ/FNEG/SEQZ/SNEZ
Joel Sing [Sun, 3 Nov 2019 17:08:26 +0000 (04:08 +1100)]
cmd/internal/obj/riscv: handle FEQ/FNEG/SEQZ/SNEZ

Based on riscv-go port.

Updates #27532

Change-Id: I5e7f45955e1dfdb9d09cc6a4e6f3ce81216d411d
Reviewed-on: https://go-review.googlesource.com/c/go/+/204628
Reviewed-by: Cherry Zhang <cherryyz@google.com>
5 years agocmd/internal/obj/riscv: handle call, jmp and branch
Joel Sing [Sun, 3 Nov 2019 15:31:37 +0000 (02:31 +1100)]
cmd/internal/obj/riscv: handle call, jmp and branch

Also provide REG_LR to more clearly define the link register.

Based on the riscv-go port.

Updates #27532

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

5 years agointernal/syscall/unix: use fcntl64 on 32-bit GNU/Linux systems
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>
5 years agotesting: document that benchmark logs are dumped to stdout
Alberto Donizetti [Mon, 23 Dec 2019 12:47:20 +0000 (13:47 +0100)]
testing: document that benchmark logs are dumped to stdout

The doc for testing.T and testing.B said that both test and benchmark
logs are printed to stderr, but in reality that wasn't the case.

CL 24311 fixed the doc for T, this change fixes it for B.

Fixes #36257

Change-Id: I0ff77ff44608f60320a1565b371c81e96039e71c
Reviewed-on: https://go-review.googlesource.com/c/go/+/212457
Reviewed-by: Gabriel Aszalos <gabriel.aszalos@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Gabriel Aszalos <gabriel.aszalos@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years agodoc/go1.14: more runtime/compiler release notes
Austin Clements [Wed, 18 Dec 2019 20:24:42 +0000 (15:24 -0500)]
doc/go1.14: more runtime/compiler release notes

This is based on reading through every commit message to runtime and
cmd/{compile,link,internal,asm} since Go 1.13.

Change-Id: I253b1a70ed265f15180fa20c191ceeafa6612ac4
Reviewed-on: https://go-review.googlesource.com/c/go/+/211977
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
5 years agomisc/cgo/test: tweak to pass with GCC 10
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>
5 years agoruntime: make sure BP is saved in nanotime1/walltime1, else frame pointer may not...
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>

5 years agocmd/go/internal/modfetch/codehost: replace a dubious call to semver.Max
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>

5 years agocmd/go: diagnose missing replacement directories
Bryan C. Mills [Fri, 20 Dec 2019 14:34:30 +0000 (09:34 -0500)]
cmd/go: diagnose missing replacement directories

I noticed the missing diagnostic when writing a regression test for #33795.

Change-Id: Ic3249436a6109d71f9ff720b7096f9b872f6a94b
Reviewed-on: https://go-review.googlesource.com/c/go/+/212201
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: avoid erroneous canonicalization when trying to resolve imports using replace...
Bryan C. Mills [Fri, 20 Dec 2019 03:36:13 +0000 (22:36 -0500)]
cmd/go: avoid erroneous canonicalization when trying to resolve imports using replacements

Updates #32700
Fixes #33795

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

5 years agocmd/go: relax validation for replacements for gopkg.in paths
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>
5 years agocmd/go: in 'go list -m', print effective go.mod file
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>
5 years agocmd/go/internal/clean: make 'go clean -testcache' a no-op if the cache directory...
Bryan C. Mills [Thu, 19 Dec 2019 14:33:16 +0000 (09:33 -0500)]
cmd/go/internal/clean: make 'go clean -testcache' a no-op if the cache directory is gone

Fixes #29100

Change-Id: I195191aad825266ab55d38addef9d662cfc72dff
Reviewed-on: https://go-review.googlesource.com/c/go/+/212099
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
5 years agotext/template: indirect interfaces before slicing
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>
5 years agoreflect: record PkgPath of StructOf arguments
Ian Lance Taylor [Thu, 19 Dec 2019 03:59:41 +0000 (19:59 -0800)]
reflect: record PkgPath of StructOf arguments

Fixes #36190
Fixes #36191

Change-Id: I1213ef37b6595af63dbe202a8ade65741caf1356
Reviewed-on: https://go-review.googlesource.com/c/go/+/212001
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agoruntime: use innermost frame's func name for async preemption check
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.

Change-Id: Ifa036ce1320700aaaefd829b4bee0d04d05c395d
Reviewed-on: https://go-review.googlesource.com/c/go/+/211978
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
5 years agodoc/go1.14: release notes for runtime and compiler
Austin Clements [Tue, 17 Dec 2019 22:39:50 +0000 (17:39 -0500)]
doc/go1.14: release notes for runtime and compiler

Change-Id: I9519659983de23f43ff0e05cffd336d8bc351400
Reviewed-on: https://go-review.googlesource.com/c/go/+/211758
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Alexander Rakoczy <alex@golang.org>
5 years agocmd/doc: flag usage() inconsistency
Gert Cuykens [Fri, 18 Oct 2019 02:13:50 +0000 (04:13 +0200)]
cmd/doc: flag usage() inconsistency

Inconsistency between cmd/doc/main.go and cmd/go/internal/doc/doc.go

Fixes #34976

Change-Id: I429200f9305d473edb4505216bb4840ba92af818
Reviewed-on: https://go-review.googlesource.com/c/go/+/201857
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
5 years agodoc/go1.14: document changes to -mod=readonly and go.mod file maintenance
Bryan C. Mills [Tue, 17 Dec 2019 19:41:45 +0000 (14:41 -0500)]
doc/go1.14: document changes to -mod=readonly and go.mod file maintenance

Fixes #36169

Change-Id: Ib9a53fdb0112635b53be38d6818834dd1775e70c
Reviewed-on: https://go-review.googlesource.com/c/go/+/211698
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
5 years agosrc/go/doc: in Examples, check for len of params.List, not nilness
Michael Matloob [Mon, 16 Dec 2019 22:20:02 +0000 (17:20 -0500)]
src/go/doc: in Examples, check for len of params.List, not nilness

This makes the check the same as the one in the tests vet check.
It's safer to check the number of arguments rather than for a nil
slice.

Change-Id: I8e04e9c612573f334770c1c4245238649656c6e2
Reviewed-on: https://go-review.googlesource.com/c/go/+/211598
Run-TryBot: Michael Matloob <matloob@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
5 years agogo/build: rename WorkingDir to Dir go1.14beta1
Bryan C. Mills [Tue, 17 Dec 2019 14:00:57 +0000 (09:00 -0500)]
go/build: rename WorkingDir to Dir

Fixes #36168

Change-Id: If2b7368671e83657a3a74dd030e66e7c68bf2361
Reviewed-on: https://go-review.googlesource.com/c/go/+/211657
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
5 years agotext/template: remove an incorrect comment and clarify docs for AddParseTree
Oliver Powell [Sat, 5 Oct 2019 11:05:56 +0000 (13:05 +0200)]
text/template: remove an incorrect comment and clarify docs for AddParseTree

The comment "If the name is the name of this template, overwrite this template."
is incorrect and should be "is not" instead. This comment is no longer
required once the docs are updated to mention this behaviour instead.

Fixes #34695

Change-Id: I773495b2194d7bb7619b13c1a28cbc76e8f69aac
Reviewed-on: https://go-review.googlesource.com/c/go/+/199139
Reviewed-by: Rob Pike <r@golang.org>
5 years agotime: further clarifications to the (*Timer).Stop docs
Ian Lance Taylor [Wed, 20 Nov 2019 00:14:50 +0000 (16:14 -0800)]
time: further clarifications to the (*Timer).Stop docs

Fixes #35627

Change-Id: I0c5fed46a69a9663e46a9414468ec610063ea05a
Reviewed-on: https://go-review.googlesource.com/c/go/+/207849
Reviewed-by: Rob Pike <r@golang.org>
5 years agodoc: remove Go Security Policy page (moved to x/website)
Dmitri Shuralyov [Fri, 13 Dec 2019 16:23:09 +0000 (11:23 -0500)]
doc: remove Go Security Policy page (moved to x/website)

This page has moved to the x/website repo in CL 211300 (commit
golang/website@3c8b7f99cadaa000e642595d0fabcd9ac496f335).
Remove the old copy in this repo since it's no longer used.

Updates #29206

Change-Id: I8b3396d9e42d1e7262a8cde9577962d33b215836
Reviewed-on: https://go-review.googlesource.com/c/go/+/211301
Reviewed-by: Filippo Valsorda <filippo@golang.org>
5 years agoapi: promote next to go1.14
Alexander Rakoczy [Mon, 16 Dec 2019 18:58:27 +0000 (13:58 -0500)]
api: promote next to go1.14

Change-Id: I14b1a21a8639b3241326e74ab6152673d5d71243
Reviewed-on: https://go-review.googlesource.com/c/go/+/211517
Run-TryBot: Alexander Rakoczy <alex@golang.org>
Run-TryBot: Carlos Amedee <carlos@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
5 years agoruntime: do not use PowerRegisterSuspendResumeNotification on systems with "program...
Jason A. Donenfeld [Thu, 21 Nov 2019 15:16:56 +0000 (16:16 +0100)]
runtime: do not use PowerRegisterSuspendResumeNotification on systems with "program time" timer

Systems where PowerRegisterSuspendResumeNotification returns ERROR_
FILE_NOT_FOUND are also systems where nanotime() is on "program time"
rather than "real time".  The chain for this is:

powrprof.dll!PowerRegisterSuspendResumeNotification ->
  umpdc.dll!PdcPortOpen ->
    ntdll.dll!ZwAlpcConnectPort("\\PdcPort") ->
      syscall -> ntoskrnl.exe!AlpcpConnectPort

Opening \\.\PdcPort fails with STATUS_OBJECT_NAME_NOT_FOUND when pdc.sys
hasn't been initialized. Pdc.sys also provides the various hooks for
sleep resumption events, which means if it's not loaded, then our "real
time" timer is actually on "program time". Finally STATUS_OBJECT_NAME_
NOT_FOUND is passed through RtlNtStatusToDosError, which returns ERROR_
FILE_NOT_FOUND. Therefore, in the case where the function returns ERROR_
FILE_NOT_FOUND, we don't mind, since the timer we're using will
correspond fine with the lack of sleep resumption notifications. This
applies, for example, to Docker users.

Fixes #35447
Fixes #35482

Change-Id: I9e1ce5bbc54b9da55ff7a3918b5da28112647eee
Reviewed-on: https://go-review.googlesource.com/c/go/+/208317
Reviewed-by: Jason A. Donenfeld <Jason@zx2c4.com>
Reviewed-by: Austin Clements <austin@google.com>
Run-TryBot: Jason A. Donenfeld <Jason@zx2c4.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years agogo/doc: ignore example functions with arguments
Michael Matloob [Fri, 13 Dec 2019 21:53:28 +0000 (16:53 -0500)]
go/doc: ignore example functions with arguments

An Example function with arguments is not a valid example to be
run with go test. Don't return those functions from Examples. This
means that some functions that were previously showing up in
Examples will no longer show up. But those functions were not being
tested properly so the fact that they were showing up is misleading.

This fixes an issue where a confusing compiler error was showing
up when running go test on a file with an invalid example. While
that issue could have been fixed by returning an error, this is
more consistent with the behavior of go/doc.Examples, and the tests
checker in vet will catch this issue.

Fixes #35284

Change-Id: I2101a7d19f38522ef9c2e50967f9cfb30d28c730
Reviewed-on: https://go-review.googlesource.com/c/go/+/211357
Run-TryBot: Michael Matloob <matloob@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
5 years agoos/exec: ignore hungup error while copying stdin on Plan 9
Fazlul Shahriar [Thu, 21 Nov 2019 09:09:17 +0000 (04:09 -0500)]
os/exec: ignore hungup error while copying stdin on Plan 9

Fixes #35753

Change-Id: I38674c59c601785eb25b778dc25efdb92231dd9b
Reviewed-on: https://go-review.googlesource.com/c/go/+/208223
Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agospec: reword claim about the grammar being regular
Alberto Donizetti [Fri, 13 Dec 2019 11:07:06 +0000 (12:07 +0100)]
spec: reword claim about the grammar being regular

Since the word "regular" has a precise meaning in the context of
formal languages, the Introduction sentence claiming that Go's grammar
is "compact and regular" may mislead readers.

Reword it using Rob's suggestion.

Fixes #36037

Change-Id: I00c1a5714bdab8878d9a77b36d67dae67d63da0f
Reviewed-on: https://go-review.googlesource.com/c/go/+/211277
Reviewed-by: Robert Griesemer <gri@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
5 years agodoc: fix missing closing tag in module documentation
Jay Conrod [Fri, 13 Dec 2019 16:11:11 +0000 (11:11 -0500)]
doc: fix missing closing tag in module documentation

Updates #33637

Change-Id: If262d1501cf73b404361f832a2e3e17aaa0db78b
Reviewed-on: https://go-review.googlesource.com/c/go/+/211299
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
5 years agoruntime: fix off-by-1 error on address ranges
Cherry Zhang [Thu, 12 Dec 2019 21:41:24 +0000 (16:41 -0500)]
runtime: fix off-by-1 error on address ranges

When growing the address ranges, the new length is the old length + 1.

Fixes #36113.

Change-Id: I1b425f78e473cfa3cbdfe6113e166663f41fc9f3
Reviewed-on: https://go-review.googlesource.com/c/go/+/211157
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
5 years agodoc: remove expiration from PGP key in security.html
Filippo Valsorda [Thu, 12 Dec 2019 22:04:04 +0000 (17:04 -0500)]
doc: remove expiration from PGP key in security.html

The key had expired earlier this year. Simply resigned it with no
expiration, so it maintains the same fingerprint.

Removed the encouragement to use PGP above the fold. We trust the
security of our mail system, so it's really only there for people that
want it.

Also removed the individual keys, as they were never used, and both Adam
and I have access to the security@golang.org key anyway.

Change-Id: Icc5ad6dfb4f0b52128a59a080b7f270b20d3c520
Reviewed-on: https://go-review.googlesource.com/c/go/+/211177
Reviewed-by: Katie Hockman <katie@golang.org>
5 years agoruntime: force segv for nil defer function to be in deferreturn()
Dan Scales [Wed, 11 Dec 2019 01:27:26 +0000 (17:27 -0800)]
runtime: force segv for nil defer function to be in deferreturn()

If the defer function pointer is nil, force the seg fault to happen in deferreturn
rather than in jmpdefer. jmpdefer is used fairly infrequently now because most
functions have open-coded defers.

The open-coded defer implementation calls gentraceback() with a callback when
looking for the first open-coded defer frame. gentraceback() throws an error if it
is called with a callback on an LR architecture and jmpdefer is on the stack,
because the stack trace can be incorrect in that case - see issue #8153. So, we
want to make sure that we don't have a seg fault in jmpdefer.

Fixes #36050

Change-Id: Ie25e6f015d8eb170b40248dedeb26a37b7f9b38d
Reviewed-on: https://go-review.googlesource.com/c/go/+/210978
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Dan Scales <danscales@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years agonet/http: fix some awkward wording in Request.WithContext docs
Brad Fitzpatrick [Thu, 12 Dec 2019 17:31:11 +0000 (17:31 +0000)]
net/http: fix some awkward wording in Request.WithContext docs

Change-Id: Ib37db42c7f1fd6aa55f70fd2d65d56bb2ae6d26a
Reviewed-on: https://go-review.googlesource.com/c/go/+/211098
Reviewed-by: Bryan C. Mills <bcmills@google.com>
5 years agocmd/go: restore default vet analyzers for targets in GOROOT
Bryan C. Mills [Wed, 11 Dec 2019 17:14:31 +0000 (12:14 -0500)]
cmd/go: restore default vet analyzers for targets in GOROOT

This fixes a regression introduced in CL 209498,
found while investigating #32471.

Also fix $WORK replacement in cmd/go/internal/work.(*Builder).Showcmd
when b.WorkDir includes a backslash and appears in a quoted string.
That fix is needed in order to write a precise test that passes under Windows,
since Windows directories nearly always include backslashes.

Updates #35837

Change-Id: I5fddc5435d5d283a3e598989209d873b59b0a39c
Reviewed-on: https://go-review.googlesource.com/c/go/+/210937
Run-TryBot: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Jay Conrod <jayconrod@google.com>
5 years agocmd/go: allow arguments to 'go test' and 'go vet' to duplicate or override flags...
Bryan C. Mills [Fri, 6 Dec 2019 18:43:23 +0000 (13:43 -0500)]
cmd/go: allow arguments to 'go test' and 'go vet' to duplicate or override flags from GOFLAGS

This is a minimal fix for Go 1.14, but this parsing logic is much too
complex and seems like it will cause more trouble going forward.

I intend to mail a followup change to refactor this logic for 1.15.

Updates #32471

Change-Id: I00ed07dcf3a23c9cd4ffa8cf764921fb5c18bcd6
Reviewed-on: https://go-review.googlesource.com/c/go/+/210940
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: use inUse ranges to map in summary memory only as needed
Michael Anthony Knyszek [Mon, 18 Nov 2019 19:23:39 +0000 (19:23 +0000)]
runtime: use inUse ranges to map in summary memory only as needed

Prior to this change, if the heap was very discontiguous (such as in
TestArenaCollision) it's possible we could map a large amount of memory
as R/W and commit it. We would use only the start and end to track what
should be mapped, and we would extend that mapping as needed to
accomodate a potentially fragmented address space.

After this change, we only map exactly the part of the summary arrays
that we need by using the inUse ranges from the previous change. This
reduces the GCSys footprint of TestArenaCollision from 300 MiB to 18
MiB.

Because summaries are no longer mapped contiguously, this means the
scavenger can no longer iterate directly. This change also updates the
scavenger to borrow ranges out of inUse and iterate over only the
parts of the heap which are actually currently in use. This is both an
optimization and necessary for correctness.

Fixes #35514.

Change-Id: I96bf0c73ed0d2d89a00202ece7b9d089a53bac90
Reviewed-on: https://go-review.googlesource.com/c/go/+/207758
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
5 years agotest: add a test for gccgo compiler bug of missing type descriptor
Cherry Zhang [Wed, 11 Dec 2019 16:44:08 +0000 (11:44 -0500)]
test: add a test for gccgo compiler bug of missing type descriptor

The gccgo compiler did not generate type descriptor for a pointer
to a type alias defined in another package, causing linking error.
The fix is CL 210787. This CL adds a test.

Updates #36085.

Change-Id: I3237c7fedb4d92fb2dc610ee2b88087f96dc2a1a
Reviewed-on: https://go-review.googlesource.com/c/go/+/210858
Run-TryBot: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agoruntime: track ranges of address space which are owned by the heap
Michael Anthony Knyszek [Fri, 15 Nov 2019 23:30:30 +0000 (23:30 +0000)]
runtime: track ranges of address space which are owned by the heap

This change adds a new inUse field to the allocator which tracks ranges
of addresses that are owned by the heap. It is updated on each heap
growth.

These ranges are tracked in an array which is kept sorted. In practice
this array shouldn't exceed its initial allocation except in rare cases
and thus should be small (ideally exactly 1 element in size).

In a hypothetical worst-case scenario wherein we have a 1 TiB heap and 4
MiB arenas (note that the address ranges will never be at a smaller
granularity than an arena, since arenas are always allocated
contiguously), inUse would use at most 4 MiB of memory if the heap
mappings were completely discontiguous (highly unlikely) with an
additional 2 MiB leaked from previous allocations. Furthermore, the
copies that are done to keep the inUse array sorted will copy at most 4
MiB of memory in such a scenario, which, assuming a conservative copying
rate of 5 GiB/s, amounts to about 800µs.

However, note that in practice:
1) Most 64-bit platforms have 64 MiB arenas.
2) The copies should incur little-to-no page faults, meaning a copy rate
   closer to 25-50 GiB/s is expected.
3) Go heaps are almost always mostly contiguous.

Updates #35514.

Change-Id: I3ad07f1c2b5b9340acf59ecc3b9ae09e884814fe
Reviewed-on: https://go-review.googlesource.com/c/go/+/207757
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Austin Clements <austin@google.com>
5 years agonet/http: use cancellation instead of a timeout in TestTransportProxyHTTPSConnectTimeout
Bryan C. Mills [Wed, 11 Dec 2019 14:35:31 +0000 (09:35 -0500)]
net/http: use cancellation instead of a timeout in TestTransportProxyHTTPSConnectTimeout

The use of a timeout in this test caused it to be flaky: if the
timeout occurred before the connection was attempted, then the Accept
call on the Listener could hang indefinitely, and its goroutine would
not exit until that Listener was closed. That caused the test to fail.

A longer timeout would make the test less flaky, but it would become
even slower and would still be sensitive to timing.

Instead, replace the timeout with an explicit Context cancellation
after the CONNECT request has been read. That not only ensures that
the cancellation occurs at the appropriate point, but also makes the
test much faster: a test run with -count=1000 now executes in less
than 2s on my machine, whereas before it took upwards of 50s.

Fixes #36082
Updates #28012

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

5 years agoruntime: syscall_forkx on Solaris can return error on success
Andrew Stormont [Wed, 11 Dec 2019 00:31:44 +0000 (00:31 +0000)]
runtime: syscall_forkx on Solaris can return error on success

The syscall_forkx function returns the value of errno even on success.  This can be a problem when using cgo where an atfork handler might be registered; if the atfork handler does something which causes errno to be set the caller of syscall_forkx can be misled into thinking the fork has failed.  This causes the various exec functions in the runtime package to hang.

Change-Id: Ia1842179226078a0cbbea33d541aa1187dc47f68
GitHub-Last-Rev: 4dc4db75c82a826da9a50c323b7e3ddfe46ed6c0
GitHub-Pull-Request: golang/go#36076
Reviewed-on: https://go-review.googlesource.com/c/go/+/210742
Reviewed-by: Ian Lance Taylor <iant@golang.org>