1
0
mirror of https://github.com/golang/go synced 2024-11-17 07:14:45 -07:00
Commit Graph

42227 Commits

Author SHA1 Message Date
Bryan C. Mills
a15b5d3092 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>
2019-12-11 22:01:13 +00:00
Michael Anthony Knyszek
1b1fbb3192 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>
2019-12-11 19:51:34 +00:00
Cherry Zhang
6f2b8347b1 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>
2019-12-11 19:48:39 +00:00
Michael Anthony Knyszek
9d78e75a0a 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>
2019-12-11 19:37:19 +00:00
Bryan C. Mills
ef3ef8fcdf 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>
2019-12-11 15:43:50 +00:00
Andrew Stormont
a1a67e6312 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: 4dc4db75c8
GitHub-Pull-Request: golang/go#36076
Reviewed-on: https://go-review.googlesource.com/c/go/+/210742
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-12-11 01:10:28 +00:00
Dmitri Shuralyov
9641acd653 doc: remove Release History pages (moved to x/website)
These pages were moved to the x/website repo in CL 210797 (commit
golang/website@9aef1eefbb).
Remove the old copies in this repo since they're no longer used.

Updates #36075
Updates #29206

Change-Id: I6e3ffaebd92fa753cb5f3b21e4238edfb7f5f0e8
Reviewed-on: https://go-review.googlesource.com/c/go/+/210798
Reviewed-by: Alexander Rakoczy <alex@golang.org>
2019-12-11 00:32:53 +00:00
Lorenz Bauer
9c8c27a318 syscall: use SOCK_CLOEXEC when creating sockets
LsfSocket, SetLsfPromisc and NetlinkRIB currently don't force the CLOEXEC
flag on the sockets they create. While the former two functions are
deprecated, NetlinkRIB is called by various functions related to
net.Interface.

Add a helper to create CLOEXEC sockets, and use it from SetLsfPromisc and
NetlinkRIB. LsfSocket is unchanged since we don't want to break callers.

Fixes #36053

Change-Id: I72fe2b167996797698d8a44b0d28165045c42d3c
Reviewed-on: https://go-review.googlesource.com/c/go/+/210517
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-12-11 00:01:17 +00:00
Tobias Klauser
84540f0b0a cmd/compile/internal/logopt: gofmt
Change-Id: Ie9d29645e7702104202ee1f338babdd9e33e1e58
Reviewed-on: https://go-review.googlesource.com/c/go/+/210679
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-12-10 21:31:00 +00:00
vovapi
207a0b7933 testing: use conventional comments for exported internal funcs & structs
Change-Id: I2dd5ddc22bfff143b81d5945992d8c5fccf387f4
GitHub-Last-Rev: aa637756e7
GitHub-Pull-Request: golang/go#36054
Reviewed-on: https://go-review.googlesource.com/c/go/+/210497
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-12-10 21:11:20 +00:00
Tobias Klauser
5e35845a4a runtime: use MRS instruction to read system registers on freebsd/arm64
Support for these was added in CL 189577

Change-Id: Iaf2a774b141995cbbdfb3888aea67ae9c7f928b1
Reviewed-on: https://go-review.googlesource.com/c/go/+/210677
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-12-10 21:10:17 +00:00
Bryan C. Mills
931fe39400 net/http: await state traces earlier in TestServerConnState
This approach attempts to ensure that the log for each connection is
complete before the next sequence of states begins.

Updates #32329

Change-Id: I25150d3ceab6568af56a40d2b14b5f544dc87f61
Reviewed-on: https://go-review.googlesource.com/c/go/+/210717
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-12-10 18:44:22 +00:00
Brad Fitzpatrick
ecde0bfa1f net/http: fix timeout race in Transport proxy CONNECT
Fixes #36070

Change-Id: I99742aa153202436d802634c9e019a14b9ef9185
Reviewed-on: https://go-review.googlesource.com/c/go/+/210738
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2019-12-10 18:30:47 +00:00
Daniel Martí
41348081fa all: fix a number of misuses of the word "an"
After golang.org/cl/210124, I wondered if the same error had gone
unnoticed elsewhere. I quickly spotted another dozen mistakes after
reading through the output of:

	git grep '\<[Aa]n [bcdfgjklmnpqrtvwyz][a-z]'

Many results are false positives for acronyms like "an mtime", since
it's pronounced "an em-time". However, the total amount of output isn't
that large given how simple the grep pattern is.

Change-Id: Iaa2ca69e42f4587a9e3137d6c5ed758887906ca6
Reviewed-on: https://go-review.googlesource.com/c/go/+/210678
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Zach Jones <zachj1@gmail.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-12-10 16:23:10 +00:00
Jay Conrod
3a3093d5c7 cmd/go: document 'go env GOMOD' outside modules
In documentation for 'go env GOMOD', note that the path will be
os.DevNull in module-aware mode when no go.mod file is present.

Fixes #36052

Change-Id: I30ced1df02ccefe1970bd856190e79d6f0384375
Reviewed-on: https://go-review.googlesource.com/c/go/+/210577
Run-TryBot: Jay Conrod <jayconrod@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2019-12-09 21:50:59 +00:00
Than McIntosh
7d24e9581a cmd/link: fix imports problem in elf_test.go
Fix an imports problem in this test (doesn't compile).

Updates #35779

Change-Id: Icaeec0384bf2e75696e43d9410df7219f0245940
Reviewed-on: https://go-review.googlesource.com/c/go/+/210578
Run-TryBot: Than McIntosh <thanm@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-12-09 20:19:32 +00:00
Meng Zhuo
ffa5c85c92 cmd/link: fix loadelf failed on MIPS family
The relocation of MIPS64 family ELF is different with other architecure according
to the document from Linux-MIPS

https://www.linux-mips.org/pub/linux/mips/doc/ABI/elf64-2.4.pdf

In "2.9 Relocation" it shows relocation section contains five parts:

1. r_sym Elf64_Word Symbol index
2. r_ssym Elf64_Byte Special symbol
3. r_type3 Elf64_Byte Relocation type
4. r_type2 Elf64_Byte Relocation type
5. r_type Elf64_Byte Relocation type

This CL makes loadelf aware the difference.

Update #35779

Change-Id: Ib221665641972b1c2bfea5a496e3118e5dc0bc45
Reviewed-on: https://go-review.googlesource.com/c/go/+/209317
Run-TryBot: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2019-12-09 18:22:59 +00:00
Clément Chigot
a3a630b0d2 runtime: use mprotect in sysMap for aix/ppc64
AIX doesn't allow to mmap an already mmap address. The previous way to
deal with this behavior was to munmap before calling mmap again.
However, mprotect syscall is able to change protections on a memory
range. Thus, memory mapped by sysReserve can be remap using it. Note
that sysMap is always called with a non-nil pointer so mprotect is
always possible.

Updates: #35451

Change-Id: I1fd1e1363d9ed9eb5a8aa7c8242549bd6dad8cd0
Reviewed-on: https://go-review.googlesource.com/c/go/+/207237
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2019-12-09 16:41:15 +00:00
Brad Fitzpatrick
590052ba29 net/http: don't wait indefinitely in Transport for proxy CONNECT response
Fixes #28012

Change-Id: I711ebaabf63194e3d2c608d829da49c51a294d74
Reviewed-on: https://go-review.googlesource.com/c/go/+/210286
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-12-09 15:46:57 +00:00
Muhammad Falak R Wani
d542b13134 runtime/race: correct typo s/is/in
Change-Id: Ic79d97c2aa107c0e5c4a8906ad757b0390228bef
Reviewed-on: https://go-review.googlesource.com/c/go/+/210417
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-12-09 15:44:40 +00:00
Mark Pulford
9d4717d5f1 runtime: suggest more kernel options for mlock failure
Some Linux distributions will continue to provide 5.3.x kernels for a
while rather than 5.4.x.

Updates #35777

Change-Id: I493ef8338d94475f4fb1402ffb9040152832b0fd
Reviewed-on: https://go-review.googlesource.com/c/go/+/210299
Reviewed-by: Austin Clements <austin@google.com>
2019-12-09 15:40:12 +00:00
Jay Conrod
f6774bc91b cmd/go: clarify -dropreplace help text in 'go help mod edit'
Fixes #34930

Change-Id: Ie0ddd8de6e40f5a192c4d2267399126e449fe5f5
Reviewed-on: https://go-review.googlesource.com/c/go/+/210340
Run-TryBot: Jay Conrod <jayconrod@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2019-12-09 15:12:29 +00:00
Austin Clements
1c8d1f45ba runtime: mlock top of signal stack on both amd64 and 386
CL 209899 worked around an issue that corrupts vector registers in
recent versions of the Linux kernel by mlocking the top page of every
signal stack on amd64. However, the underlying issue also affects the
XMM registers on 386. This CL applies the mlock fix to both amd64 and
386.

Fixes #35777 (again).

Change-Id: I9886f2dc4c23625421296bd5518d5fd3288bfe48
Reviewed-on: https://go-review.googlesource.com/c/go/+/210345
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-12-09 14:41:00 +00:00
Daniel Martí
daaab44f31 go/ast: fix a few incorrect "an" articles
slice, type, and select should all go with "a", not "an", since they all
start with consonant sounds.

Change-Id: I57e96dcbdc571dc21e24096779f2f756ec81103e
Reviewed-on: https://go-review.googlesource.com/c/go/+/210124
Reviewed-by: Robert Griesemer <gri@golang.org>
2019-12-09 02:02:17 +00:00
Alberto Donizetti
da4d58587e doc: add missing p in install from source page
The last paragraph in golang.org/doc/install/source#fetch is missing a
p tag, so it doesn't get formatted with the 'max-width: 50rem' like
all the other text in the page.

Add it.

Change-Id: I1a981dd2afde561b4ab21bd90ad99b3a146111f6
Reviewed-on: https://go-review.googlesource.com/c/go/+/210122
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-12-07 15:57:30 +00:00
Emmanuel T Odeke
bff4ebb7aa net/http: unflake TestTimeoutHandlerSuperfluousLogs
Uses 2 channels to synchronize that test, because
relying on sleeps creates flaky behavior, thus:

a) 1 buffered channel to send back the last spurious line
without having to reason about "happens before" behavior
a) 1 buffered channel at the end of the handler; it'll
be controlled by whether we expect to timeout or not,
but will always be closed when the test ends

Fixes #35051

Change-Id: Iff735aa8d1ed9de8d92b792374ec161cc0a72798
Reviewed-on: https://go-review.googlesource.com/c/go/+/208477
Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2019-12-07 00:46:38 +00:00
Alex Harford
33d20760a2 crypto/tls: fix a typo in TLS handshake comment
Fix a minor typo in the TLS handshake comment.

Change-Id: I0fd243e5440f6c77c97e844e6669a7974a2c8798
GitHub-Last-Rev: 21e91a1a48
GitHub-Pull-Request: golang/go#36030
Reviewed-on: https://go-review.googlesource.com/c/go/+/210289
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-12-06 23:53:46 +00:00
Bryan C. Mills
ea89ce1ea2 cmd/go/internal/modcmd: loosen path validation in "go mod edit"
Replaced modules require only valid import paths, not full
module paths that can be fetched with 'go get'.

The 'go' command does not in general reject manually-edited go.mod
files with these paths, so 'go mod edit' should not reject them
either.

Fixes #30513

Change-Id: I4f1a5c65937f91d41478f8d218c8018e0c70f320
Reviewed-on: https://go-review.googlesource.com/c/go/+/210343
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2019-12-06 23:45:07 +00:00
Bryan C. Mills
94ddb2d621 cmd/go/internal/modload: revert duplicate path suppression in modload.ImportMissingError
CL 210338 suppressed duplication for import paths mentioned in an
ImportMissingError.

Unfortunately, that broke one of the cases in
cmd/go/internal/modload.TestImport, and the new error message is still
kind of awkward anyway.

Let's revert that part of the change — we can try again with more
coverage for that case.

Updates #35986

Change-Id: Ib0858aec4f89a7231e32c35ec876da80d80f2098
Reviewed-on: https://go-review.googlesource.com/c/go/+/210342
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2019-12-06 23:44:51 +00:00
Bryan C. Mills
76d2f6cc62 cmd/go: include cfg.BuildModReason in 'import lookup disabled' errors
This location was missed in CL 204521.

Updates #33326
Updates #33848

Change-Id: I0ece6d9b37548d8abb54f79c69be5548a0428c76
Reviewed-on: https://go-review.googlesource.com/c/go/+/210341
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2019-12-06 23:44:28 +00:00
Cherry Zhang
df0ac45002 cmd/link: skip gaps between PT_LOAD segments in TestPIESize
There may be gaps between non-writeable and writeable PT_LOAD
segments, and the gaps may be large as the segments may have
large alignment. Don't count those gaps in file size comparison.

Fixes #36023.

Change-Id: I68582bdd0f385ac5c6f87d485d476d06bc96db19
Reviewed-on: https://go-review.googlesource.com/c/go/+/210180
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-12-06 23:12:11 +00:00
Bryan C. Mills
1de31310d9 cmd/go: avoid generating "malformed module path" errors for standard-library paths
If the path looks like it belongs in GOROOT/src and isn't there, we
should mention that in the error message — instead of the fact
that the path is not a valid module path, which the user likely
already knows.

Fixes #34769
Fixes #35734

Change-Id: I3589336d102e420a5ad3bf246816e29f3cbe6d71
Reviewed-on: https://go-review.googlesource.com/c/go/+/210339
Run-TryBot: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Jay Conrod <jayconrod@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-12-06 20:31:18 +00:00
po3rin
bf865823ba strings: fix nonexistent path in comment
There is a part in the comment that points to a non-existent file.
It seems to have been overlooked in following PR.
https://go-review.googlesource.com/c/go/+/98518/

Change-Id: I21dbfbd270c654d5cd7fa88d114a356862612d90
Reviewed-on: https://go-review.googlesource.com/c/go/+/210298
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-12-06 20:12:47 +00:00
Jay Conrod
b2a5893f44 cmd/go: reduce redundancy in direct mode lookup error messages
get.RepoRootForImportPath now returns errors that satisfy
load.ImportPathError in cases where the import path appears in the
messages. (The import path probably should appear in all errors from
this function, but this CL does not change these errors).

Changed modfetch.notExistError to be a wrapper (with an Unwrap method)
instead of a string. This means errors.As works with notFoundError and
ImportPathError.

ImportMissingError no longer prints the package path if it wraps an
ImportPathError.

TestMissingImportErrorRepetition no longer counts the package path
within a URL (like https://...?go-get=1).

Fixes #35986

Change-Id: I38f795191c46d04b542c553e705f23822260c790
Reviewed-on: https://go-review.googlesource.com/c/go/+/210338
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2019-12-06 19:49:21 +00:00
Brad Fitzpatrick
a6c8fac781 os: skip a new failing test on Windows
This test was recently added in CL 209961.

Apparently Windows can't seek a directory filehandle?

And move the test from test/fixedbugs (which is mostly for compiler bugs) to
an os package test.

Updates #36019

Change-Id: I626b69b0294471014901d0ccfeefe5e2c7651788
Reviewed-on: https://go-review.googlesource.com/c/go/+/210283
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2019-12-06 18:04:42 +00:00
Austin Clements
69614c0d0e runtime: give useful failure message on mlock failure
Currently, we're ignoring failures to mlock signal stacks in the
workaround for #35777. This means if your mlock limit is low, you'll
instead get random memory corruption, which seems like the wrong
trade-off.

This CL checks for mlock failures and panics with useful guidance.

Updates #35777.

Change-Id: I15f02d3a1fceade79f6ca717500ca5b86d5bd570
Reviewed-on: https://go-review.googlesource.com/c/go/+/210098
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-12-06 15:19:52 +00:00
Ian Lance Taylor
0915a19a11 sync: deflake TestWaitGroupMisuse3
If one of the helper goroutine panics, the main goroutine call to Wait
may hang forever waiting for something to call Done. Put that call in
a goroutine like the others.

Fixes #35774

Change-Id: I8d2b58d8f473644a49a95338f70111d4e6ed4e12
Reviewed-on: https://go-review.googlesource.com/c/go/+/210218
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2019-12-06 05:12:15 +00:00
Alex Brainman
6ef7794b24 all: fix most of the remaining windows -d=checkptr violations
This change replaces

buf := [HUGE_CONST]*T)(unsafe.Pointer(p))[:]

with

buf := [HUGE_CONST]*T)(unsafe.Pointer(p))[:n:n]

Pointer p points to n of T elements. New unsafe pointer conversion
logic verifies that both first and last elements point into the same
Go variable.

This change replaces [:] with [:n:n] to please pointer checker.
According to @mdempsky, compiler specially recognizes when you
combine a pointer conversion with a full slice operation in a single
expression and makes an exception.

After this, only one failure in net remains when running:

go test -a -short -gcflags=all=-d=checkptr std cmd

Updates #34972

Change-Id: I2c8731650c856264bc788e4e07fa0530f7c250fa
Reviewed-on: https://go-review.googlesource.com/c/go/+/208617
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2019-12-06 05:10:34 +00:00
Robert Griesemer
b81e01dc2e go/types: print package path in error messages if package name is not unique
Change package qualification to print the full package path for packages
that have non-unique names (that is, where multiple different packages
have the same name). Use the package name as qualifier in all other cases
(but don't print any qualification if we're talking about the package
being type-checked).

This matches the behavior of the compiler.

Fixes #35895.

Change-Id: I33ab8e7adfae1378907c01e33cabda114f65887f
Reviewed-on: https://go-review.googlesource.com/c/go/+/209578
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-12-06 03:52:48 +00:00
Tobias Klauser
5fd7581006 cmd/go: fix check for -Wp,-U in cgo CFLAGS
There should be no space after comma.

Change-Id: I6a5c85a386d9d1611b71d5b15a31a00c24c316b4
Reviewed-on: https://go-review.googlesource.com/c/go/+/210120
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-12-06 03:14:41 +00:00
Ian Lance Taylor
d2dec04056 runtime: add Gosched to TestSelectStackAdjust loop
Give the runtime more of a chance to do other work in a tight loop.

Fixes #34693

Change-Id: I8df6173d2c93ecaccecf4520a6913b495787df78
Reviewed-on: https://go-review.googlesource.com/c/go/+/210217
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-12-06 03:07:20 +00:00
Cherry Zhang
a037582eff cmd/compile: mark empty block preemptible
Currently, a block's control instruction gets the liveness info
of the last Value in the block. However, for an empty block, the
control instruction gets the invalid liveness info and therefore
not preemptible. One example is empty infinite loop, which has
only a control instruction. The control instruction being non-
preemptible makes the whole loop non-preemptible.

Fix this by using a different, preemptible liveness info for
empty block's control. We can choose an arbitrary preemptible
liveness info, as at run time we don't really use the liveness
map at that instruction.

As before, if the last Value in the block is non-preemptible, so
is the block control. For example, the conditional branch in the
write barrier test block is still non-preemptible.

Also, only update liveness info if we are actually emitting
instructions. So zero-width Values' liveness info (which are
always invalid) won't affect the block control's liveness info.
For example, if the last Values in a block is a tuple-generating
operation and a Select, the block control instruction is still
preemptible.

Fixes #35923.

Change-Id: Ic5225f3254b07e4955f7905329b544515907642b
Reviewed-on: https://go-review.googlesource.com/c/go/+/209659
Run-TryBot: Cherry Zhang <cherryyz@google.com>
Reviewed-by: David Chase <drchase@google.com>
2019-12-06 01:11:02 +00:00
Cherry Zhang
7673884a7f cmd/compile: don't fuse branches with side effects
Count Values with side effects but no use as live, and don't fuse
branches that contain such Values. (This can happen e.g. when it
is followed by an infinite loop.) Otherwise this may lead to
miscompilation (side effect fired at wrong condition) or ICE (two
stores live simultaneously).

Fixes #36005.

Change-Id: If202eae4b37cb7f0311d6ca120ffa46609925157
Reviewed-on: https://go-review.googlesource.com/c/go/+/210179
Reviewed-by: Keith Randall <khr@golang.org>
2019-12-06 00:57:11 +00:00
Tobias Klauser
eeb319a5a5 doc/go1.14: document freebsd/arm64 port
Updates #24715

Change-Id: Ie6421cf2d599740bbb0576bcc37bd8ddf5af3961
Reviewed-on: https://go-review.googlesource.com/c/go/+/210119
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-12-05 22:16:02 +00:00
Rhys Hiltner
e751af1aba cmd/go: print newline after GOOS/GOARCH error
The newline was dropped during the refactor in CL 194617.

Fixes #35984

Change-Id: I7e0d7aa2d7a4d1f44898921f8bb40401620d78b2
Reviewed-on: https://go-review.googlesource.com/c/go/+/209965
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-12-05 22:08:26 +00:00
Jay Conrod
993ec7f6cd cmd/go: include imports in 'go list -e' output even after parse errors
If we aren't able to load imports from one file in a package due to a
parse error (scanner.ErrorList), 'go list -e' should still list
imports in other files.

Fixes #35973

Change-Id: I59f171877949bb7afaf252b6c8a970de22e60c7a
Reviewed-on: https://go-review.googlesource.com/c/go/+/210097
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2019-12-05 21:42:53 +00:00
Keith Randall
e3c7ffcd95 os: reset dirinfo when seeking on Darwin
The first Readdirnames calls opendir and caches the result.
The behavior of that cached opendir result isn't specified on a seek
of the underlying fd. Free the opendir result on a seek so that
we'll allocate a new one the next time around.

Also fix wasm behavior in this regard, so that a seek to the
file start resets the Readdirnames position, regardless of platform.

p.s. I hate the Readdirnames API.

Fixes #35767.

Change-Id: Ieffb61b3c5cdd42591f69ab13f932003966f2297
Reviewed-on: https://go-review.googlesource.com/c/go/+/209961
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-12-05 20:40:38 +00:00
Jay Conrod
d72dce8783 cmd/go: test that 'go list -e -mod=readonly' reports errors correctly
This issue was fixed by earlier improvements to error handling when
loading modules.

Fixes #34829

Change-Id: I4cf4e182a7381f8b5c359179d90bd02491ea7911
Reviewed-on: https://go-review.googlesource.com/c/go/+/209037
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2019-12-05 20:14:44 +00:00
Dmitri Shuralyov
a253b38de3 doc: add CherryPickApproved filter to Release History links
Not all closed issues in a given minor milestone are included in that
release, only the ones that have been labeled as CherryPickApproved are.

Update the links to the GitHub issue tracker to include a filter on the
CherryPickApproved label, so that the default view shows only the
backports that were included in a given release. This should more useful
to most people than seeing all backports (considered and approved).

Do this only for Go 1.9.1 and newer releases, as that is when we started
using the CherryPickCandidate and CherryPickApproved labels.

Fixes #35988

Change-Id: I51e07c1bc3ab9c4a5744e8f668c5470adf78bffe
Reviewed-on: https://go-review.googlesource.com/c/go/+/209918
Reviewed-by: Alexander Rakoczy <alex@golang.org>
2019-12-05 19:53:44 +00:00
Meng Zhuo
50535e6b42 cmd/go: delete TestGetFileURL temporary file
Change-Id: I191ac2a2b469c6179d22d66c15f2d96ecb3d0902
Reviewed-on: https://go-review.googlesource.com/c/go/+/209970
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-12-05 17:23:50 +00:00