]> Cypherpunks repositories - gostls13.git/log
gostls13.git
8 years agodoc: add net/http section to go1.8.html
Brad Fitzpatrick [Wed, 23 Nov 2016 03:46:58 +0000 (03:46 +0000)]
doc: add net/http section to go1.8.html

TBR=See https://golang.org/cl/33244 and review there.

Updates #17929

Change-Id: I752ec7a6d086f370feaf3cf282708620e891079b
Reviewed-on: https://go-review.googlesource.com/33478
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agocmd/gofmt: don't call Chmod on windows
Brad Fitzpatrick [Wed, 23 Nov 2016 01:43:33 +0000 (01:43 +0000)]
cmd/gofmt: don't call Chmod on windows

Fixes #18026

Change-Id: Id510f427ceffb2441c3d6f5bb5c93244e46c6497
Reviewed-on: https://go-review.googlesource.com/33477
TryBot-Result: Gobot Gobot <gobot@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
8 years agodoc: add SIGPIPE behaviour change to go1.8.txt
Elias Naur [Tue, 22 Nov 2016 23:50:46 +0000 (00:50 +0100)]
doc: add SIGPIPE behaviour change to go1.8.txt

CL 32796 changes the SIGPIPE behaviour for c-archive and c-shared
programs. Add it to go1.8.txt.

Change-Id: I31200187033349c642965a4bb077bcc77d5329a3
Reviewed-on: https://go-review.googlesource.com/33397
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agoreflect: fix typo in comment
Ian Lance Taylor [Tue, 22 Nov 2016 23:50:03 +0000 (15:50 -0800)]
reflect: fix typo in comment

Sigh, forgot to run `git mail`.

Change-Id: Idc49be2bb20d6f0e392cb472a63267ffee2ca22c
Reviewed-on: https://go-review.googlesource.com/33476
Reviewed-by: Michael Hudson-Doyle <michael.hudson@canonical.com>
8 years agoreflect: fix size of StructOf ending in zero-sized field
Ian Lance Taylor [Tue, 22 Nov 2016 23:50:03 +0000 (15:50 -0800)]
reflect: fix size of StructOf ending in zero-sized field

Update #9401.
Fixes #18016.

Change-Id: Icc24dd10dab1ad8e5cf295e0727d437afa5025c0
Reviewed-on: https://go-review.googlesource.com/33475
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
8 years agodatabase/sql: fix TestPendingConnsAfterErr
Daniel Theophanes [Mon, 31 Oct 2016 14:58:41 +0000 (07:58 -0700)]
database/sql: fix TestPendingConnsAfterErr

TestPendingConnsAfterErr showed a failure on slower systems.
Wait and check for the database to close all connections
before pronouncing failure.

A more careful method was attempted but the connection pool
behavior is too dependent on the scheduler behavior to be
predictable.

Fixes #15684

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

8 years agodoc: fix typos in go1.8.html
Joe Tsai [Tue, 22 Nov 2016 19:30:16 +0000 (11:30 -0800)]
doc: fix typos in go1.8.html

Change-Id: I51180e1c685e488f7ea4c51a63fd035148671b05
Reviewed-on: https://go-review.googlesource.com/33470
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agodoc: more go1.8.html content
Brad Fitzpatrick [Tue, 22 Nov 2016 19:57:49 +0000 (11:57 -0800)]
doc: more go1.8.html content

TBR=See https://golang.org/cl/33244 and review there.

Updates #17929

Change-Id: I7cb0b666469dba35426d1f0ae1b185e0bdfeac05
Reviewed-on: https://go-review.googlesource.com/33474
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agocmd/go: print CC environment variables on Plan 9
David du Colombier [Tue, 22 Nov 2016 15:19:25 +0000 (16:19 +0100)]
cmd/go: print CC environment variables on Plan 9

This changes makes the output of `go env` the same
as on other operating systems.

Fixes #18013.

Change-Id: I3079e14dcf7b30c75ec3fde6c78cb95721111320
Reviewed-on: https://go-review.googlesource.com/33396
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

8 years agoruntime/pprof/internal/protopprof: fix test on s390x
Michael Munday [Tue, 22 Nov 2016 20:39:51 +0000 (15:39 -0500)]
runtime/pprof/internal/protopprof: fix test on s390x

Applies the fix from CL 32920 to the new test TestSampledHeapAllocProfile
introduced in CL 33422. The test should be skipped rather than fail if
there is only one executable region of memory.

Updates #17852.

Change-Id: Id8c47b1f17ead14f02a58a024c9a04ebb8ec0429
Reviewed-on: https://go-review.googlesource.com/33453
Run-TryBot: Michael Munday <munday@ca.ibm.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

8 years agoruntime: do not print runtime panic frame at top of user stack
Russ Cox [Sun, 13 Nov 2016 04:01:37 +0000 (23:01 -0500)]
runtime: do not print runtime panic frame at top of user stack

The expected default behavior (no explicit GOTRACEBACK setting)
is for the stack trace to start in user code, eliding unnecessary runtime
frames that led up to the actual trace printing code. The idea was that
the first line number printed was the one that crashed.

For #5832 we added code to show 'panic' frames so that if code panics
and then starts running defers and then we trace from there, the panic
frame can help explain why the code seems to have made a call not
present in the code. But that's only needed for panics between two different
call frames, not the panic at the very top of the stack trace.
Fix the fix to again elide the runtime code at the very top of the stack trace.

Simple panic:

package main

func main() {
var x []int
println(x[1])
}

Before this CL:

panic: runtime error: index out of range

goroutine 1 [running]:
panic(0x1056980, 0x1091bf0)
/Users/rsc/go/src/runtime/panic.go:531 +0x1cf
main.main()
/tmp/x.go:5 +0x5

After this CL:

panic: runtime error: index out of range

goroutine 1 [running]:
main.main()
/tmp/x.go:5 +0x5

Panic inside defer triggered by panic:

package main

func main() {
var x []int
defer func() {
println(x[1])
}()
println(x[2])
}

Before this CL:

panic: runtime error: index out of range
panic: runtime error: index out of range

goroutine 1 [running]:
panic(0x1056aa0, 0x1091bf0)
/Users/rsc/go/src/runtime/panic.go:531 +0x1cf
main.main.func1(0x0, 0x0, 0x0)
/tmp/y.go:6 +0x62
panic(0x1056aa0, 0x1091bf0)
/Users/rsc/go/src/runtime/panic.go:489 +0x2cf
main.main()
/tmp/y.go:8 +0x59

The middle panic is important: it explains why main.main ended up calling main.main.func1 on a line that looks like a call to println. The top panic is noise.

After this CL:

panic: runtime error: index out of range
panic: runtime error: index out of range

goroutine 1 [running]:
main.main.func1(0x0, 0x0, 0x0)
/tmp/y.go:6 +0x62
panic(0x1056ac0, 0x1091bf0)
/Users/rsc/go/src/runtime/panic.go:489 +0x2cf
main.main()
/tmp/y.go:8 +0x59

Fixes #17901.

Change-Id: Id6d7c76373f7a658a537a39ca32b7dc23e1e76aa
Reviewed-on: https://go-review.googlesource.com/33165
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agodoc: more go1.8.html content
Brad Fitzpatrick [Tue, 22 Nov 2016 15:24:13 +0000 (08:24 -0700)]
doc: more go1.8.html content

TBR=See https://golang.org/cl/33244 and review there.

Updates #17929

Change-Id: I37b49318a9203b16c0c788926039288b99a36ce5
Reviewed-on: https://go-review.googlesource.com/33450
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agoruntime/pprof: generate heap profiles in compressed proto format
Michael Matloob [Mon, 21 Nov 2016 17:10:07 +0000 (12:10 -0500)]
runtime/pprof: generate heap profiles in compressed proto format

When debug is 0, emit the compressed proto format.
The debug>0 format stays the same.

Updates #16093

Change-Id: I45aa1874a22d34cf44dd4aa78bbff9302381cb34
Reviewed-on: https://go-review.googlesource.com/33422
Run-TryBot: Michael Matloob <matloob@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

8 years agodoc: go1.8.html updates from Joe Tsai
Brad Fitzpatrick [Tue, 22 Nov 2016 12:24:07 +0000 (07:24 -0500)]
doc: go1.8.html updates from Joe Tsai

Updates #17929

Change-Id: Ibc711d39d9ff83458d213778117493796b678aa7
Reviewed-on: https://go-review.googlesource.com/33437
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agodoc: start of go1.8.html release notes
Brad Fitzpatrick [Tue, 15 Nov 2016 16:13:46 +0000 (08:13 -0800)]
doc: start of go1.8.html release notes

Updates #17929

Change-Id: Ie90736cfce3fc5f23cbe0a0f1971476705aac5f9
Reviewed-on: https://go-review.googlesource.com/33436
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agotime: make Parse validate day's lower bound in addition to upper bound
Brad Fitzpatrick [Tue, 22 Nov 2016 01:40:07 +0000 (01:40 +0000)]
time: make Parse validate day's lower bound in addition to upper bound

Day 0 is as invalid as day 32.

Fixes #17874

Change-Id: I52109d12bafd6d957d00c44d540cb88389fff0a7
Reviewed-on: https://go-review.googlesource.com/33429
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
8 years agonet/http: fix parallel tests using global DefaultTransport
Brad Fitzpatrick [Tue, 22 Nov 2016 02:07:52 +0000 (02:07 +0000)]
net/http: fix parallel tests using global DefaultTransport

When I added t.Parallel to some tests earlier, I overlooked some using
the global "Get" func, which uses DefaultTransport.

The DefaultTransport can have its CloseIdleConnections called by other
parallel tests. Use a private Transport instead.

Fixes #18006

Change-Id: Ia4faca5bac235cfa95dcf2703c25f3627112a5e9
Reviewed-on: https://go-review.googlesource.com/33432
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
8 years agoruntime: sleep a bit to let a bad signal be delivered
Ian Lance Taylor [Wed, 16 Nov 2016 05:15:40 +0000 (21:15 -0800)]
runtime: sleep a bit to let a bad signal be delivered

When we raise a signal that was delivered to C code, it's possible that
the kernel will not deliver it immediately. This is especially possible
on Darwin where we use send the signal to the entire process rather than
just the current thread. Sleep for a millisecond after sending the
signal to give it a chance to be delivered before we restore the Go
signal handler. In most real cases the program is going to crash at this
point, so sleeping is kind of irrelevant anyhow.

Fixes #14809.

Change-Id: Ib2c0d2c4e240977fb4535dc1dd2bdc50d430eb85
Reviewed-on: https://go-review.googlesource.com/33300
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
8 years agocmd/go: don't clobber `go env GOGCCFLAGS`
Ian Lance Taylor [Tue, 15 Nov 2016 22:48:54 +0000 (14:48 -0800)]
cmd/go: don't clobber `go env GOGCCFLAGS`

When CC is set in the environment, the mkEnv function sets its version
of CC to the first word $CC and sets GOGCCFLAGS to the remainder. That
worked since Go 1 but was broken accidentally by
https://golang.org/cl/6409, which changed the code such that `go env`
calls mkEnv twice. The second call to mkEnv would clobber GOGCCFLAGS
based on the value of CC set by the first call. Go back to the old
handling by only calling mkEnv once.

Fixes #15457.

Change-Id: I000a1ebcc48684667e48f2b9b24605867b9e06cd
Reviewed-on: https://go-review.googlesource.com/33293
Reviewed-by: Russ Cox <rsc@golang.org>
8 years agocmd/compile, cmd/link: weak relocation for ptrTo
David Crawshaw [Mon, 21 Nov 2016 21:58:55 +0000 (16:58 -0500)]
cmd/compile, cmd/link: weak relocation for ptrTo

Introduce R_WEAKADDROFF, a "weak" variation of the R_ADDROFF relocation
that will only reference the type described if it is in some other way
reachable.

Use this for the ptrToThis field in reflect type information where it
is safe to do so (that is, types that don't need to be included for
interface satisfaction, and types that won't cause the compiler to
recursively generate an endless series of ptr-to-ptr-to-ptr-to...
types).

Also fix a small bug in reflect, where StructOf was not clearing the
ptrToThis field of new types.

Fixes #17931

Change-Id: I4d3b53cb9c916c97b3b16e367794eee142247281
Reviewed-on: https://go-review.googlesource.com/33427
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
8 years agonet/http: skip TestLinuxSendfile on mips64 for now
Brad Fitzpatrick [Tue, 22 Nov 2016 01:43:38 +0000 (01:43 +0000)]
net/http: skip TestLinuxSendfile on mips64 for now

See issues for details. We can expand this test during the Go 1.9
cycle.

Updates #18008

Change-Id: I78b6b7e8dede414769be97898e29f969bc2a9651
Reviewed-on: https://go-review.googlesource.com/33430
Reviewed-by: Cherry Zhang <cherryyz@google.com>
8 years agomath/big: add Baillie-PSW test to (*Int).ProbablyPrime
Russ Cox [Mon, 10 Oct 2016 20:52:57 +0000 (16:52 -0400)]
math/big: add Baillie-PSW test to (*Int).ProbablyPrime

After x.ProbablyPrime(n) passes the n Miller-Rabin rounds,
add a Baillie-PSW test before declaring x probably prime.

Although the provable error bounds are unchanged, the empirical
error bounds drop dramatically: there are no known inputs
for which Baillie-PSW gives the wrong answer. For example,
before this CL, big.NewInt(443*1327).ProbablyPrime(1) == true.
Now it is (correctly) false.

The new Baillie-PSW test is two pieces: an added Miller-Rabin
round with base 2, and a so-called extra strong Lucas test.
(See the references listed in prime.go for more details.)
The Lucas test takes about 3.5x as long as the Miller-Rabin round,
which is close to theoretical expectations.

name                              time/op
ProbablyPrime/Lucas             2.91ms ± 2%
ProbablyPrime/MillerRabinBase2   850µs ± 1%
ProbablyPrime/n=0               3.75ms ± 3%

The speed of prime testing for a prime input does get slower:

name                  old time/op  new time/op   delta
ProbablyPrime/n=1    849µs ± 1%   4521µs ± 1%  +432.31%   (p=0.000 n=10+9)
ProbablyPrime/n=5   4.31ms ± 3%   7.87ms ± 1%   +82.70%  (p=0.000 n=10+10)
ProbablyPrime/n=10  8.52ms ± 3%  12.28ms ± 1%   +44.11%  (p=0.000 n=10+10)
ProbablyPrime/n=20  16.9ms ± 2%   21.4ms ± 2%   +26.35%   (p=0.000 n=9+10)

However, because the Baillie-PSW test is only added when the old
ProbablyPrime(n) would return true, testing composites runs at
the same speed as before, except in the case where the result
would have been incorrect and is now correct.

In particular, the most important use of this code is for
generating random primes in crypto/rand. That use spends
essentially all its time testing composites, so it is not
slowed down by the new Baillie-PSW check:

name                  old time/op  new time/op   delta
Prime                104ms ±22%    111ms ±16%      ~     (p=0.165 n=10+10)

Thanks to Serhat Şevki Dinçer for CL 20170, which this CL builds on.

Fixes #13229.

Change-Id: Id26dde9b012c7637c85f2e96355d029b6382812a
Reviewed-on: https://go-review.googlesource.com/30770
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
8 years agoruntime/internal/atomic: crash on unaligned 64-bit ops on 32-bit MIPS
Cherry Zhang [Mon, 21 Nov 2016 23:23:12 +0000 (18:23 -0500)]
runtime/internal/atomic: crash on unaligned 64-bit ops on 32-bit MIPS

This check was originally implemented by Vladimir in
https://go-review.googlesource.com/c/31489/1/src/runtime/internal/atomic/atomic_mipsx.go#30
but removed due to my comment (Sorry!). This CL adds it back.

Fixes #17786.

Change-Id: I7ff4c2539fc9e2afd8199964b587a8ccf093b896
Reviewed-on: https://go-review.googlesource.com/33431
Run-TryBot: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

8 years agocmd/dist: skip plugin tests on noopt builder for now
Brad Fitzpatrick [Mon, 21 Nov 2016 22:30:14 +0000 (22:30 +0000)]
cmd/dist: skip plugin tests on noopt builder for now

Updates #17937

Change-Id: Ic822da1786a983b3b7bca21b68c3d5fc4bdfaee2
Reviewed-on: https://go-review.googlesource.com/33428
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
8 years agobuild: fix cross-compile on Plan 9
Russ Cox [Fri, 11 Nov 2016 20:45:09 +0000 (15:45 -0500)]
build: fix cross-compile on Plan 9

In Plan 9's shell,

GOBIN= \
foo bar

is the same as

GOBIN=foo bar

Write what was meant, which is

GOBIN=() \
foo bar

Fixes #17737.

Change-Id: Ie5a1b51a7cec950b5e78bbbe99cbc3cfe102f980
Reviewed-on: https://go-review.googlesource.com/33144
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Quentin Smith <quentin@golang.org>
Reviewed-by: David du Colombier <0intro@gmail.com>
8 years agoencoding/json: document what happens to MarshalText's result
Russ Cox [Fri, 11 Nov 2016 16:06:32 +0000 (11:06 -0500)]
encoding/json: document what happens to MarshalText's result

Fixes #17743.

Change-Id: Ib5afb6248bb060f2ad8dd3d5f78e95271af62a57
Reviewed-on: https://go-review.googlesource.com/33135
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Quentin Smith <quentin@golang.org>
Reviewed-by: Caleb Spare <cespare@gmail.com>
8 years agocmd/go: skip slow tests on mips when run under builders
Brad Fitzpatrick [Mon, 21 Nov 2016 21:29:32 +0000 (21:29 +0000)]
cmd/go: skip slow tests on mips when run under builders

Change-Id: If754de6c44cf0ec4192101432e4065cc7a28e862
Reviewed-on: https://go-review.googlesource.com/33425
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>

8 years agonet/http: maybe fix TestLinuxSendfile on mips64
Brad Fitzpatrick [Mon, 21 Nov 2016 21:51:01 +0000 (21:51 +0000)]
net/http: maybe fix TestLinuxSendfile on mips64

Updates #18008

Change-Id: I8fde0d71d15b416db4d262f6db8ef32a209a192f
Reviewed-on: https://go-review.googlesource.com/33426
Reviewed-by: Ian Lance Taylor <iant@golang.org>
8 years agocmd/go: don't check standard packages when using gccgo
Ian Lance Taylor [Wed, 16 Nov 2016 00:15:05 +0000 (16:15 -0800)]
cmd/go: don't check standard packages when using gccgo

The gccgo compiler does not have the standard packages available, so it
can not check for violations of internal references.

Also, the gccgo compiler can not read runtime/internal/sys/zversion.go;
in fact, the file does not even exist for gccgo.

Change-Id: Ibadf16b371621ad1b87b6e858c5eb233913e179d
Reviewed-on: https://go-review.googlesource.com/33295
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agoarchive/zip: skip large concurrent tests in race mode
Brad Fitzpatrick [Mon, 21 Nov 2016 19:09:42 +0000 (19:09 +0000)]
archive/zip: skip large concurrent tests in race mode

We recently added these large zip64 tests. They're slow-ish already,
but fast enough in non-race mode with t.Parallel. But in race mode,
the concurrency makes them much slower than the normal
non-race-to-race multiplier.

They're taking so long now that it's causing test failures when it
sometimes is over the test timeout threshold.

Change-Id: I02f4ceaa9d6cab826708eb3860f47a57b05bdfee
Reviewed-on: https://go-review.googlesource.com/33423
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
8 years agonet/http: deflake TestClientTimeout
Brad Fitzpatrick [Mon, 21 Nov 2016 14:58:23 +0000 (14:58 +0000)]
net/http: deflake TestClientTimeout

Should fix flakes like:

https://build.golang.org/log/c8da331317064227f38d5ef57ed7dba563ba1b38

--- FAIL: TestClientTimeout_h1 (0.35s)
    client_test.go:1263: timeout after 200ms waiting for timeout of 100ms
FAIL

Change-Id: I0a4dba607524e8d7a00f498e27d9598acde5d222
Reviewed-on: https://go-review.googlesource.com/33420
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
8 years agoruntime/internal/atomic: crash on unaligned 64-bit ops on 386 and ARM
Cherry Zhang [Mon, 14 Nov 2016 15:17:23 +0000 (10:17 -0500)]
runtime/internal/atomic: crash on unaligned 64-bit ops on 386 and ARM

Updates #17786. Will fix mips(32) when the port is fully landed.

Change-Id: I00d4ff666ec14a38cadbcd52569b347bb5bc8b75
Reviewed-on: https://go-review.googlesource.com/33236
Run-TryBot: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agoruntime: make work.bytesMarked 8-byte aligned
Cherry Zhang [Mon, 14 Nov 2016 23:24:37 +0000 (18:24 -0500)]
runtime: make work.bytesMarked 8-byte aligned

Make atomic access on 32-bit architectures happy.

Updates #17786.

Change-Id: I42de63ff1381af42124dc51befc887160f71797d
Reviewed-on: https://go-review.googlesource.com/33235
Run-TryBot: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Austin Clements <austin@google.com>
8 years agoruntime/pprof: emit count profiles with debug=0 as proto profiles
Michael Matloob [Fri, 11 Nov 2016 20:01:58 +0000 (15:01 -0500)]
runtime/pprof: emit count profiles with debug=0 as proto profiles

count profiles with debug=1 retain their previous format.
Also add a test check for the proto profiles since all runtime/pprof
tests only look at the debug=1 profiles.

Change-Id: Ibe805585b597e5d3570807115940a1dc4535c03f
Reviewed-on: https://go-review.googlesource.com/33148
Run-TryBot: Michael Matloob <matloob@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
8 years agoruntime: wake idle Ps when enqueuing GC work
Austin Clements [Mon, 31 Oct 2016 00:43:53 +0000 (20:43 -0400)]
runtime: wake idle Ps when enqueuing GC work

If the scheduler has no user work and there's no GC work visible, it
puts the P to sleep (or blocks on the network). However, if we later
enqueue more GC work, there's currently nothing that specifically
wakes up the scheduler to let it start an idle GC worker. As a result,
we can underutilize the CPU during GC if Ps have been put to sleep.

Fix this by making GC wake idle Ps when work buffers are put on the
full list. We already have a hook to do this, since we use this to
preempt a random P if we need more dedicated workers. We expand this
hook to instead wake an idle P if there is one. The logic we use for
this is identical to the logic used to wake an idle P when we ready a
goroutine.

To make this really sound, we also fix the scheduler to re-check the
idle GC worker condition after releasing its P. This closes a race
where 1) the scheduler checks for idle work and finds none, 2) new
work is enqueued but there are no idle Ps so none are woken, and 3)
the scheduler releases its P.

There is one subtlety here. Currently we call enlistWorker directly
from putfull, but the gcWork is in an inconsistent state in the places
that call putfull. This isn't a problem right now because nothing that
enlistWorker does touches the gcWork, but with the added call to
wakep, it's possible to get a recursive call into the gcWork
(specifically, while write barriers are disallowed, this can do an
allocation, which can dispose a gcWork, which can put a workbuf). To
handle this, we lift the enlistWorker calls up a layer and delay them
until the gcWork is in a consistent state.

Fixes #14179.

Change-Id: Ia2467a52e54c9688c3c1752e1fc00f5b37bbfeeb
Reviewed-on: https://go-review.googlesource.com/32434
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
8 years agoruntime: exit idle worker if there's higher-priority work
Austin Clements [Mon, 31 Oct 2016 00:20:17 +0000 (20:20 -0400)]
runtime: exit idle worker if there's higher-priority work

Idle GC workers trigger whenever there's a GC running and the
scheduler doesn't find any other work. However, they currently run for
a full scheduler quantum (~10ms) once started.

This is really bad for event-driven applications, where work may come
in on the network hundreds of times during that window. In the
go-gcbench rpc benchmark, this is bad enough to often cause effective
STWs where all Ps are in the idle worker. When this happens, we don't
even poll the network any more (except for the background 10ms poll in
sysmon), so we don't even know there's more work to do.

Fix this by making idle workers check with the scheduler roughly every
100 µs to see if there's any higher-priority work the P should be
doing. This check includes polling the network for incoming work.

Fixes #16528.

Change-Id: I6f62ebf6d36a92368da9891bafbbfd609b9bd003
Reviewed-on: https://go-review.googlesource.com/32433
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rick Hudson <rlh@golang.org>
8 years agomisc/cgo/testcshared: add explicit ./ to shared library argument
Ian Lance Taylor [Sat, 19 Nov 2016 02:14:11 +0000 (18:14 -0800)]
misc/cgo/testcshared: add explicit ./ to shared library argument

Use an explicit ./ to make sure we link against the libgo.so we just
built, not some other libgo.so that the compiler or linker may decide to
seek out.

Fixes #17986.

Change-Id: Id23f6c95aa2b52f4f42c1b6dac45482c22b4290d
Reviewed-on: https://go-review.googlesource.com/33413
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agogo/internal/gccgoimporter: handle conversions in exported const values
Robert Griesemer [Fri, 18 Nov 2016 22:47:51 +0000 (14:47 -0800)]
go/internal/gccgoimporter: handle conversions in exported const values

Also: handle version "v2" of export data format.

Fixes #17981.

Change-Id: I8042ce18c4a27c70cc1ede675daca019b047bcf3
Reviewed-on: https://go-review.googlesource.com/33412
Reviewed-by: Ian Lance Taylor <iant@golang.org>
8 years agocmd/cover: handle multiple samples from the same location
Keith Randall [Mon, 6 Jun 2016 23:58:27 +0000 (16:58 -0700)]
cmd/cover: handle multiple samples from the same location

So we can merge cover profiles from multiple runs.

Change-Id: I1bf921e2b02063a2a62b35d21a6823062d10e5d0
Reviewed-on: https://go-review.googlesource.com/23831
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
8 years agospec: add subtitles to section on "for" statements
Robert Griesemer [Fri, 18 Nov 2016 18:49:29 +0000 (10:49 -0800)]
spec: add subtitles to section on "for" statements

This matches what we already do for switch statements and makes
this large section more visibly organized. No other changes besides
introducing the titles.

Fixes #4486.

Change-Id: I73f274e4fdd27c6cfeaed79090b4553e57a9c479
Reviewed-on: https://go-review.googlesource.com/33410
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
8 years agocmd/trace: fix goroutine view
Austin Clements [Fri, 4 Nov 2016 15:13:27 +0000 (11:13 -0400)]
cmd/trace: fix goroutine view

Currently, trace processing interleaves state/statistics updates and
emitting trace viewer objects. As a result, if events are being
filtered, either by time or by goroutines, we'll miss those
state/statistics updates. At best, this leads to bad statistics;
however, since we're now strictly checking G state transitions, it
usually leads to a failure to process the trace if there is any
filtering.

Fix this by separating state updates from emitting trace object. State
updates are done before filtering, so we always have correct state
information and statistics. Trace objects are only emitted if we pass
the filter. To determine when we need to emit trace counters, rather
than duplicating the knowledge of which events might modify
statistics, we keep track of the previously emitted counters and emit
a trace counter object whenever these have changed.

Fixes #17719.

Change-Id: Ic66e3ddaef60d1acaaf2ff4c62baa5352799cf99
Reviewed-on: https://go-review.googlesource.com/32810
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
8 years agospec: remove => (alias) operator from Operators and Delimiters section
Robert Griesemer [Fri, 18 Nov 2016 17:27:18 +0000 (09:27 -0800)]
spec: remove => (alias) operator from Operators and Delimiters section

(Revert of https://go-review.googlesource.com/#/c/32310/)

For #16339.
Fixes #17975.

Change-Id: I36062703c423a81ea1c5b00f4429a4faf00b3782
Reviewed-on: https://go-review.googlesource.com/33365
Reviewed-by: Ian Lance Taylor <iant@golang.org>
8 years agospec: clarify type elision rules for composite literals
Robert Griesemer [Fri, 18 Nov 2016 00:39:11 +0000 (16:39 -0800)]
spec: clarify type elision rules for composite literals

- organize examples better
- add an example illustrating behavior if element type is a named pointer type
- both compilers and go/types (per https://go-review.googlesource.com/33358)
  follow this now

See the issue for detailed discussion.

Fixes #17954.

Change-Id: I8d90507ff2347d9493813f75b73233819880d2b4
Reviewed-on: https://go-review.googlesource.com/33361
Reviewed-by: Rob Pike <r@golang.org>
8 years agocmd/compile: in cse, allow for new ssa values
Philip Hofer [Tue, 15 Nov 2016 01:05:46 +0000 (17:05 -0800)]
cmd/compile: in cse, allow for new ssa values

The table of rewrites in ssa/cse is not sized appropriately for
ssa IDs that are created during copying of selects into new blocks.

Fixes #17918

Change-Id: I65fe86c6aab5efa679aa473aadc4ee6ea882cd41
Reviewed-on: https://go-review.googlesource.com/33240
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

8 years agotext/template: handle option missingkey=error consistently
Özgür Kesim [Fri, 21 Oct 2016 11:14:57 +0000 (13:14 +0200)]
text/template: handle option missingkey=error consistently

The existing implementation of text/template handles the option
"missingkey=error" in an inconsitent manner:  If the provided data is
a nil-interface, no error is returned (despite the fact that no key
can be found in it).

This patch makes text/template return an error if "missingkey=error"
is set and the provided data is a not a valid reflect.Value.

Fixes #15356

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

8 years agocmd/compile: make a copy of Phi input if it is still live
Cherry Zhang [Sat, 29 Oct 2016 03:11:04 +0000 (23:11 -0400)]
cmd/compile: make a copy of Phi input if it is still live

Register of Phi input is allocated to the Phi. So if the Phi
input is still live after Phi, we may need to use a spill. In
this case, copy the Phi input to a spare register to avoid a
spill.

Originally targeted the code in issue #16187, and this CL
indeed removes the spill, but doesn't seem to help on benchmark
result. It may help in general, though.

On AMD64:
name                      old time/op    new time/op    delta
BinaryTree17-12              2.79s ± 1%     2.76s ± 0%  -1.33%  (p=0.000 n=10+10)
Fannkuch11-12                3.02s ± 0%     3.14s ± 0%  +3.99%  (p=0.000 n=10+10)
FmtFprintfEmpty-12          51.2ns ± 0%    51.4ns ± 3%    ~      (p=0.368 n=8+10)
FmtFprintfString-12          145ns ± 0%     144ns ± 0%  -0.69%    (p=0.000 n=6+9)
FmtFprintfInt-12             127ns ± 1%     124ns ± 1%  -2.79%   (p=0.000 n=10+9)
FmtFprintfIntInt-12          186ns ± 0%     184ns ± 0%  -1.34%   (p=0.000 n=10+9)
FmtFprintfPrefixedInt-12     196ns ± 0%     194ns ± 0%  -0.97%    (p=0.000 n=9+9)
FmtFprintfFloat-12           293ns ± 2%     287ns ± 0%  -2.00%   (p=0.000 n=10+9)
FmtManyArgs-12               847ns ± 1%     829ns ± 0%  -2.17%   (p=0.000 n=10+7)
GobDecode-12                7.17ms ± 0%    7.18ms ± 0%    ~     (p=0.123 n=10+10)
GobEncode-12                6.08ms ± 1%    6.08ms ± 0%    ~      (p=0.497 n=10+9)
Gzip-12                      277ms ± 1%     275ms ± 1%  -0.47%   (p=0.028 n=10+9)
Gunzip-12                   39.1ms ± 2%    38.2ms ± 1%  -2.20%   (p=0.000 n=10+9)
HTTPClientServer-12         90.9µs ± 4%    87.7µs ± 2%  -3.51%   (p=0.001 n=9+10)
JSONEncode-12               17.3ms ± 1%    16.5ms ± 0%  -5.02%    (p=0.000 n=9+9)
JSONDecode-12               54.6ms ± 1%    54.1ms ± 0%  -0.99%    (p=0.000 n=9+9)
Mandelbrot200-12            4.45ms ± 0%    4.45ms ± 0%  -0.02%    (p=0.006 n=8+9)
GoParse-12                  3.44ms ± 0%    3.48ms ± 1%  +0.95%  (p=0.000 n=10+10)
RegexpMatchEasy0_32-12      84.9ns ± 0%    85.0ns ± 0%    ~       (p=0.241 n=8+8)
RegexpMatchEasy0_1K-12       867ns ± 3%     915ns ±11%  +5.55%  (p=0.037 n=10+10)
RegexpMatchEasy1_32-12      82.7ns ± 5%    83.9ns ± 4%    ~      (p=0.161 n=9+10)
RegexpMatchEasy1_1K-12       361ns ± 1%     363ns ± 0%    ~      (p=0.098 n=10+8)
RegexpMatchMedium_32-12      126ns ± 0%     126ns ± 1%    ~      (p=0.549 n=8+10)
RegexpMatchMedium_1K-12     38.8µs ± 0%    39.1µs ± 0%  +0.67%    (p=0.000 n=9+8)
RegexpMatchHard_32-12       1.95µs ± 0%    1.96µs ± 0%  +0.43%    (p=0.000 n=9+9)
RegexpMatchHard_1K-12       59.0µs ± 0%    59.1µs ± 0%  +0.27%   (p=0.000 n=10+9)
Revcomp-12                   436ms ± 1%     431ms ± 1%  -1.19%  (p=0.005 n=10+10)
Template-12                 56.7ms ± 1%    57.1ms ± 1%  +0.71%   (p=0.001 n=10+9)
TimeParse-12                 312ns ± 0%     310ns ± 0%  -0.80%   (p=0.000 n=10+9)
TimeFormat-12                336ns ± 0%     332ns ± 0%  -1.19%    (p=0.000 n=8+7)
[Geo mean]                  59.2µs         58.9µs       -0.42%

On PPC64:
name                     old time/op    new time/op    delta
BinaryTree17-2              4.67s ± 2%     4.71s ± 1%    ~     (p=0.421 n=5+5)
Fannkuch11-2                3.92s ± 1%     3.94s ± 0%  +0.46%  (p=0.032 n=5+5)
FmtFprintfEmpty-2           122ns ± 0%     120ns ± 2%  -1.80%  (p=0.016 n=4+5)
FmtFprintfString-2          305ns ± 1%     299ns ± 1%  -1.84%  (p=0.008 n=5+5)
FmtFprintfInt-2             243ns ± 0%     241ns ± 1%  -0.66%  (p=0.016 n=4+5)
FmtFprintfIntInt-2          361ns ± 1%     356ns ± 1%  -1.49%  (p=0.016 n=5+5)
FmtFprintfPrefixedInt-2     355ns ± 1%     357ns ± 1%    ~     (p=0.333 n=5+5)
FmtFprintfFloat-2           502ns ± 2%     498ns ± 1%    ~     (p=0.151 n=5+5)
FmtManyArgs-2              1.55µs ± 2%    1.59µs ± 1%  +2.52%  (p=0.008 n=5+5)
GobDecode-2                13.0ms ± 1%    13.0ms ± 1%    ~     (p=0.841 n=5+5)
GobEncode-2                11.8ms ± 1%    11.8ms ± 1%    ~     (p=0.690 n=5+5)
Gzip-2                      499ms ± 1%     503ms ± 0%    ~     (p=0.421 n=5+5)
Gunzip-2                   86.5ms ± 0%    86.4ms ± 1%    ~     (p=0.841 n=5+5)
HTTPClientServer-2         68.2µs ± 2%    69.6µs ± 3%    ~     (p=0.151 n=5+5)
JSONEncode-2               39.0ms ± 1%    37.2ms ± 1%  -4.65%  (p=0.008 n=5+5)
JSONDecode-2                122ms ± 1%     126ms ± 1%  +2.63%  (p=0.008 n=5+5)
Mandelbrot200-2            6.08ms ± 1%    5.89ms ± 1%  -3.06%  (p=0.008 n=5+5)
GoParse-2                  5.95ms ± 2%    5.98ms ± 1%    ~     (p=0.421 n=5+5)
RegexpMatchEasy0_32-2       331ns ± 1%     328ns ± 1%    ~     (p=0.056 n=5+5)
RegexpMatchEasy0_1K-2      1.45µs ± 0%    1.47µs ± 0%  +1.13%  (p=0.008 n=5+5)
RegexpMatchEasy1_32-2       359ns ± 0%     353ns ± 0%  -1.84%  (p=0.008 n=5+5)
RegexpMatchEasy1_1K-2      1.79µs ± 0%    1.81µs ± 1%  +1.16%  (p=0.008 n=5+5)
RegexpMatchMedium_32-2      420ns ± 2%     413ns ± 0%  -1.72%  (p=0.008 n=5+5)
RegexpMatchMedium_1K-2     70.2µs ± 1%    69.5µs ± 1%  -1.09%  (p=0.032 n=5+5)
RegexpMatchHard_32-2       3.87µs ± 1%    3.65µs ± 0%  -5.86%  (p=0.008 n=5+5)
RegexpMatchHard_1K-2        111µs ± 0%     105µs ± 0%  -5.49%  (p=0.016 n=5+4)
Revcomp-2                   1.00s ± 1%     1.01s ± 2%    ~     (p=0.151 n=5+5)
Template-2                  113ms ± 1%     113ms ± 2%    ~     (p=0.841 n=5+5)
TimeParse-2                 555ns ± 0%     550ns ± 1%  -0.87%  (p=0.032 n=5+5)
TimeFormat-2                736ns ± 1%     704ns ± 1%  -4.35%  (p=0.008 n=5+5)
[Geo mean]                  120µs          119µs       -0.77%

Reduce "spilled value remains" by 0.6% in cmd/go on AMD64.

Change-Id: If655df343b0f30d1a49ab1ab644f10c698b96f3e
Reviewed-on: https://go-review.googlesource.com/32442
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
8 years agoruntime: handle SIGPIPE in c-archive and c-shared programs
Elias Naur [Sun, 6 Nov 2016 20:40:57 +0000 (21:40 +0100)]
runtime: handle SIGPIPE in c-archive and c-shared programs

Before this CL, Go programs in c-archive or c-shared buildmodes
would not handle SIGPIPE. That leads to surprising behaviour where
writes on a closed pipe or socket would raise SIGPIPE and terminate
the program. This CL changes the Go runtime to handle
SIGPIPE regardless of buildmode. In addition, SIGPIPE from non-Go
code is forwarded.

Fixes #17393
Updates #16760

Change-Id: I155e82020a03a5cdc627a147c27da395662c3fe8
Reviewed-on: https://go-review.googlesource.com/32796
Run-TryBot: Elias Naur <elias.naur@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
8 years agogo/types: look at underlying type of element type of composite literals with elided...
Robert Griesemer [Thu, 17 Nov 2016 21:35:59 +0000 (13:35 -0800)]
go/types: look at underlying type of element type of composite literals with elided types

Match behavior of gc and gccgo.

For #17954.

Change-Id: I3f065e56d0a623bd7642c1438d0cab94d23fa2ae
Reviewed-on: https://go-review.googlesource.com/33358
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
8 years agocrypto/tls: reject zero-length SCTs.
Adam Langley [Thu, 17 Nov 2016 20:15:19 +0000 (12:15 -0800)]
crypto/tls: reject zero-length SCTs.

The SignedCertificateTimestampList[1] specifies that both the list and
each element must not be empty. Checking that the list is not empty was
handled in [2] and this change checks that the SCTs themselves are not
zero-length.

[1] https://tools.ietf.org/html/rfc6962#section-3.3
[2] https://golang.org/cl/33265

Change-Id: Iabaae7a15f6d111eb079e5086e0bd2005fae9e48
Reviewed-on: https://go-review.googlesource.com/33355
Run-TryBot: Adam Langley <agl@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agocrypto/tls: reject CT extension with no SCTs included
woodsaj [Thu, 17 Nov 2016 12:14:32 +0000 (20:14 +0800)]
crypto/tls: reject CT extension with no SCTs included

When the CT extension is enabled but no SCTs are present, the existing
code calls "continue" which causes resizing the data byte slice to be
skipped. In fact, such extensions should be rejected.

Fixes #17958

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

8 years agoruntime/pprof/internal/protopprof: fix TestTranslateCPUProfileWithSamples test for...
Vladimir Stefanovic [Thu, 17 Nov 2016 19:06:27 +0000 (20:06 +0100)]
runtime/pprof/internal/protopprof: fix TestTranslateCPUProfileWithSamples test for mips

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

8 years agoruntime: improve diagnostics for "scan missed a g"
Austin Clements [Thu, 17 Nov 2016 15:48:40 +0000 (10:48 -0500)]
runtime: improve diagnostics for "scan missed a g"

Currently there are no diagnostics for mark root check during marking.
Fix this by printing out the same diagnostics we print during mark
termination.

Also, drop the allglock before throwing. Holding that across a throw
causes a self-deadlock with tracebackothers.

For #16083.

Change-Id: Ib605f3ae0c17e70704b31d8378274cfaa2307dc2
Reviewed-on: https://go-review.googlesource.com/33339
Reviewed-by: Rick Hudson <rlh@golang.org>
8 years agocmd/cgo: ignore top-level qualifiers in function args/results
Ian Lance Taylor [Wed, 16 Nov 2016 17:55:24 +0000 (09:55 -0800)]
cmd/cgo: ignore top-level qualifiers in function args/results

The top-level qualifiers are unimportant for our purposes. If a C
function is defined as `const int f(const int i)`, the `const`s are
meaningless to C, and we want to avoid using them in the struct we
create where the `const` has a completely different meaning.

This unwinds https://golang.org/cl/33097 with regard to top-level
qualifiers.

Change-Id: I3d66b0eb43b6d9a586d9cdedfae5a2306b46d96c
Reviewed-on: https://go-review.googlesource.com/33325
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
8 years agoarchive/zip: avoid overflow in record count and byte offset fields
Brad Fitzpatrick [Tue, 15 Nov 2016 19:33:10 +0000 (11:33 -0800)]
archive/zip: avoid overflow in record count and byte offset fields

This is Quentin's https://golang.org/cl/33012 with updated tests.

Fixes #14186

Change-Id: Ib51deaab0368c6bad32ce9d6345119ff44f3c2d6
Reviewed-on: https://go-review.googlesource.com/33291
Reviewed-by: Quentin Smith <quentin@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

8 years agodatabase/sql: ensure all driver Stmt are closed once
Daniel Theophanes [Thu, 17 Nov 2016 17:33:31 +0000 (09:33 -0800)]
database/sql: ensure all driver Stmt are closed once

Previously  driver.Stmt could could be closed multiple times in
edge cases that drivers may not test for initially. Make their
job easier by ensuring the driver is only closed a single time.

Fixes #16019

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

8 years agocmd/asm/internal/asm: fix copy/paste errors in comment
Michael Munday [Thu, 17 Nov 2016 17:26:36 +0000 (12:26 -0500)]
cmd/asm/internal/asm: fix copy/paste errors in comment

Change-Id: I0249b60e340710bea7b6671c9b7405c278b037bd
Reviewed-on: https://go-review.googlesource.com/33351
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agoruntime/pprof: fix typo in test
Brad Fitzpatrick [Thu, 17 Nov 2016 16:28:45 +0000 (16:28 +0000)]
runtime/pprof: fix typo in test

Not sure what I was thinking.

Change-Id: I143cdf7c5ef8e7b2394afeca6b30c46bb2c19a55
Reviewed-on: https://go-review.googlesource.com/33340
Reviewed-by: Ian Lance Taylor <iant@golang.org>
8 years agomisc/cgo: decrease test failure timeouts
Elias Naur [Thu, 17 Nov 2016 12:52:00 +0000 (13:52 +0100)]
misc/cgo: decrease test failure timeouts

CL 33239 changed the polling loops from using sched_yield to a sleep
for 1/1000 of a second. The loop counters were not updated, so failing
tests now take 100 seconds to complete. Lower the loop counts to 5
seconds instead.

Change-Id: I7c9a343dacc8188603ecf7e58bd00b535cfc87f5
Reviewed-on: https://go-review.googlesource.com/33280
Run-TryBot: Elias Naur <elias.naur@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
8 years agonet: use testenv.SkipFlaky instead of testing.Skip
Mikio Hara [Thu, 17 Nov 2016 06:41:18 +0000 (15:41 +0900)]
net: use testenv.SkipFlaky instead of testing.Skip

Change-Id: Ic219fedbe6bbb846f31111fa21df6f2b8620e269
Reviewed-on: https://go-review.googlesource.com/33263
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agofmt: fix typo
Brad Fitzpatrick [Thu, 17 Nov 2016 14:39:11 +0000 (14:39 +0000)]
fmt: fix typo

Fixes #17955

Change-Id: Ia1a04796353c83358a38a6b63f2a0cd3c6926f09
Reviewed-on: https://go-review.googlesource.com/33338
Reviewed-by: Rob Pike <r@golang.org>
8 years agodebug/pe: do not create symbol table if FileHeader.PointerToSymbolTable is 0
Alex Brainman [Sat, 12 Nov 2016 06:57:35 +0000 (17:57 +1100)]
debug/pe: do not create symbol table if FileHeader.PointerToSymbolTable is 0

https://github.com/tpn/pdfs/raw/master/Microsoft Portable Executable and Common Object File Format Specification - 1999 (pecoff).doc
says this about PointerToSymbolTable:

File offset of the COFF symbol table or 0 if none is present.

Do as it says.

Fixes #17809.

Change-Id: Ib1ad83532f36a3e56c7e058dc9b2acfbf60c4e72
Reviewed-on: https://go-review.googlesource.com/33170
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

8 years agoos: add more tests in TestReadStdin
Alex Brainman [Thu, 10 Nov 2016 02:00:35 +0000 (13:00 +1100)]
os: add more tests in TestReadStdin

TestReadStdin always fill up buffer provided by ReadFile caller full.
But we do not know if real ReadFile does the same. Add tests where
buffer is only filled with limited data.

Change-Id: I0fc776325c2b1fe60511126c439f4b0560e9d653
Reviewed-on: https://go-review.googlesource.com/33030
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

8 years agonet: tweak comment on ExampleCIDRMask
Mikio Hara [Thu, 17 Nov 2016 03:18:39 +0000 (12:18 +0900)]
net: tweak comment on ExampleCIDRMask

CIDRMask just returns a mask which corresponds to an address
prefix in CIDR nonation. A subnet for an IPv6 mask sounds a bit
confusing.

Change-Id: Ic7859ce992bc2de4043d3b25caf9a1051d118b0e
Reviewed-on: https://go-review.googlesource.com/33262
Reviewed-by: Ian Lance Taylor <iant@golang.org>
8 years agoruntime: handle bad ftab index in symtab.go
Lynn Boger [Wed, 9 Nov 2016 15:09:37 +0000 (09:09 -0600)]
runtime: handle bad ftab index in symtab.go

If a program has had its text section split into multiple
sections then the ftab that is built is based on addresses
prior to splitting.  That means all the function addresses
are there and correct because of relocation but the
but the computed idx won't always match up quite right and
in some cases go beyond the end of the table, causing a panic.

To resolve this, determine if the idx is too large and if it is,
set it to the last index in ftab.  Then search backward to find the
matching function address.

Fixes #17854

Change-Id: I6940e76a5238727b0a9ac23dc80000996db2579a
Reviewed-on: https://go-review.googlesource.com/32972
Reviewed-by: David Chase <drchase@google.com>
8 years agocrypto/tls: add example for Config KeyLogWriter
Joonas Kuorilehto [Sun, 11 Sep 2016 19:31:19 +0000 (22:31 +0300)]
crypto/tls: add example for Config KeyLogWriter

For #13057.

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

8 years agocmd/compile, reflect: use field pkgPath if needed
Ian Lance Taylor [Thu, 17 Nov 2016 00:13:22 +0000 (16:13 -0800)]
cmd/compile, reflect: use field pkgPath if needed

It's possible for the pkgPath of a field to be different than that of
the struct type as a whole. In that case, store the field's pkgPath in
the name field. Use the field's pkgPath when setting PkgPath and when
checking for type identity.

Fixes #17952.

Change-Id: Iebaf92f0054b11427c8f6e4158c3bebcfff06f45
Reviewed-on: https://go-review.googlesource.com/33333
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
8 years agodoc: add FAQ: why no conversion from []T1 to []T2?
Ian Lance Taylor [Wed, 16 Nov 2016 19:23:53 +0000 (11:23 -0800)]
doc: add FAQ: why no conversion from []T1 to []T2?

Fixes #16934.

Change-Id: I725704e4c4aae7023fd89edc42af7ba0d242fec8
Reviewed-on: https://go-review.googlesource.com/33327
Reviewed-by: Rob Pike <r@golang.org>
8 years agonet/http: deflake TestInterruptWithPanic_nil_h2, again
Brad Fitzpatrick [Wed, 16 Nov 2016 23:41:15 +0000 (23:41 +0000)]
net/http: deflake TestInterruptWithPanic_nil_h2, again

Updates #17243

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

8 years agocmd/cover: don't ignore os.Create error
Daniel Martí [Wed, 16 Nov 2016 22:39:25 +0000 (22:39 +0000)]
cmd/cover: don't ignore os.Create error

Failing to create the output file would give confusing errors such as:

cover: invalid argument

Also do out.Close() even if Execute() errored.

Fixes #17951.

Change-Id: I897e1d31f7996871c54fde7cb09614cafbf6c3fc
Reviewed-on: https://go-review.googlesource.com/33278
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>

8 years agodatabase/sql: additional underlying types in DefaultValueConverter
Scott Bell [Wed, 18 May 2016 16:56:51 +0000 (09:56 -0700)]
database/sql: additional underlying types in DefaultValueConverter

The previous documentation purported to convert underlying strings to
[]byte, which it did not do. This adds support for underlying bool,
string, and []byte, which convert directly to their underlying type.

Fixes #15174.

Change-Id: I7fc4e2520577f097a48f39c9ff6c8160fdfb7be4
Reviewed-on: https://go-review.googlesource.com/27812
Reviewed-by: Daniel Theophanes <kardianos@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>

8 years agonet: add example for CIDRMask
Kevin Burke [Thu, 3 Nov 2016 22:34:05 +0000 (15:34 -0700)]
net: add example for CIDRMask

I had trouble translating the documentation language into a subnet
- e.g. whether /31 was CIDRMask(1, 31) or CIDRMask(1, 32) or
CIDRMask(31, 32) so I thought I'd add a short example showing how to
create the right masks.

Change-Id: Ia6a6de08c5c30b6d2249b3194cced2d3c383e317
Reviewed-on: https://go-review.googlesource.com/32677
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

8 years agoruntime/cgo: fixes for calling sigaction in C
Ian Lance Taylor [Wed, 16 Nov 2016 21:51:32 +0000 (13:51 -0800)]
runtime/cgo: fixes for calling sigaction in C

Zero out the sigaction structs, in case the sa_restorer field is set.

Clear the SA_RESTORER flag; it is part of the kernel interface, not the
libc interface.

Fixes #17947.

Change-Id: I610348ce3c196d3761cf2170f06c24ecc3507cf7
Reviewed-on: https://go-review.googlesource.com/33331
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
8 years agonet: disable TestAcceptTimeout for now
Brad Fitzpatrick [Wed, 16 Nov 2016 20:35:02 +0000 (20:35 +0000)]
net: disable TestAcceptTimeout for now

It's too flaky and doing more harm than good.

Disable it until it can be made reliable.

Updates #17948
Updates #17927

Change-Id: Iaab7f09a4060da377fcd3ca2262527fef50c558d
Reviewed-on: https://go-review.googlesource.com/33330
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agodatabase/sql: guard against driver.Stmt.Close panics
Daniel Theophanes [Wed, 16 Nov 2016 19:33:38 +0000 (11:33 -0800)]
database/sql: guard against driver.Stmt.Close panics

Do not retain a lock when driver.Stmt.Close panic as the rest
of the sql package ensures.

Updates #16019

Change-Id: Idc7ea9258ae23f491e79cce3efc365684a708428
Reviewed-on: https://go-review.googlesource.com/33328
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agonet: deflake TestAcceptTimeout again
Mikio Hara [Wed, 16 Nov 2016 21:06:34 +0000 (06:06 +0900)]
net: deflake TestAcceptTimeout again

This is a followup to CL 33257.

It looks like active close operation at passive open side sometimes
takes a bit long time on Darwin.

Fixes #17948.

Change-Id: Ida17639c4e66a43e1be1f74fd0ef3baddde25092
Reviewed-on: https://go-review.googlesource.com/33258
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
8 years agocmd/compile: ensure necessary types appear in .debug_info
David Chase [Mon, 14 Nov 2016 23:00:17 +0000 (18:00 -0500)]
cmd/compile: ensure necessary types appear in .debug_info

Autotmp filtering was too aggressive and excluded types
necessary to make debuggers work properly.  Restore the
"late filter" in dwarf.go based on names to exclude autotmps,
and remove the "early filter" in pgen.go based on how the
name was introduced.  However, the updated naming scheme
with a dot prefix is retained to prevent accidental clashes
with legal Go identifier names.

Includes test (grouped with runtime gdb tests),
verified to fail without the fix.

Updates #17644.
Fixes #17830.

Change-Id: I7ec3f7230083889660236e5f6bc77ba5fe434e93
Reviewed-on: https://go-review.googlesource.com/33233
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
8 years agocmd/internal/obj/arm64: fix branch too far for CBZ (and like)
Cherry Zhang [Wed, 16 Nov 2016 15:43:54 +0000 (10:43 -0500)]
cmd/internal/obj/arm64: fix branch too far for CBZ (and like)

The assembler backend fixes too-far conditional branches, but only
for BEQ and like. Add a case for CBZ and like.

Fixes #17925.

Change-Id: Ie516e6c5ca165b582367283a0110f7081e00c214
Reviewed-on: https://go-review.googlesource.com/33304
Run-TryBot: Cherry Zhang <cherryyz@google.com>
Reviewed-by: David Chase <drchase@google.com>
8 years agoruntime/pprof: skip profiling tests on mips if highres timers not available
Brad Fitzpatrick [Wed, 16 Nov 2016 16:27:27 +0000 (16:27 +0000)]
runtime/pprof: skip profiling tests on mips if highres timers not available

Fixes #17936

Change-Id: I20d09712b7d7303257994356904052ba64bc5bf2
Reviewed-on: https://go-review.googlesource.com/33306
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
8 years agonet: deflake TestAcceptTimeout
Mikio Hara [Wed, 16 Nov 2016 07:34:02 +0000 (16:34 +0900)]
net: deflake TestAcceptTimeout

This change makes use of synchronization primitive instead of
context-based canceling not to depend on defer execution scheduling.

Fixes #17927.

Change-Id: I5ca9287a48bb5cdda6845a7f12757f95175c5db8
Reviewed-on: https://go-review.googlesource.com/33257
Reviewed-by: Ian Lance Taylor <iant@golang.org>
8 years agomath/rand: make floating point tests shorter on mips and mipsle
Brad Fitzpatrick [Wed, 16 Nov 2016 19:08:25 +0000 (19:08 +0000)]
math/rand: make floating point tests shorter on mips and mipsle

Like GOARM=5 does.

Fixes #17944

Change-Id: Ica2a54a90fbd4a29471d1c6009ace2fcc5e82a73
Reviewed-on: https://go-review.googlesource.com/33326
Reviewed-by: Cherry Zhang <cherryyz@google.com>
8 years agoall: call flag.Parse from TestMain only if used
Daniel Martí [Wed, 16 Nov 2016 15:26:41 +0000 (15:26 +0000)]
all: call flag.Parse from TestMain only if used

These don't use any flags in TestMain itself, so the call is redundant
as M.Run will do it.

Change-Id: I00f2ac7f846dc2c3ad3535eb8177616b2d900149
Reviewed-on: https://go-review.googlesource.com/33275
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

8 years agocmd/link: handle R_GOTPCREL separately on darwin
David Crawshaw [Mon, 14 Nov 2016 02:20:58 +0000 (21:20 -0500)]
cmd/link: handle R_GOTPCREL separately on darwin

To generate the correct section offset the shared code path for
R_CALL, R_PCREL, and R_GOTPCREL on darwin when externally linking
walks up the symbol heirarchy adding the differences. This is fine,
except in the case where we are generating a GOT lookup, because
the topmost symbol is left in r.Xsym instead of the symbol we are
looking up. So all funcsym GOT lookups were looking up the outer
"go.func.*" symbol.

Fix this by separating out the R_GOTPCREL code path.

For #17828 (and may fix it).

Change-Id: I2c9f4d135e77c17270aa064d8c876dc6d485d659
Reviewed-on: https://go-review.googlesource.com/33211
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
8 years agodatabase/sql: clarify when statement in transaction is closed
Ian Lance Taylor [Wed, 16 Nov 2016 01:14:13 +0000 (17:14 -0800)]
database/sql: clarify when statement in transaction is closed

Fixes #16346.

Change-Id: Ie75a4ae7011036dd2c1f121a7a5e38d10177721e
Reviewed-on: https://go-review.googlesource.com/33296
Reviewed-by: Daniel Theophanes <kardianos@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agocmd/compile: remove some unused code
Daniel Martí [Wed, 16 Nov 2016 14:28:12 +0000 (14:28 +0000)]
cmd/compile: remove some unused code

The use of these has been removed in recent commits.

Change-Id: Iff36a3ee4dcdfe39c40e93e2601f44d3c59f7024
Reviewed-on: https://go-review.googlesource.com/33274
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agonet: don't run TestTCPBig unconditionally
Mikio Hara [Wed, 16 Nov 2016 04:35:59 +0000 (13:35 +0900)]
net: don't run TestTCPBig unconditionally

The test requires tons of memory and results various failures, mainly
runtime errors and process termination by SIGKILL, caused by resource
exhaustion when the node under test doesn't have much resources.

This change makes use of -tcpbig flag to enable the test.

Change-Id: Id53fa5d88543e2e60ca9bb4f55a1914ccca844e1
Reviewed-on: https://go-review.googlesource.com/33254
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

8 years agoruntime/cgo: use libc for sigaction syscalls when possible
Bryan C. Mills [Wed, 9 Nov 2016 20:28:24 +0000 (15:28 -0500)]
runtime/cgo: use libc for sigaction syscalls when possible

This ensures that runtime's signal handlers pass through the TSAN and
MSAN libc interceptors and subsequent calls to the intercepted
sigaction function from C will correctly see them.

Fixes #17753.

Change-Id: I9798bb50291a4b8fa20caa39c02a4465ec40bb8d
Reviewed-on: https://go-review.googlesource.com/33142
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

8 years agonet/http: fix a typo in test
Mikio Hara [Wed, 16 Nov 2016 04:51:45 +0000 (13:51 +0900)]
net/http: fix a typo in test

Change-Id: I897237667ffe9e9b2a5f92251a6f665d29479fd2
Reviewed-on: https://go-review.googlesource.com/33255
Reviewed-by: Ian Lance Taylor <iant@golang.org>
8 years agoos/exec: add closeOnce.WriteString method
Ian Lance Taylor [Wed, 16 Nov 2016 01:55:28 +0000 (17:55 -0800)]
os/exec: add closeOnce.WriteString method

Add an explicit WriteString method to closeOnce that acquires the
writers lock.  This overrides the one promoted from the
embedded *os.File field.  The promoted one naturally does not acquire
the lock, and can therefore race with the Close method.

Fixes #17647.

Change-Id: I3460f2a0d503449481cfb2fd4628b4855ab0ecdf
Reviewed-on: https://go-review.googlesource.com/33298
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agoapi, doc: update go1.8.txt and next.txt
Brad Fitzpatrick [Wed, 16 Nov 2016 01:16:15 +0000 (20:16 -0500)]
api, doc: update go1.8.txt and next.txt

Both automated updates with a few tweaks.

Change-Id: I24579a8dcc32a84a4fff5c2212681ef30dda61d1
Reviewed-on: https://go-review.googlesource.com/33297
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agoruntime: add support files for linux/mips{,le} port
Vladimir Stefanovic [Tue, 18 Oct 2016 21:51:01 +0000 (23:51 +0200)]
runtime: add support files for linux/mips{,le} port

Only exe buildmode without cgo supported.

Change-Id: Id104a79a99d3285c04db00fd98b8affa94ea3c37
Reviewed-on: https://go-review.googlesource.com/31487
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
8 years agotest: add test case that failed when built with gccgo
Ian Lance Taylor [Tue, 15 Nov 2016 20:41:33 +0000 (12:41 -0800)]
test: add test case that failed when built with gccgo

Change-Id: Ie7512cc27436cde53b58686b32a0389849a365e4
Reviewed-on: https://go-review.googlesource.com/33249
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agosyscall: define bind flags on Plan 9
David du Colombier [Tue, 15 Nov 2016 15:33:22 +0000 (16:33 +0100)]
syscall: define bind flags on Plan 9

These bind flags were removed by mistake in CL 2167.

Fixes #17921.

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

8 years agocmd/cgo: add missing period in comment
Ian Lance Taylor [Mon, 14 Nov 2016 23:51:30 +0000 (15:51 -0800)]
cmd/cgo: add missing period in comment

Change-Id: I05f31938f3736100bd8b20a150c9fe3a6ffcdeae
Reviewed-on: https://go-review.googlesource.com/33245
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agocmd/cgo: run cgo pointer checks for pointer to union
Ian Lance Taylor [Mon, 14 Nov 2016 23:51:30 +0000 (15:51 -0800)]
cmd/cgo: run cgo pointer checks for pointer to union

If a C union type (or a C++ class type) can contain a pointer field,
then run the cgo checks on pointers to that type. This will test the
pointer as though it were an unsafe.Pointer, and will crash if it points
to Go memory that contains a pointer.

Fixes #15942.

Change-Id: Ic2d07ed9648d4b27078ae7683e26196bcbc59fc9
Reviewed-on: https://go-review.googlesource.com/33237
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agocmd/go: use build ID as plugin symbol prefix
David Crawshaw [Sat, 12 Nov 2016 11:50:24 +0000 (06:50 -0500)]
cmd/go: use build ID as plugin symbol prefix

Updates #17821

Change-Id: Iebd2e88b2d4f3d757ffad72456f4bfc0607d8110
Reviewed-on: https://go-review.googlesource.com/33162
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
8 years agocmd/link, runtime, plugin: versioning
David Crawshaw [Sat, 12 Nov 2016 11:24:36 +0000 (06:24 -0500)]
cmd/link, runtime, plugin: versioning

In plugins and every program that opens a plugin, include a hash of
every imported package.

There are two versions of each hash: one local and one exported.
As the program starts and plugins are loaded, the first exported
symbol for each package becomes the canonical version.

Any subsequent plugin's local package hash symbol has to match the
canonical version.

Fixes #17832

Change-Id: I4e62c8e1729d322e14b1673bada40fa7a74ea8bc
Reviewed-on: https://go-review.googlesource.com/33161
Reviewed-by: Ian Lance Taylor <iant@golang.org>
8 years agoall: don't call t.Fatal from a goroutine
Ian Lance Taylor [Tue, 15 Nov 2016 05:34:58 +0000 (21:34 -0800)]
all: don't call t.Fatal from a goroutine

Fixes #17900.

Change-Id: I42cda6ac9cf48ed739d3a015a90b3cb15edf8ddf
Reviewed-on: https://go-review.googlesource.com/33243
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agonet: add test that TCP Close unblocks blocked Reads
Brad Fitzpatrick [Tue, 15 Nov 2016 03:31:47 +0000 (03:31 +0000)]
net: add test that TCP Close unblocks blocked Reads

I guess this was fixed at some point. Remove a skipped test in
net/http and add an explicit test in net.

Fixes #17695

Change-Id: Idb9f3e236b726bb45098474b830c95c1fce57529
Reviewed-on: https://go-review.googlesource.com/33242
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
8 years agomisc/cgo/testcarchive, misc/cgo/testcshared: sleep instead of sched_yield
Ian Lance Taylor [Tue, 15 Nov 2016 00:50:15 +0000 (16:50 -0800)]
misc/cgo/testcarchive, misc/cgo/testcshared: sleep instead of sched_yield

Apparently when GOMAXPROCS == 1 a simple sched_yield in a tight loop is
not necessarily sufficient to permit a signal handler to run. Instead,
sleep for 1/1000 of a second.

Fixes #16649.

Change-Id: I83910144228556e742b7a92a441732ef61aa49d9
Reviewed-on: https://go-review.googlesource.com/33239
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agohtml/template: fix multiple Clones of redefined template
Caleb Spare [Mon, 14 Nov 2016 02:06:16 +0000 (18:06 -0800)]
html/template: fix multiple Clones of redefined template

This change redoes the fix for #16101 (CL 31092) in a different way by
making t.Clone return the template associated with the t.Name() while
allowing for the case that a template of the same name is define-d.

Fixes #17735.

Change-Id: I1e69672390a4c81aa611046a209008ae4a3bb723
Reviewed-on: https://go-review.googlesource.com/33210
Run-TryBot: Caleb Spare <cespare@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rob Pike <r@golang.org>