]> Cypherpunks.ru repositories - gostls13.git/log
gostls13.git
5 years agolib/time: update tzdata to 2018i
Ian Lance Taylor [Mon, 7 Jan 2019 19:54:35 +0000 (11:54 -0800)]
lib/time: update tzdata to 2018i

Updates #22487

Change-Id: Iab4874ddef8e47eb99cd03e1c40af8372cce65c6
Reviewed-on: https://go-review.googlesource.com/c/156637
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years agomath: fix ternary correction statement in Log1p
Brian Kessler [Thu, 3 Jan 2019 17:00:49 +0000 (10:00 -0700)]
math: fix ternary correction statement in Log1p

The original port of Log1p incorrectly translated a ternary statement
so that a correction was only applied to one of the branches.

Fixes #29488

Change-Id: I035b2fc741f76fe7c0154c63da6e298b575e08a4
Reviewed-on: https://go-review.googlesource.com/c/156120
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Katie Hockman <katie@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
5 years agocrypto/md5: fix casting of d.nx in UnmarshalBinary
Jason LeBrun [Fri, 4 Jan 2019 01:41:06 +0000 (01:41 +0000)]
crypto/md5: fix casting of d.nx in UnmarshalBinary

Fixes #29545

Change-Id: Ida98c23b8fc5c676d8bf0b3daad8320e495ebf64
GitHub-Last-Rev: d38e8a90c75f92031f6a8cf1f69f7bc7c28a52d8
GitHub-Pull-Request: golang/go#29546
Reviewed-on: https://go-review.googlesource.com/c/156297
Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years agocrypto/sha1: fix casting of d.nx in UnmarshalBinary
Jason LeBrun [Fri, 4 Jan 2019 01:30:15 +0000 (01:30 +0000)]
crypto/sha1: fix casting of d.nx in UnmarshalBinary

Fixes #29543

Change-Id: Ib7f3c32cc1e57c583ee52c486673a5b9568c2df8
GitHub-Last-Rev: 0cb3dc536245bb4f414cf09bb353fbafd5ca7537
GitHub-Pull-Request: golang/go#29544
Reviewed-on: https://go-review.googlesource.com/c/156279
Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years agocmd/go: deflake TestScript/gcflags_patterns
Jay Conrod [Fri, 4 Jan 2019 22:30:36 +0000 (17:30 -0500)]
cmd/go: deflake TestScript/gcflags_patterns

The check below can fail incorrectly if the buildid ends with '-p'.

    ! stderr 'compile.* -e .*-p [^z]'

This fix changes regular expressions to '-e.* -p' or '-N.* -p' instead
of '-e .*-p'. '-l' is no longer used because the compiler accepts
multiple flags starting with '-l' ('-e' and '-N' do not have this
problem), so there could be false matches.

Change-Id: I827c411de28624019a287f853acc9666e87cbfb9
Reviewed-on: https://go-review.googlesource.com/c/156327
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agodoc: remove incorrect space in %T and %v output examples
Gabriel Aszalos [Mon, 7 Jan 2019 08:48:39 +0000 (09:48 +0100)]
doc: remove incorrect space in %T and %v output examples

Change-Id: I321890237f703b945711e59c15233ccf59c4f190
Reviewed-on: https://go-review.googlesource.com/c/156477
Run-TryBot: Gabriel Aszalos <gabriel.aszalos@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agoarchive/zip: fix casting overflow on 32-bit arch
LE Manh Cuong [Sat, 5 Jan 2019 16:39:24 +0000 (23:39 +0700)]
archive/zip: fix casting overflow on 32-bit arch

Fixes #29555

Change-Id: Ia3c0dd65bcf94dea3f6e04c23c1fe5d6d0b2c1e9
Reviewed-on: https://go-review.googlesource.com/c/156399
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years agocmd: vendor x/sys/unix into the stdlib
Keith Randall [Sun, 6 Jan 2019 19:33:23 +0000 (11:33 -0800)]
cmd: vendor x/sys/unix into the stdlib

upstream git hash: 1775db3f06b568179d273425900dd09125831dd5

Update #17490

Change-Id: I95e3c57137756c5c7a9b7334075caef66f205231
Reviewed-on: https://go-review.googlesource.com/c/156365
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agocmd/vendor: update to golang.org/x/tools@3ef68632
Daniel Martí [Sun, 6 Jan 2019 17:19:35 +0000 (18:19 +0100)]
cmd/vendor: update to golang.org/x/tools@3ef68632

Mainly to pull in the bug fix in the structtag pass, where filenames
could sometimes be wrong. The bug wasn't present in 1.11, so it was a
regression and needs fixing before 1.12 is out.

Fixes #29130.

Change-Id: Ie9d9bff84873f34d748ebd8f056b6bc2ac822a55
Reviewed-on: https://go-review.googlesource.com/c/156378
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
5 years agocrypto/x509: ignore harmless edge case in TestSystemRoots
Filippo Valsorda [Sat, 5 Jan 2019 00:27:08 +0000 (19:27 -0500)]
crypto/x509: ignore harmless edge case in TestSystemRoots

The no-cgo validation hack lets in certificates from the root store that
are not marked as roots themselves, but are signed by a root; the cgo
path correctly excludes them. When TestSystemRoots compares cgo and
no-cgo results it tries to ignore them by ignoring certificates which
pass validation, but expired certificates were failing validation.

Letting through expired certs is harmless anyway because we will refuse
to build chains to them.

Fixes #29497

Change-Id: I341e50c0f3426de2763468672f9ba1d13ad6cfba
Reviewed-on: https://go-review.googlesource.com/c/156330
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agocrypto/x509: ignore 5 phantom 1024-bit roots in TestSystemRoots
Filippo Valsorda [Sat, 5 Jan 2019 00:09:01 +0000 (19:09 -0500)]
crypto/x509: ignore 5 phantom 1024-bit roots in TestSystemRoots

On macOS 10.11, but not 10.10 and 10.12, the C API returns 5 old root
CAs which are not in SystemRootCertificates.keychain (but seem to be in
X509Anchors and maybe SystemCACertificates.keychain, along with many
others that the C API does not return). They all are moribund 1024-bit
roots which are now gone from the Apple store.

Since we can't seem to find a way to make the no-cgo code see them,
ignore them rather than skipping the test.

Fixes #21416

Change-Id: I24ff0461f71cec953b888a60b05b99bc37dad2ed
Reviewed-on: https://go-review.googlesource.com/c/156329
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agocmd/compile: modify swt.go to skip repeated walks of switch
David Chase [Fri, 4 Jan 2019 16:43:23 +0000 (11:43 -0500)]
cmd/compile: modify swt.go to skip repeated walks of switch

The compiler appears to contain several squirrelly corner
cases where nodes are double walked, some where new nodes
are created from walked parts.  Rather than trust that we
had searched hard enough for the last one, change
exprSwitch.walk() to return immediately if it has already
been walked.  This appears to be the only case where
double-walking a node is actually harmful.

Fixes #29562.

Change-Id: I0667e8769aba4c3236666cd836a934e256c0bfc5
Reviewed-on: https://go-review.googlesource.com/c/156317
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
5 years agodoc/go1.12: remove known issue note
Filippo Valsorda [Fri, 4 Jan 2019 18:04:31 +0000 (13:04 -0500)]
doc/go1.12: remove known issue note

A workaround has been submitted.

Updates #27993

Change-Id: Ife6443c32673b38000b90dd2efb2985db37ab773
Reviewed-on: https://go-review.googlesource.com/c/156318
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agoCONTRIBUTORS: first round of automated updates for Go 1.12
Dmitri Shuralyov [Fri, 4 Jan 2019 00:44:55 +0000 (19:44 -0500)]
CONTRIBUTORS: first round of automated updates for Go 1.12

These updates have been automatically generated using a modified
version of the updateac command with the following changes:

- code to automatically update the AUTHORS file has been removed,
since we're not updating that file automatically after Go 1.11
(see CL 128877)
- CLA checking code has been removed, since it was primarily needed
for updating the AUTHORS file
- instead of executing the misc/sortac binary, its code was embedded
into the updateac command itself

The modified updateac command will be added to x/build repository soon,
and the misc/sortac command can be removed afterwards.

Updates #12042

Change-Id: Ibf73068698b14b1aad4df4490747b488508ff5fd
Reviewed-on: https://go-review.googlesource.com/c/156278
Reviewed-by: Filippo Valsorda <filippo@golang.org>
5 years agodoc/go1.12: document RSA-PSS support in crypto/tls
Filippo Valsorda [Fri, 21 Dec 2018 21:57:42 +0000 (16:57 -0500)]
doc/go1.12: document RSA-PSS support in crypto/tls

Change-Id: I9350e5a72e3c375f6b76897708f09f1f50c7be14
Reviewed-on: https://go-review.googlesource.com/c/155482
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agodoc/go1.12: mention Conn.SetDeadline improvements, GODEBUG=madvdontneed=1
Brad Fitzpatrick [Wed, 2 Jan 2019 18:22:42 +0000 (18:22 +0000)]
doc/go1.12: mention Conn.SetDeadline improvements, GODEBUG=madvdontneed=1

Fixes #29439
Updates #28466

Change-Id: Ifa0779a089a969f99f1a47127e23565f31eec24f
Reviewed-on: https://go-review.googlesource.com/c/155929
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
5 years agocrypto/sha512: fix casting of d.nx in UnmarshalBinary
Jason LeBrun [Fri, 4 Jan 2019 00:21:15 +0000 (00:21 +0000)]
crypto/sha512: fix casting of d.nx in UnmarshalBinary

Fixes #29541

Change-Id: I006915b020b6e710298c32c05e3de77a7f9b54f3
GitHub-Last-Rev: c7a90a4bbe17fd1904c0942e8b343264fb85cba1
GitHub-Pull-Request: golang/go#29542
Reviewed-on: https://go-review.googlesource.com/c/156277
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agoruntime: skip writes to persistent memory in cgo checker
Ian Lance Taylor [Sat, 22 Dec 2018 00:06:54 +0000 (16:06 -0800)]
runtime: skip writes to persistent memory in cgo checker

Fixes #23899
Fixes #28458

Change-Id: Ie177f2d4c399445d8d5e1a327f2419c7866cb45e
Reviewed-on: https://go-review.googlesource.com/c/155697
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
5 years agoruntime: work around "P has cached GC work" failures
Austin Clements [Thu, 3 Jan 2019 19:48:30 +0000 (14:48 -0500)]
runtime: work around "P has cached GC work" failures

We still don't understand what's causing there to be remaining GC work
when we enter mark termination, but in order to move forward on this
issue, this CL implements a work-around for the problem.

If debugCachedWork is false, this CL does a second check for remaining
GC work as soon as it stops the world for mark termination. If it
finds any work, it starts the world again and re-enters concurrent
mark. This will increase STW time by a small amount proportional to
GOMAXPROCS, but fixes a serious correctness issue.

This works-around #27993.

Change-Id: Ia23b85dd6c792ee8d623428bd1a3115631e387b8
Reviewed-on: https://go-review.googlesource.com/c/156140
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Rick Hudson <rlh@golang.org>
5 years agocmd/go: fix failure in TestScript/build_runtime_gcflags
Jay Conrod [Thu, 3 Jan 2019 23:33:36 +0000 (18:33 -0500)]
cmd/go: fix failure in TestScript/build_runtime_gcflags

This test case failed on the longtest builder. It relied on
runtime/internal/atomic not being compiled with the -l flag in the
cache. The test case now creates its own GOCACHE, similar to
build_cache_compile and a few others.

Also, mention the correct issue the test case verifies.

Fixes #29395

Change-Id: Id50e9dfc50db03fb11582d3dd6b69c3e1ed750eb
Reviewed-on: https://go-review.googlesource.com/c/156237
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agoruntime: proper panic tracebacks with mid-stack inlining
Keith Randall [Mon, 10 Dec 2018 20:49:19 +0000 (12:49 -0800)]
runtime: proper panic tracebacks with mid-stack inlining

As a followon to CL 152537, modify the panic-printing traceback
to also handle mid-stack inlining correctly.

Also declare -fm functions (aka method functions) as wrappers, so that
they get elided during traceback. This fixes part 2 of #26839.

Fixes #28640
Fixes #24488
Update #26839

Change-Id: I1c535a9b87a9a1ea699621be1e6526877b696c21
Reviewed-on: https://go-review.googlesource.com/c/153477
Reviewed-by: David Chase <drchase@google.com>
5 years agoruntime: don't scan go'd function args past length of ptr bitmap
Keith Randall [Thu, 3 Jan 2019 20:13:53 +0000 (12:13 -0800)]
runtime: don't scan go'd function args past length of ptr bitmap

Use the length of the bitmap to decide how much to pass to the
write barrier, not the total length of the arguments.

The test needs enough arguments so that two distinct bitmaps
get interpreted as a single longer bitmap.

Update #29362

Change-Id: I78f3f7f9ec89c2ad4678f0c52d3d3def9cac8e72
Reviewed-on: https://go-review.googlesource.com/c/156123
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
5 years agocrypto/sha256: fix casting of d.nx in UnmarshalBinary
Jason LeBrun [Thu, 3 Jan 2019 21:06:29 +0000 (21:06 +0000)]
crypto/sha256: fix casting of d.nx in UnmarshalBinary

Fixes #29517

Change-Id: I7e741d82bb9f8e6ab39b6d9ab37ba6163176a097
GitHub-Last-Rev: 764d0bd9579cd90868c6a134cbb06dda584474d7
GitHub-Pull-Request: golang/go#29519
Reviewed-on: https://go-review.googlesource.com/c/156118
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years agoruntime: add test for go function argument scanning
Keith Randall [Thu, 3 Jan 2019 19:03:19 +0000 (11:03 -0800)]
runtime: add test for go function argument scanning

Derived from Naoki's reproducer.

Update #29362

Change-Id: I1cbd33b38a2f74905dbc22c5ecbad4a87a24bdd1
Reviewed-on: https://go-review.googlesource.com/c/156122
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years agoruntime: skip stack barrier copy when there are no pointers
Inada Naoki [Wed, 26 Dec 2018 15:47:20 +0000 (00:47 +0900)]
runtime: skip stack barrier copy when there are no pointers

After CL 31455, "go fun(n)" may put "n" to write barrier buffer
when there are no pointers in fun's arguments.

Fixes #29362

Change-Id: Icfa42b8759ce8ad9267dcb3859c626feb6fda381
Reviewed-on: https://go-review.googlesource.com/c/155779
Reviewed-by: Keith Randall <khr@golang.org>
5 years agoruntime: remove redundant slicing
Stepan Shabalin [Thu, 3 Jan 2019 10:55:15 +0000 (17:55 +0700)]
runtime: remove redundant slicing

In the twoNonZero function in hash_test, the buffer is sliced as [:] three times. This change deletes them.

Change-Id: I0701d0c810b4f3e267f80133a0dcdb4ed81fe356
Reviewed-on: https://go-review.googlesource.com/c/156138
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years agocmd/go: respect gcflags, ldflags in 'go test'
Alessandro Arzilli [Wed, 19 Sep 2018 12:45:45 +0000 (14:45 +0200)]
cmd/go: respect gcflags, ldflags in 'go test'

Fixes bug introduced by https://golang.org/cl/129059 where
gcflags='all=...' and ldflags='all=...' would not be applied to some
packages built by 'go test'.

LoadImport used to set gcflags/ldflags for the Package objects it
created, in https://golang.org/cl/129059 this code was factored out to
setToolFlags. The codepath of `go build` was updated to call
setToolFlags appropriatley, but the codepath of `go test -c` wasn't,
resulting in gcflags/ldflags being applied inconsistently when building
tests.

This commit changes TestPackagesFor to call setToolFlags on the package
objects it creates.

Fixes #27681

Change-Id: Idcbec0c989ee96ec066207184611f08818873e8d
Reviewed-on: https://go-review.googlesource.com/c/136275
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
5 years agocmd/compile: fix no-op instruction used by s390x
Keith Randall [Mon, 31 Dec 2018 23:03:33 +0000 (15:03 -0800)]
cmd/compile: fix no-op instruction used by s390x

CL 152537 introduced a new use for ginsnop, the arch-dependent
routine that generates nops. The previous s390x nop clobbered flags.
It turns out the previous uses of this nop did not require flags
to be preserved, but the new use does.

Use a real nop: the 4-byte preferred nop.

Fixes #29453

Change-Id: I95310dfdd831932e26f5d5b6608324687f4c3162
Reviewed-on: https://go-review.googlesource.com/c/155926
Reviewed-by: Michael Munday <mike.munday@ibm.com>
5 years agonet: skip TestUDPZeroBytePayload on Darwin
Ian Lance Taylor [Thu, 3 Jan 2019 03:57:11 +0000 (19:57 -0800)]
net: skip TestUDPZeroBytePayload on Darwin

Updates #29225

Change-Id: I4c9b7a108861ce5c9ab84f7324ced3da51e7bf2a
Reviewed-on: https://go-review.googlesource.com/c/156119
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agodoc: go1.12: clarify use of MADV_FREE
Ian Lance Taylor [Thu, 20 Dec 2018 23:30:31 +0000 (15:30 -0800)]
doc: go1.12: clarify use of MADV_FREE

Fixes #29337

Change-Id: I1d632d19058c63dac8e25d2a5ad55555c1aec9d4
Reviewed-on: https://go-review.googlesource.com/c/155438
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agocmd/compile: Update ssa/debug_test reference files for delve and gdb
David Chase [Wed, 2 Jan 2019 21:52:49 +0000 (16:52 -0500)]
cmd/compile: Update ssa/debug_test reference files for delve and gdb

Recent changes to compiler backtraces perturbed the line
number assignment, some better, some worse, probably net
worse.  For purposes of passing the long tests, update the
reference files (delve's file was also stale).

TODO: Figure out a less delicate way to locate statement
boundaries for 1.13.

Fixes #29511.

Change-Id: If0e488341d848ba6012045b126c86b1250408d65
Reviewed-on: https://go-review.googlesource.com/c/156021
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agocmd/compile: fix format test
Cherry Zhang [Wed, 2 Jan 2019 21:16:49 +0000 (16:16 -0500)]
cmd/compile: fix format test

CL 156019 adds some debug output, including printing ssa.relation
as string. Update the map.

Change-Id: I0299d2008d199da10d86e5b47a50385b3a314c68
Reviewed-on: https://go-review.googlesource.com/c/156020
Run-TryBot: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agoapi: add os.(*File).SyscallConn to go1.12.txt
Brad Fitzpatrick [Wed, 2 Jan 2019 19:16:43 +0000 (19:16 +0000)]
api: add os.(*File).SyscallConn to go1.12.txt

Fixes #29507

Change-Id: I8cf52e4b89fd28126f252757260d07a31d9dad61
Reviewed-on: https://go-review.googlesource.com/c/155933
Reviewed-by: Katie Hockman <katie@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>

5 years agoruntime: add GODEBUG=madvdontneed=1
Brad Fitzpatrick [Wed, 2 Jan 2019 18:47:06 +0000 (18:47 +0000)]
runtime: add GODEBUG=madvdontneed=1

Fixes #28466

Change-Id: I05b2e0da09394d111913963b60f2ec865c9b4744
Reviewed-on: https://go-review.googlesource.com/c/155931
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
5 years agoruntime: don't spin in checkPut if non-preemptible
Austin Clements [Mon, 31 Dec 2018 01:04:16 +0000 (20:04 -0500)]
runtime: don't spin in checkPut if non-preemptible

Currently it's possible for the runtime to deadlock if checkPut is
called in a non-preemptible context. In this case, checkPut may spin,
so it won't leave the non-preemptible context, but the thread running
gcMarkDone needs to preempt all of the goroutines before it can
release the checkPut spin loops.

Fix this by returning from checkPut if it's called under any of the
conditions that would prevent gcMarkDone from preempting it. In this
case, it leaves a note behind that this happened; if the runtime does
later detect left-over work it can at least indicate that it was
unable to catch it in the act.

For #27993.
Updates #29385 (may fix it).

Change-Id: Ic71c10701229febb4ddf8c104fb10e06d84b122e
Reviewed-on: https://go-review.googlesource.com/c/156017
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rick Hudson <rlh@golang.org>
5 years agocmd/dist: list only supported platforms
Tobias Klauser [Fri, 28 Dec 2018 10:46:35 +0000 (11:46 +0100)]
cmd/dist: list only supported platforms

Introduce an incomplete map in dist alongside cgoEnabled and filter out
the incomplete ports in 'dist list'.

Fixes #28944

Change-Id: I15aae56aec570e1cd9e28906900cd5ba0db77811
Reviewed-on: https://go-review.googlesource.com/c/155839
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agocmd/compile: fix deriving from x+d >= w on overflow in prove pass
Cherry Zhang [Wed, 2 Jan 2019 17:27:55 +0000 (12:27 -0500)]
cmd/compile: fix deriving from x+d >= w on overflow in prove pass

In the case of x+d >= w, where d and w are constants, we are
deriving x is within the bound of min=w-d and max=maxInt-d. When
there is an overflow (min >= max), we know only one of x >= min
or x <= max is true, and we derive this by excluding the other.
When excluding x >= min, we did not consider the equal case, so
we could incorrectly derive x <= max when x == min.

Fixes #29502.

Change-Id: Ia9f7d814264b1a3ddf78f52e2ce23377450e6e8a
Reviewed-on: https://go-review.googlesource.com/c/156019
Reviewed-by: David Chase <drchase@google.com>
5 years agoruntime: disable GDB tests on freebsd/arm for now
Brad Fitzpatrick [Wed, 2 Jan 2019 18:53:23 +0000 (18:53 +0000)]
runtime: disable GDB tests on freebsd/arm for now

Updates #29508
Updates #28679

Change-Id: I19bc9f88aeb2b1f3e69856173a00c5a4d5ed3613
Reviewed-on: https://go-review.googlesource.com/c/155932
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Katie Hockman <katie@golang.org>
5 years agonet/http/httputil: fix missing previous headers in response when switching protocol...
Julien Salleyron [Wed, 2 Jan 2019 16:29:49 +0000 (16:29 +0000)]
net/http/httputil: fix missing previous headers in response when switching protocol in ReverseProxy

When using switching protocol, previous headers set before the reverse proxy are lost.

Fixes #29407

Change-Id: Ia2b9784022d9bccef8625519ccbabbe8a276dfc0
GitHub-Last-Rev: 79bb493dcbb9b76d9d2ff9cd0854b29d634f8b73
GitHub-Pull-Request: golang/go#29408
Reviewed-on: https://go-review.googlesource.com/c/155741
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years agoruntime: fix string formatting
Daniel Ingram [Sat, 22 Dec 2018 22:11:25 +0000 (22:11 +0000)]
runtime: fix string formatting

Change-Id: I87d0bc78a246e479d97b3f83cf77c1f701975413
GitHub-Last-Rev: 22cd684e08464f0e01f1cba2235443371dba3a5d
GitHub-Pull-Request: golang/go#29157
Reviewed-on: https://go-review.googlesource.com/c/153298
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
Reviewed-by: Austin Clements <austin@google.com>
5 years agonet/url: clarify documentation about (*URL).String
Agniva De Sarker [Fri, 21 Dec 2018 08:48:50 +0000 (14:18 +0530)]
net/url: clarify documentation about (*URL).String

Fixes #23669

Change-Id: Ib7f0aab0b066f778a3097583f432f8092310fb81
Reviewed-on: https://go-review.googlesource.com/c/155598
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agocmd/compile/internal/gc: remove unused methodbyname type
Iskander Sharipov [Sat, 29 Dec 2018 20:16:01 +0000 (23:16 +0300)]
cmd/compile/internal/gc: remove unused methodbyname type

methodbyname was used for sorting in bexport.go, until
https://golang.org/cl/139338 removed the code that
invoked sorting function.

R=1.13

Change-Id: I13e313fb60111a142ed3883d81916af254445fdc
Reviewed-on: https://go-review.googlesource.com/c/155959
Run-TryBot: Iskander Sharipov <quasilyte@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agoruntime: fix notetsleepg deadline on js/wasm
Richard Musiol [Tue, 11 Dec 2018 12:59:18 +0000 (13:59 +0100)]
runtime: fix notetsleepg deadline on js/wasm

A notetsleepg may get stuck if its timeout callback gets invoked
exactly on its deadline due to low precision of nanotime. This change
fixes the comparison so it also resolves the note if the timestamps are
equal.

Updates #28975

Change-Id: I045d2f48b7f41cea0caec19b56876e9de01dcd6c
Reviewed-on: https://go-review.googlesource.com/c/153558
Run-TryBot: Richard Musiol <neelance@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agoruntime: fix REFLECTMETHOD macro
Michael McLoughlin [Tue, 1 Jan 2019 01:14:54 +0000 (17:14 -0800)]
runtime: fix REFLECTMETHOD macro

Removes spurious equals sign from REFLECTMETHOD macro.

Fixes #29487

Change-Id: Iaa3d85ff57087aa79a259f28816f8b0a552536f3
Reviewed-on: https://go-review.googlesource.com/c/155927
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agodoc: 2019 is the Year of the Gopher
Josh Bleecher Snyder [Tue, 1 Jan 2019 04:43:38 +0000 (18:43 -1000)]
doc: 2019 is the Year of the Gopher

whereas this is a longstanding tradition
and insofaras it is worth continuing such traditions
and notwithstanding an attempt at future-proofing
thetruthofthematter is that I have been waiting for years to send this change
so despiteallobjections I have updated the copyright year.

Change-Id: I55961b15a7eda35d84fdd9250afdbe19f0bf8412
Reviewed-on: https://go-review.googlesource.com/c/155928
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
5 years agostrconv: make docs for Itoa and Atoi slightly higher level
Josh Bleecher Snyder [Sun, 30 Dec 2018 18:22:27 +0000 (08:22 -1000)]
strconv: make docs for Itoa and Atoi slightly higher level

Fixes #29461

Change-Id: I5db8bc80e5bd0778dced8471581c67e66853aada
Reviewed-on: https://go-review.googlesource.com/c/155924
Reviewed-by: Rob Pike <r@golang.org>
5 years agosyscall: revert to pre-FreeBSD 10 / POSIX-2008 timespec field names in Stat_t on...
Yuval Pavel Zholkover [Sat, 29 Dec 2018 12:27:15 +0000 (14:27 +0200)]
syscall: revert to pre-FreeBSD 10 / POSIX-2008 timespec field names in Stat_t on FreeBSD

CL 138595 introduced the new names when the hardcoded stat8 definitions was replaced
with a cgo generated one.

Fixes #29393
Updates #22448

Change-Id: I6309958306329ff301c17344b2e0ead0cc874224
Reviewed-on: https://go-review.googlesource.com/c/155958
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agostrconv: add missing package name into doc.go(godoc overview)
Hidetatsu Yaginuma [Sun, 30 Dec 2018 07:03:53 +0000 (16:03 +0900)]
strconv: add missing package name into doc.go(godoc overview)

Change-Id: I336ad707a85bf0c81b6c2230c90452c0b3b92924
Reviewed-on: https://go-review.googlesource.com/c/155998
Reviewed-by: Robert Griesemer <gri@golang.org>
5 years agoruntime: use EnumTimeFormatsEx instead of EnumWindows in callback tests
Jordan Rhee [Sun, 30 Dec 2018 00:19:16 +0000 (16:19 -0800)]
runtime: use EnumTimeFormatsEx instead of EnumWindows in callback tests

Use EnumTimeFormatsEx() to test panics across callback boundaries
instead of EnumWindows(). EnumWindows() is incompatible with Go's panic
unwinding mechanism. See the associated issue for more information.

Updates #26148

Change-Id: If1dd70885d9c418b980b6827942cb1fd16c73803
Reviewed-on: https://go-review.googlesource.com/c/155923
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
5 years agonet/http: fix typographical error in transport.go
Taufiq Rahman [Sat, 29 Dec 2018 16:18:11 +0000 (16:18 +0000)]
net/http: fix typographical error in transport.go

Change-Id: I5f9de0daa3c18ecd7d6cd30ea13d147e227b3550
GitHub-Last-Rev: 5eabcbd91f8988c8f74f5bd11fb0e79cb85a9451
GitHub-Pull-Request: golang/go#29454
Reviewed-on: https://go-review.googlesource.com/c/155920
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agotest: disable issue 29329 test when cgo is not enabled
Alberto Donizetti [Sat, 29 Dec 2018 12:11:34 +0000 (13:11 +0100)]
test: disable issue 29329 test when cgo is not enabled

CL 155917 added a -race test that shouldn't be run when cgo is not
enabled. Enforce this in the test file, with a buildflag.

Fixes the nocgo builder.

Change-Id: I9fe0d8f21da4d6e2de3f8fe9395e1fa7e9664b02
Reviewed-on: https://go-review.googlesource.com/c/155957
Run-TryBot: Alberto Donizetti <alb.donizetti@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agoruntime: panic on uncomparable map key, even if map is empty
Keith Randall [Fri, 28 Dec 2018 22:34:48 +0000 (14:34 -0800)]
runtime: panic on uncomparable map key, even if map is empty

Reorg map flags a bit so we don't need any extra space for the extra flag.

Fixes #23734

Change-Id: I436812156240ae90de53d0943fe1aabf3ea37417
Reviewed-on: https://go-review.googlesource.com/c/155918
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agocmd/compile: fix racewalk{enter,exit} removal
Keith Randall [Fri, 28 Dec 2018 20:43:48 +0000 (12:43 -0800)]
cmd/compile: fix racewalk{enter,exit} removal

We can't remove race instrumentation unless there are no calls,
not just no static calls. Closure and interface calls also count.

The problem in issue 29329 is that there was a racefuncenter, an
InterCall, and a racefuncexit.  The racefuncenter was removed, then
the InterCall was rewritten to a StaticCall. That prevented the
racefuncexit from being removed. That caused an imbalance in
racefuncenter/racefuncexit calls, which made the race detector barf.

Bug introduced at CL 121235

Fixes #29329

Change-Id: I2c94ac6cf918dd910b74b2a0de5dc2480d236f16
Reviewed-on: https://go-review.googlesource.com/c/155917
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agoencoding/gob: mention that Encoder and Decoder are safe for concurrent use
Mostyn Bramley-Moore [Fri, 28 Dec 2018 20:02:13 +0000 (20:02 +0000)]
encoding/gob: mention that Encoder and Decoder are safe for concurrent use

Fixes #29416

Change-Id: I24364bfee77aceace53f85f1046ef4d73f8feebb

Change-Id: I24364bfee77aceace53f85f1046ef4d73f8feebb
GitHub-Last-Rev: ad9f31145763dc16f53dd9f3154667b162759f69
GitHub-Pull-Request: golang/go#29417
Reviewed-on: https://go-review.googlesource.com/c/155742
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agocmd/compile,runtime: redo mid-stack inlining tracebacks
Keith Randall [Tue, 4 Dec 2018 15:58:18 +0000 (07:58 -0800)]
cmd/compile,runtime: redo mid-stack inlining tracebacks

Work involved in getting a stack trace is divided between
runtime.Callers and runtime.CallersFrames.

Before this CL, runtime.Callers returns a pc per runtime frame.
runtime.CallersFrames is responsible for expanding a runtime frame
into potentially multiple user frames.

After this CL, runtime.Callers returns a pc per user frame.
runtime.CallersFrames just maps those to user frame info.

Entries in the result of runtime.Callers are now pcs
of the calls (or of the inline marks), not of the instruction
just after the call.

Fixes #29007
Fixes #28640
Update #26320

Change-Id: I1c9567596ff73dc73271311005097a9188c3406f
Reviewed-on: https://go-review.googlesource.com/c/152537
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
5 years agoos: don't let sendFile put a pipe into blocking mode
Ian Lance Taylor [Thu, 20 Dec 2018 00:47:50 +0000 (16:47 -0800)]
os: don't let sendFile put a pipe into blocking mode

Use SyscallConn to avoid calling the Fd method in sendFile on Unix
systems, since Fd has the side effect of putting the descriptor into
blocking mode.

Fixes #28330

Change-Id: If093417a225fe44092bd2c0dbbc3937422e98c0b
Reviewed-on: https://go-review.googlesource.com/c/155137
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agosyscall: document LockOSThread with GNU/Linux SysProcAttr.Ptrace
Ian Lance Taylor [Thu, 20 Dec 2018 02:25:08 +0000 (18:25 -0800)]
syscall: document LockOSThread with GNU/Linux SysProcAttr.Ptrace

Fixes #28315

Change-Id: Ie02c72d02ad2f66c9cdbbba579a304641f327672
Reviewed-on: https://go-review.googlesource.com/c/155138
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agoos: add SyscallConn method for os.File
Ian Lance Taylor [Thu, 20 Dec 2018 23:09:41 +0000 (15:09 -0800)]
os: add SyscallConn method for os.File

Fixes #24331

Change-Id: I119c09a4259d852cdf8ea31b3e03e6f09a5f7bda
Reviewed-on: https://go-review.googlesource.com/c/155517
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agocmd/compile: fix MIPS SGTconst-with-shift rules
Cherry Zhang [Wed, 26 Dec 2018 00:36:25 +0000 (19:36 -0500)]
cmd/compile: fix MIPS SGTconst-with-shift rules

(SGTconst [c] (SRLconst _ [d])) && 0 <= int32(c) && uint32(d) <= 31 && 1<<(32-uint32(d)) <= int32(c) -> (MOVWconst [1])

This rule is problematic. 1<<(32-uint32(d)) <= int32(c) meant to
say that it is true if c is greater than the largest possible
value of the right shift. But when d==1, 1<<(32-1) is negative
and results in the wrong comparison.

Rewrite the rules in a more direct way.

Fixes #29402.

Change-Id: I5940fc9538d9bc3a4bcae8aa34672867540dc60e
Reviewed-on: https://go-review.googlesource.com/c/155798
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
5 years agomath/big: fix incorrect comment variable reference
Will Beason [Wed, 26 Dec 2018 01:17:47 +0000 (01:17 +0000)]
math/big: fix incorrect comment variable reference

Fix comment as w&1 is the parity of 'x', not of 'n'.

Change-Id: Ia0e448f7e5896412ff9b164459ce15561ab624cc
GitHub-Last-Rev: 54ba08ab1055b5e6e506fc8ac06c2920ff095b6e
GitHub-Pull-Request: golang/go#29419
Reviewed-on: https://go-review.googlesource.com/c/155743
Reviewed-by: Robert Griesemer <gri@golang.org>
5 years agocmd: vendor x/sys/unix into the stdlib
Keith Randall [Sat, 22 Dec 2018 02:23:31 +0000 (18:23 -0800)]
cmd: vendor x/sys/unix into the stdlib

Last of the Macos libSystem changes, hopefully.

Fixes #17490

Change-Id: I88b303bafd92494cc4ddde712213d2ef976ce4e2
Reviewed-on: https://go-review.googlesource.com/c/155737
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agotime: return ENOENT if a zoneinfo zip file is not found
Max Ushakov [Fri, 21 Dec 2018 14:53:33 +0000 (17:53 +0300)]
time: return ENOENT if a zoneinfo zip file is not found

Updates #20969

Change-Id: Ibcf0bf932d5b1de67c22c63dd8514ed7a5d198fb
Reviewed-on: https://go-review.googlesource.com/c/155538
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agopath/filepath: walkSymlinks: return correct error for file with trailing slash
LE Manh Cuong [Fri, 21 Dec 2018 04:21:02 +0000 (11:21 +0700)]
path/filepath: walkSymlinks: return correct error for file with trailing slash

Rather than return os.ErrNotExist for /path/to/existing_file/,
walkSymLinks now returns syscall.ENOTDIR.

This is consistent with behavior of os.Lstat.

Fixes #29372

Change-Id: Id5c471d901db04b2f35d60f60a81b2a0be93cae9
Reviewed-on: https://go-review.googlesource.com/c/155597
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agoreflect: fix panic when Value.IsNil is called for UnsafePointer
Andrew Bonventre [Sun, 23 Dec 2018 21:48:38 +0000 (16:48 -0500)]
reflect: fix panic when Value.IsNil is called for UnsafePointer

UnsafePointer is a valid type kind to call IsNil on.

Fixes #29381

Change-Id: Iaf65d582c67f4be52cd1885badf40f174920500b
Reviewed-on: https://go-review.googlesource.com/c/155797
Run-TryBot: Andrew Bonventre <andybons@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
5 years agocmd/go: add regression test for cryptic vcs errors
Daniel Martí [Thu, 20 Dec 2018 23:04:18 +0000 (00:04 +0100)]
cmd/go: add regression test for cryptic vcs errors

On Go 1.11.x, if one ran 'go build' on a main package within a module,
while a needed vcs program like git was missing, a confusing error would
show up:

build testmod: cannot find module for path rsc.io/quote

The error should instead point at the source of the problem, which is
the missing vcs program. Thankfully, Go 1.12 doesn't have this bug, even
though it doesn't seem like the bug was fixed directly and
intentionally.

To ensure that this particular edge case isn't broken again, add a
regression test. Piggyback on mod_vcs_missing, since it already requires
a missing vcs program and network access.

I double-checked that Go 1.11 fails this test via /usr/bin/go, which is
1.11.3 on my system:

$ PATH=~/tip/bin go test -v -run Script/mod_vcs_missing
[...]
> exec /usr/bin/go build
[stderr]
build m: cannot find module for path launchpad.net/gocheck

Fixes #28948.

Change-Id: Iff1bcf77d9f7c11d15935cb87d6f58d7981d33d2
Reviewed-on: https://go-review.googlesource.com/c/155537
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
5 years agocmd/compile/internal/ssa/gen: set wasm genfile
Josh Bleecher Snyder [Sun, 16 Dec 2018 05:39:00 +0000 (21:39 -0800)]
cmd/compile/internal/ssa/gen: set wasm genfile

This appears to have been an oversight and/or
left over from development.

Setting the genfile means that extra sanity
checks are executed when regenerating SSA files.
They already pass.

Change-Id: Icc01ecf85020d3d51355e8bccfbc521b52371747
Reviewed-on: https://go-review.googlesource.com/c/154459
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Keith Randall <khr@golang.org>
5 years agocmd/compile: pad zero-sized stack variables
Keith Randall [Sat, 22 Dec 2018 00:36:45 +0000 (16:36 -0800)]
cmd/compile: pad zero-sized stack variables

If someone takes a pointer to a zero-sized stack variable, it can
be incorrectly interpreted as a pointer to the next object in the
stack frame. To avoid this, add some padding after zero-sized variables.

We only need to pad if the next variable in memory (which is the
previous variable in the order in which we allocate variables to the
stack frame) has pointers. If the next variable has no pointers, it
won't hurt to have a pointer to it.

Because we allocate all pointer-containing variables before all
non-pointer-containing variables, we should only have to pad once per
frame.

Fixes #24993

Change-Id: Ife561cdfdf964fdbf69af03ae6ba97d004e6193c
Reviewed-on: https://go-review.googlesource.com/c/155698
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years agocmd/compile: fix line number for implicitly declared method expressions
Keith Randall [Fri, 21 Dec 2018 23:41:28 +0000 (15:41 -0800)]
cmd/compile: fix line number for implicitly declared method expressions

Method expressions where the method is implicitly declared have no
line number. The Error method of the built-in error type is one such
method.  We leave the line number at the use of the method expression
in this case.

Fixes #29389

Change-Id: I29c64bb47b1a704576abf086599eb5af7b78df53
Reviewed-on: https://go-review.googlesource.com/c/155639
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agocmd/cgo: don't let inserted /*line*/ become a // comment
Ian Lance Taylor [Fri, 21 Dec 2018 21:14:09 +0000 (13:14 -0800)]
cmd/cgo: don't let inserted /*line*/ become a // comment

Fixes #29383

Change-Id: I0fb2929863e153b96d32d851e25e536231e4ae65
Reviewed-on: https://go-review.googlesource.com/c/155638
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
5 years agodoc: go_mem: clarify Once docs
Ian Lance Taylor [Fri, 21 Dec 2018 19:16:43 +0000 (11:16 -0800)]
doc: go_mem: clarify Once docs

Fixes #27808

Change-Id: Ia643d51004c47953642a2ba41dfed281f1112be6
Reviewed-on: https://go-review.googlesource.com/c/155637
Reviewed-by: Bryan C. Mills <bcmills@google.com>
5 years agocmd/go: use cached source files in "go list -find -compiled"
Jay Conrod [Fri, 21 Dec 2018 18:47:20 +0000 (13:47 -0500)]
cmd/go: use cached source files in "go list -find -compiled"

When "go list" is invoked with -find, it clears the list of imports
for each package matched on the command line. This affects action IDs,
since they incorporate dependencies' action IDs. Consequently, the
build triggered by -compiled won't find sources cached by
"go build".

We can still safely cache compiled sources from multiple runs of
"go list -find -compiled" though, since cgo generated sources are not
affected by imported dependencies. This change adds a second look into
the cache in this situation.

Fixes #29371

Change-Id: Ia0ae5a403ab5d621feaa16f521e6a65ac0ae6d9a
Reviewed-on: https://go-review.googlesource.com/c/155481
Reviewed-by: Bryan C. Mills <bcmills@google.com>
5 years agocmd/go: fix -n output in runtime/internal/atomic
Jay Conrod [Fri, 21 Dec 2018 17:23:18 +0000 (12:23 -0500)]
cmd/go: fix -n output in runtime/internal/atomic

When building runtime/internal/atomic, the toolchain writes a symabis2
file. This file is read back in, filtered, and appended to the symabis
file. This breaks with -n, since the symabis2 file is never written.

With this change, when -n is used, an equivalent "grep" command is
printed instead. The output for -x is unchanged.

Fixes #29346

Change-Id: Id25e06e06364fc6689e71660d000f09c649c4f0c
Reviewed-on: https://go-review.googlesource.com/c/155480
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>

5 years agoruntime: skip TestLockOSThreadAvoidsStatePropagation if one can't unshare
Michael Anthony Knyszek [Thu, 20 Dec 2018 20:21:45 +0000 (20:21 +0000)]
runtime: skip TestLockOSThreadAvoidsStatePropagation if one can't unshare

This change splits a testprog out of TestLockOSThreadExit and makes it
its own test. Then, this change makes the testprog exit prematurely with
a special message if unshare fails with EPERM because not all of the
builders allow the user to call the unshare syscall.

Also, do some minor cleanup on the TestLockOSThread* tests.

Fixes #29366.

Change-Id: Id8a9f6c4b16e26af92ed2916b90b0249ba226dbe
Reviewed-on: https://go-review.googlesource.com/c/155437
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agodoc: clarify change to File.Sync on macOS
Ian Lance Taylor [Wed, 19 Dec 2018 15:08:38 +0000 (07:08 -0800)]
doc: clarify change to File.Sync on macOS

Updates #26650

Change-Id: I0ec070127dcacc7fc68dd5baf125eb762e1ea846
Reviewed-on: https://go-review.googlesource.com/c/155038
Reviewed-by: Bryan C. Mills <bcmills@google.com>
5 years agocmd/compile: fix ICE due to bad rune width
Matthew Dempsky [Thu, 20 Dec 2018 19:10:06 +0000 (11:10 -0800)]
cmd/compile: fix ICE due to bad rune width

It was possible that

    var X interface{} = 'x'

could cause a compilation failure due to having not calculated rune's
width yet. typecheck.go normally calculates the width of things, but
it doesn't for implicit conversions to default type. We already
compute the width of all of the standard numeric types in universe.go,
but we failed to calculate it for the rune alias type. So we could
later crash if the code never otherwise explicitly mentioned 'rune'.

While here, explicitly compute widths for 'byte' and 'error' for
consistency.

Fixes #29350.

Change-Id: Ifedd4899527c983ee5258dcf75aaf635b6f812f8
Reviewed-on: https://go-review.googlesource.com/c/155380
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
5 years agoos: clearer doc for Interrupt
Kevin Burke [Tue, 25 Sep 2018 16:22:09 +0000 (09:22 -0700)]
os: clearer doc for Interrupt

I was confused by the juxtaposition of os.Interrupt docs, which are
"guaranteed to exist on all platforms" in one sentence and then
"not implemented" in the next sentence. Reading the code reveals
"not implemented" refers specifically to the implementation of
os.Process.Signal on Windows, not to the os.Interrupt variable itself.
Reword the doc to make this distinction clearer.

Fixes #27854.

Change-Id: I5fe7cddea61fa1954cef2006dc51b8fa8ece4d6e
Reviewed-on: https://go-review.googlesource.com/c/137336
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
5 years agodoc/go1.12: correct types for math/bits
Brian Kessler [Thu, 20 Dec 2018 18:16:23 +0000 (11:16 -0700)]
doc/go1.12: correct types for math/bits

Extended precision math/bits functions are unsigned.

Change-Id: Ic1633e9c367fc3d5a80bc503008f035db4e78945
Reviewed-on: https://go-review.googlesource.com/c/155379
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agocompress/flate: fix the old url for the flate algorithm
Osamu TONOMORI [Thu, 20 Dec 2018 13:39:01 +0000 (22:39 +0900)]
compress/flate: fix the old url for the flate algorithm

Change-Id: I84b74bc96516033bbf4a01f9aa81fe60d5a41355
Reviewed-on: https://go-review.googlesource.com/c/155317
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agoos: clarify O_TRUNC comment
Ian Lance Taylor [Thu, 20 Dec 2018 01:49:11 +0000 (17:49 -0800)]
os: clarify O_TRUNC comment

Fixes #28699

Change-Id: Ic340c3171bb7d91d8cb9553967c2b51e7d9daba8
Reviewed-on: https://go-review.googlesource.com/c/155177
Reviewed-by: Bryan C. Mills <bcmills@google.com>
5 years agocmd/compile: ignore out-of-bounds reads from readonly constants
Keith Randall [Thu, 13 Dec 2018 17:31:21 +0000 (09:31 -0800)]
cmd/compile: ignore out-of-bounds reads from readonly constants

Out-of-bounds reads of globals can happen in dead code. For code
like this:

s := "a"
if len(s) == 3 {
   load s[0], s[1], and s[2]
}

The out-of-bounds loads are dead code, but aren't removed yet
when lowering. We need to not panic when compile-time evaluating
those loads. This can only happen for dead code, so the result
doesn't matter.

Fixes #29215

Change-Id: I7fb765766328b9524c6f2a1e6ab8d8edd9875097
Reviewed-on: https://go-review.googlesource.com/c/154057
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alberto Donizetti <alb.donizetti@gmail.com>
5 years agodoc/go1.12: fix GOARCH value in Syscall18 link
Tobias Klauser [Thu, 20 Dec 2018 08:38:37 +0000 (09:38 +0100)]
doc/go1.12: fix GOARCH value in Syscall18 link

Currently the link works also with the non-existing GOARCH armd64, but
let's correct in anyhow.

Change-Id: Ida647b8f9dd2f8460b019f5a23759f10a6da8e60
Reviewed-on: https://go-review.googlesource.com/c/155277
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agocmd/vendor: update vendored golang.org/x/sys/windows
Tobias Klauser [Thu, 20 Dec 2018 09:56:47 +0000 (10:56 +0100)]
cmd/vendor: update vendored golang.org/x/sys/windows

Update to x/sys git revision 074acd46bca67915925527c07849494d115e7c43

This fixes TestFormatMessage and TestExample on windows/arm by pulling
in CL 154560 and CL 154817.

Change-Id: Ic6495fe3072b5bcc7ea68efb3f0be5fc1fe4c238
Reviewed-on: https://go-review.googlesource.com/c/155297
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agonet: don't accept timeouts in TestUDPZeroBytePayload
Ian Lance Taylor [Tue, 18 Dec 2018 23:10:38 +0000 (15:10 -0800)]
net: don't accept timeouts in TestUDPZeroBytePayload

Before this CL we accepted timeouts in TestUDPZeroBytePayload to avoid
flakiness and because, according to CL 9194, the test didn't work on
some platforms. On Windows, before CL 132781, the read would always
timeout, and so since the test accepted timeouts it would pass
incorrectly. CL 132781 fixed Windows, and changed the test to not
accept timeouts in the ReadFrom case.

However, the timeout was short, and so on a loaded system the Read
might timeout not due to an error in the code, but just because the
read was not delivered. So ignoring timeouts made the test flaky, as
reported in issue #29225.

This CL tries to get to a better state by increasing the timeout to a
large value and not permitting timeouts at all. If there are systems
where the test fails, we will need to explicitly skip the test on
those systems.

Fixes #29225

Change-Id: I26863369898a69cac866b34fcb5b6ffbffab31f6
Reviewed-on: https://go-review.googlesource.com/c/154759
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agoos: adjust TempDir for Z:\
Alex Brainman [Mon, 17 Dec 2018 09:39:48 +0000 (20:39 +1100)]
os: adjust TempDir for Z:\

If TMP environment variable is set to Z:\, TempDir returns Z:.
But Z: refers to current directory on Z:, while Z:\ refers to root
directory on Z:. Adjust TempDir to return Z:\.

Fixes #29291

Change-Id: If04d0c7977a8ac2d9d558307502e81beb68776ef
Reviewed-on: https://go-review.googlesource.com/c/154384
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agonet/http: fix the old url about deflate
catatsuy [Thu, 20 Dec 2018 03:36:27 +0000 (12:36 +0900)]
net/http: fix the old url about deflate

Change-Id: Iaa1468296fbc98389165a152cf8b591216c22489
Reviewed-on: https://go-review.googlesource.com/c/155217
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agoruntime: use QPC to implement cputicks() on windows/arm
Jordan Rhee [Wed, 19 Dec 2018 00:41:57 +0000 (16:41 -0800)]
runtime: use QPC to implement cputicks() on windows/arm

Tracing uses cputicks() to generate trace event timestamps. cputicks()
is expected to be a high resolution clock source. On Windows/ARM,
call QueryPerformanceCounter() which is the highest resolution clock
source available.

Updates #26148

Change-Id: I987fa556060b3d60c02f07b87b9e6320b9b026e2
Reviewed-on: https://go-review.googlesource.com/c/154762
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years agoruntime: don't clear lockedExt on locked M when G exits
Michael Anthony Knyszek [Fri, 7 Dec 2018 00:07:43 +0000 (00:07 +0000)]
runtime: don't clear lockedExt on locked M when G exits

When a locked M has its G exit without calling UnlockOSThread, then
lockedExt on it was getting cleared. Unfortunately, this meant that
during P handoff, if a new M was started, it might get forked (on
most OSs besides Windows) from the locked M, which could have kernel
state attached to it.

To solve this, just don't clear lockedExt. At the point where the
locked M has its G exit, it will also exit in accordance with the
LockOSThread API. So, we can safely assume that it's lockedExt state
will no longer be used. For the case of the main thread where it just
gets wedged instead of exiting, it's probably better for it to keep
the locked marker since it more accurately represents its state.

Fixed #28979.

Change-Id: I7d3d71dd65bcb873e9758086d2cbcb9a06429b0f
Reviewed-on: https://go-review.googlesource.com/c/153078
Run-TryBot: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Austin Clements <austin@google.com>
5 years agoruntime: disable TestArenaCollision on Darwin in race mode
Michael Anthony Knyszek [Wed, 19 Dec 2018 17:32:22 +0000 (17:32 +0000)]
runtime: disable TestArenaCollision on Darwin in race mode

This change disables the test TestArenaCollision on Darwin in race mode
to deal with the fact that Darwin 10.10 must use MAP_FIXED in race mode
to ensure we retain our heap in a particular portion of the address
space which the race detector needs. The test specifically checks to
make sure a manually mapped region's space isn't re-used, which is
definitely possible with MAP_FIXED because it replaces whatever mapping
already exists at a given address.

This change then also makes it so that MAP_FIXED is only used in race
mode and on Darwin, not all BSDs, because using MAP_FIXED breaks this
test for FreeBSD in addition to Darwin.

Updates #26475.
Fixes #29340.

Change-Id: I1c59349408ccd7eeb30c4bf2593f48316b23ab2f
Reviewed-on: https://go-review.googlesource.com/c/155097
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agoRevert "runtime: use QPC for nanotime and time.now on windows/arm"
Jordan Rhee [Wed, 19 Dec 2018 00:32:09 +0000 (16:32 -0800)]
Revert "runtime: use QPC for nanotime and time.now on windows/arm"

This reverts change https://golang.org/cl/154758.

Restore the previous implementations of nanotime and time.now, which
are sufficiently high resolution and more efficient than
QueryPerformanceCounter. The intent of the change was to improve
resolution of tracing timestamps, but the change was overly broad
as it was only necessary to fix cputicks(). cputicks() is fixed in
a subsequent change.

Updates #26148

Change-Id: Ib9883d02fe1af2cc4940e866d8f6dc7622d47781
Reviewed-on: https://go-review.googlesource.com/c/154761
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years agodoc/go1.12: fix minor grammatical error
Agniva De Sarker [Wed, 19 Dec 2018 05:03:42 +0000 (10:33 +0530)]
doc/go1.12: fix minor grammatical error

Change-Id: I767bf77aeab62f2d42239fac9d601a8e04fe860f
Reviewed-on: https://go-review.googlesource.com/c/154957
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agodoc/go1.12: fix typos and code formatting
Tobias Klauser [Wed, 19 Dec 2018 08:36:11 +0000 (09:36 +0100)]
doc/go1.12: fix typos and code formatting

Fix two typos and don't indent the go vet example.

Change-Id: Iccec56ca5decfbae45547a00115500ed13b703e1
Reviewed-on: https://go-review.googlesource.com/c/154721
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agocmd/cgo: ensure the command passed to run retains a trailing dash
Ian Lance Taylor [Wed, 19 Dec 2018 15:03:04 +0000 (07:03 -0800)]
cmd/cgo: ensure the command passed to run retains a trailing dash

This was accidentally broken by CL 127755.

Fixes #29333

Change-Id: I5e92048c64a55c1699d6c38eb4dbbd51c817b820
Reviewed-on: https://go-review.googlesource.com/c/155037
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agocmd/cgo,doc/go1.12.html: document breaking EGLDisplay change
Elias Naur [Wed, 19 Dec 2018 12:50:13 +0000 (13:50 +0100)]
cmd/cgo,doc/go1.12.html: document breaking EGLDisplay change

Change-Id: I3c8ba5fdb05b6b1324648622656cc10071c70a34
Reviewed-on: https://go-review.googlesource.com/c/154997
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agoruntime: avoid write barrier in startpanic_m
Michael Anthony Knyszek [Tue, 18 Dec 2018 20:04:53 +0000 (20:04 +0000)]
runtime: avoid write barrier in startpanic_m

startpanic_m could be called correctly in a context where there's a
valid G, a valid M, but no P, for example in a signal handler which
panics. Currently, startpanic_m has write barriers enabled because
write barriers are permitted if a G's M is dying. However, all the
current write barrier implementations assume the current G has a P.

Therefore, in this change we disable write barriers in startpanic_m,
remove the only pointer write which clears g.writebuf, and fix up gwrite
to ignore the writebuf if the current G's M is dying, rather than
relying on it being nil in the dying case.

Fixes #26575.

Change-Id: I9b29e6b9edf00d8e99ffc71770c287142ebae086
Reviewed-on: https://go-review.googlesource.com/c/154837
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
5 years agoruntime: use QPC for nanotime and time.now on windows/arm go1.12beta1
Jordan Rhee [Tue, 18 Dec 2018 20:54:23 +0000 (12:54 -0800)]
runtime: use QPC for nanotime and time.now on windows/arm

The previous implementation of nanotime and time.now used a time source
that was updated on the system clock tick, which has a maximum
resolution of about 1ms. On 386 and amd64, this time source maps to
the system performance counter, so has much higher resolution.
On ARM, use QueryPerformanceCounter() to get a high resolution timestamp.

Updates #26148

Change-Id: I1abc99baf927a95b472ac05020a7788626c71d08
Reviewed-on: https://go-review.googlesource.com/c/154758
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years agodoc/go1.12: note that syscall.Getdirentries is no longer supported on iOS
Elias Naur [Tue, 18 Dec 2018 20:32:48 +0000 (21:32 +0100)]
doc/go1.12: note that syscall.Getdirentries is no longer supported on iOS

Change-Id: I4277f4130b460b42c5b51fd5a5e07f6c0e62163b
Reviewed-on: https://go-review.googlesource.com/c/154720
Reviewed-by: Ian Lance Taylor <iant@golang.org>
5 years agoapi: promote next to go1.12
Filippo Valsorda [Tue, 18 Dec 2018 20:32:58 +0000 (15:32 -0500)]
api: promote next to go1.12

Change-Id: I9a30c76d1299a494cce69b1060156bc2932ac8d5
Reviewed-on: https://go-review.googlesource.com/c/154857
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years agoos: show how to print permission bits in octal
Kevin Burke [Mon, 17 Dec 2018 00:37:07 +0000 (00:37 +0000)]
os: show how to print permission bits in octal

Permission bits are most commonly viewed in string form (rwx-- etc) or
in octal form (0755), but the latter is relatively rare in Go.
Demonstrate how to print a FileMode in readable octal format.

Change-Id: I41feb801bcecb5077d4eabafdea27c149fc179a1
Reviewed-on: https://go-review.googlesource.com/c/154423
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
5 years agoruntime: call mmap with MAP_FIXED on BSDs in race mode
Michael Anthony Knyszek [Tue, 11 Dec 2018 22:03:04 +0000 (22:03 +0000)]
runtime: call mmap with MAP_FIXED on BSDs in race mode

This change makes it so that reserving more of the address space for the
heap calls mmap with MAP_FIXED in race mode. Race mode requires certain
guarantees on where the heap is located in the address space, and on
Darwin 10.10 it appears that the kernel may end up ignoring the hint
quite often (#26475). Using MAP_FIXED is relatively OK in race mode
because nothing else should be mapped in the memory region provided by
the initial hints.

Fixes #26475.

Change-Id: Id7ac1534ee74f6de491bc04441f27dbda09f0285
Reviewed-on: https://go-review.googlesource.com/c/153897
Reviewed-by: Austin Clements <austin@google.com>
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

5 years agocmd/cover: avoid repeating positions
Ian Lance Taylor [Fri, 7 Dec 2018 04:54:35 +0000 (20:54 -0800)]
cmd/cover: avoid repeating positions

When using //line directives and unformatted code it is possible for
positions to repeat. Increment the final column position to avoid that.

Fixes #27350

Change-Id: I2faccc31360075e9814d4a024b0f98b117f8ce97
Reviewed-on: https://go-review.googlesource.com/c/153061
Run-TryBot: Rob Pike <r@golang.org>
Reviewed-by: Rob Pike <r@golang.org>