]> Cypherpunks repositories - gostls13.git/log
gostls13.git
9 years agoruntime: correct implementation of raiseproc on Solaris
Ian Lance Taylor [Mon, 27 Jul 2015 17:41:41 +0000 (10:41 -0700)]
runtime: correct implementation of raiseproc on Solaris

I forgot that the libc raise function only sends the signal to the
current thread.  We need to actually use kill and getpid here, as we
do on other systems.

Change-Id: Iac34af822c93468bf68cab8879db3ee20891caaf
Reviewed-on: https://go-review.googlesource.com/12704
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agonet/http: disable new flaky TestTransportCancelBeforeResponseHeaders test
Brad Fitzpatrick [Mon, 27 Jul 2015 22:01:16 +0000 (00:01 +0200)]
net/http: disable new flaky TestTransportCancelBeforeResponseHeaders test

I'll rewrite this later. It's apparently dependent on scheduling order.
The earlier fix in git rev 9d56c181 seems fine, though.

Update #11894

Change-Id: I7c150918af4be079c262a5f2933ef4639cc535ef
Reviewed-on: https://go-review.googlesource.com/12731
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
9 years agonet: Set finalDeadline from TestDialParallel to avoid leaked sockets.
Paul Marks [Mon, 27 Jul 2015 21:39:32 +0000 (14:39 -0700)]
net: Set finalDeadline from TestDialParallel to avoid leaked sockets.

I've also changed TestDialSerialAsyncSpuriousConnection for consistency,
although it always computes a finalDeadline of zero.

Note that #11225 is the root cause of the socket leak; this just hides
it from the unit test by restoring the shorter timeout.

Fixes #11878

Change-Id: Ie0037dd3bce6cc81d196765375489f8c61be74c2
Reviewed-on: https://go-review.googlesource.com/12712
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Paul Marks <pmarks@google.com>

9 years agocmd/go: prefer <meta> tags on launchpad.net to the hard-coded logic
Russ Cox [Tue, 14 Jul 2015 06:04:21 +0000 (02:04 -0400)]
cmd/go: prefer <meta> tags on launchpad.net to the hard-coded logic

Fixes #11436.

Change-Id: I5c4455e9b13b478838f23ac31e6343672dfc60af
Reviewed-on: https://go-review.googlesource.com/12143
Reviewed-by: Michael Hudson-Doyle <michael.hudson@canonical.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agocmd/go: import runtime/cgo into darwin/arm64 tests
David Crawshaw [Mon, 27 Jul 2015 22:02:45 +0000 (18:02 -0400)]
cmd/go: import runtime/cgo into darwin/arm64 tests

Until cl/12721 and cl/12574, all standard library tests included
runtime/cgo on darwin/arm64 by virtue of package os including it. Now
that is no longer true, runtime/cgo needs to be added by the go tool
just as it is for darwin/arm. (This installs the Mach exception
handler used to properly handle EXC_BAD_ACCESS.)

Fixes #11901

Change-Id: I991525f46eca5b0750b93595579ebc0ff10e47eb
Reviewed-on: https://go-review.googlesource.com/12723
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agoencoding/json: take new decoder code off Decode path completely
Russ Cox [Tue, 28 Jul 2015 02:38:17 +0000 (22:38 -0400)]
encoding/json: take new decoder code off Decode path completely

The new Token API is meant to sit on the side of the Decoder,
so that you only get the new code (and any latent bugs in it)
if you are actively using the Token API.

The unconditional use of dec.peek in dec.tokenPrepareForDecode
violates that intention.

Change tokenPrepareForDecode not to call dec.peek unless needed
(because the Token API has advanced the state).
This restores the old code path behavior, no peeking allowed.

I checked by patching in the new tests from CL 12726 that
this change suffices to "fix" the error handling bug in dec.peek.
Obviously that bug should be fixed too, but the point is that
with this CL, bugs in dec.peek do not affect plain use of Decode
or Unmarshal.

I also checked by putting a panic in dec.peek that the only
tests that now invoke peek are:

TestDecodeInStream
ExampleDecoder_Token
ExampleDecoder_Decode_stream

and those tests all invoke dec.Token directly.

Change-Id: I0b242d0cb54a9c830548644670dc5ab5ccef69f2
Reviewed-on: https://go-review.googlesource.com/12740
Reviewed-by: Andrew Gerrand <adg@golang.org>
Reviewed-by: Peter Waldschmidt <peter@waldschmidt.com>
9 years agoencoding/json: fix EOF bug decoding HTTP stream
Peter Waldschmidt [Tue, 28 Jul 2015 01:33:53 +0000 (21:33 -0400)]
encoding/json: fix EOF bug decoding HTTP stream

Fixes bug referenced in this thread on golang-dev:
https://groups.google.com/d/topic/golang-dev/U4LSpMzL82c/discussion

Change-Id: If01a2644863f9e5625dd2f95f9d344bda772e12c
Reviewed-on: https://go-review.googlesource.com/12726
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agoall: cleanup usage of dashes in package documentation
Matthew Dempsky [Fri, 24 Jul 2015 21:52:57 +0000 (14:52 -0700)]
all: cleanup usage of dashes in package documentation

Change-Id: I58453f7ed71eaca15dd3f501e4ae88d1fab19908
Reviewed-on: https://go-review.googlesource.com/12683
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Rob Pike <r@golang.org>
9 years agonet/http: pause briefly after closing Server connection when body remains
Brad Fitzpatrick [Fri, 24 Jul 2015 21:22:26 +0000 (14:22 -0700)]
net/http: pause briefly after closing Server connection when body remains

From https://github.com/golang/go/issues/11745#issuecomment-123555313
this implements option (b), having the server pause slightly after
sending the final response on a TCP connection when we're about to close
it when we know there's a request body outstanding. This biases the
client (which might not be Go) to prefer our response header over the
request body write error.

Updates #11745

Change-Id: I07cb0b74519d266c8049d9e0eb23a61304eedbf8
Reviewed-on: https://go-review.googlesource.com/12658
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>

9 years agoruntime/cgo: remove TMPDIR logic for iOS
David Crawshaw [Mon, 27 Jul 2015 20:40:40 +0000 (16:40 -0400)]
runtime/cgo: remove TMPDIR logic for iOS

Seems like the simplest solution for 1.5. All the parts of the test
suite I can run on my current device (for which my exception handler
fix no longer works, apparently) pass without this code. I'll move it
into x/mobile/app.

Fixes #11884

Change-Id: I2da40c8c7b48a4c6970c4d709dd7c148a22e8727
Reviewed-on: https://go-review.googlesource.com/12721
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agoruntime: close window that hides GC work from concurrent mark
Austin Clements [Mon, 27 Jul 2015 18:35:38 +0000 (14:35 -0400)]
runtime: close window that hides GC work from concurrent mark

Currently we enter mark 2 by first flushing all existing gcWork caches
and then setting gcBlackenPromptly, which disables further gcWork
caching. However, if a worker or assist pulls a work buffer in to its
gcWork cache after that cache has been flushed but before caching is
disabled, that work may remain in that cache until mark termination.
If that work represents a heap bottleneck (e.g., a single pointer that
is the only way to reach a large amount of the heap), this can force
mark termination to do a large amount of work, resulting in a long
STW.

Fix this by reversing the order of these steps: first disable caching,
then flush all existing caches.

Rick Hudson <rlh> did the hard work of tracking this down. This CL
combined with CL 12672 and CL 12646 distills the critical parts of his
fix from CL 12539.

Fixes #11694.

Change-Id: Ib10d0a21e3f6170a80727d0286f9990df049fed2
Reviewed-on: https://go-review.googlesource.com/12688
Reviewed-by: Rick Hudson <rlh@golang.org>
9 years agoruntime: enable GC assists ASAP
Austin Clements [Fri, 24 Jul 2015 22:11:36 +0000 (18:11 -0400)]
runtime: enable GC assists ASAP

Currently the GC coordinator enables GC assists at the same time it
enables background mark workers, after the concurrent scan phase is
done. However, this means a rapidly allocating mutator has the entire
scan phase during which to allocate beyond the heap trigger and
potentially beyond the heap goal with no back-pressure from assists.
This prevents the feedback system that's supposed to keep the heap
size under the heap goal from doing its job.

Fix this by enabling mutator assists during the scan phase. This is
safe because the write barrier is already enabled and globally
acknowledged at this point.

There's still a very small window between when the heap size reaches
the heap trigger and when the GC coordinator is able to stop the world
during which the mutator can allocate unabated. This allows *very*
rapidly allocator mutators like TestTraceStress to still occasionally
exceed the heap goal by a small amount (~20 MB at most for
TestTraceStress). However, this seems like a corner case.

Fixes #11677.

Change-Id: I0f80d949ec82341cd31ca1604a626efb7295a819
Reviewed-on: https://go-review.googlesource.com/12674
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agoruntime: allow GC drain whenever write barrier is enabled
Austin Clements [Fri, 24 Jul 2015 16:33:23 +0000 (12:33 -0400)]
runtime: allow GC drain whenever write barrier is enabled

Currently we hand-code a set of phases when draining is allowed.
However, this set of phases is conservative. The critical invariant is
simply that the write barrier must be enabled if we're draining.

Shortly we're going to enable mutator assists during the scan phase,
which means we may drain during the scan phase. In preparation, this
commit generalizes these assertions to check the fundamental condition
that the write barrier is enabled, rather than checking that we're in
any particular phase.

Change-Id: I0e1bec1ca823d4a697a0831ec4c50f5dd3f2a893
Reviewed-on: https://go-review.googlesource.com/12673
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agoruntime: don't start workers between mark 1 & 2
Austin Clements [Fri, 24 Jul 2015 21:41:34 +0000 (17:41 -0400)]
runtime: don't start workers between mark 1 & 2

Currently we clear both the mark 1 and mark 2 signals at the beginning
of concurrent mark. If either if these is clear, it acts as a signal
to the scheduler that it should start background workers. However,
this means that in the interim *between* mark 1 and mark 2, the
scheduler basically loops starting up new workers only to have them
return with nothing to do. In addition to harming performance and
delaying mutator work, this approach has a race where workers started
for mark 1 can mistakenly signal mark 2, causing it to complete
prematurely. This approach also interferes with starting assists
earlier to fix #11677.

Fix this by initially setting both mark 1 and mark 2 to "signaled".
The scheduler will not start background mark workers, though assists
can still run. When we're ready to enter mark 1, we clear the mark 1
signal and wait for it. Then, when we're ready to enter mark 2, we
clear the mark 2 signal and wait for it.

This structure also lets us deal cleanly with the situation where all
work is drained *prior* to the mark 2 wait, meaning that there may be
no workers to signal completion. Currently we deal with this using a
racy (and possibly incorrect) check for work in the coordinator itself
to skip the mark 2 wait if there's no work. This change makes the
coordinator unconditionally wait for mark completion and makes the
scheduler itself signal completion by slightly extending the logic it
already has to determine that there's no work and hence no use in
starting a new worker.

This is a prerequisite to fixing the remaining component of #11677,
which will require enabling assists during the scan phase. However, we
don't want to enable background workers until the mark phase because
they will compete with the scan. This change lets us use bgMark1 and
bgMark2 to indicate when it's okay to start background workers
independent of assists.

This is also a prerequisite to fixing #11694. It significantly reduces
the occurrence of long mark termination pauses in #11694 (from 64 out
of 1000 to 2 out of 1000 in one experiment).

Coincidentally, this also reduces the final heap size (and hence run
time) of TestTraceStress from ~100 MB and ~1.9 seconds to ~14 MB and
~0.4 seconds because it significantly shortens concurrent mark
duration.

Rick Hudson <rlh> did the hard work of tracking this down.

Change-Id: I12ea9ee2db9a0ae9d3a90dde4944a75fcf408f4c
Reviewed-on: https://go-review.googlesource.com/12672
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agoruntime: retry GC assist until debt is paid off
Austin Clements [Wed, 22 Jul 2015 20:55:04 +0000 (16:55 -0400)]
runtime: retry GC assist until debt is paid off

Currently, there are three ways to satisfy a GC assist: 1) the mutator
steals credit from background GC, 2) the mutator actually does GC
work, and 3) there is no more work available. 3 was never really
intended as a way to satisfy an assist, and it causes problems: there
are periods when it's expected that the GC won't have any work, such
as when transitioning from mark 1 to mark 2 and from mark 2 to mark
termination. During these periods, there's no back-pressure on rapidly
allocating mutators, which lets them race ahead of the heap goal.

For example, test/init1.go and the runtime/trace test both have small
reachable heaps and contain loops that rapidly allocate large garbage
byte slices. This bug lets these tests exceed the heap goal by several
orders of magnitude.

Fix this by forcing the assist (and hence the allocation) to block
until it can satisfy its debt via either 1 or 2, or the GC cycle
terminates.

This fixes one the causes of #11677. It's still possible to overshoot
the GC heap goal, but with this change the overshoot is almost exactly
by the amount of allocation that happens during the concurrent scan
phase, between when the heap passes the GC trigger and when the GC
enables assists.

Change-Id: I5ef4edcb0d2e13a1e432e66e8245f2bd9f8995be
Reviewed-on: https://go-review.googlesource.com/12671
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agoruntime: yield to GC coordinator after assist completion
Austin Clements [Thu, 23 Jul 2015 21:55:01 +0000 (17:55 -0400)]
runtime: yield to GC coordinator after assist completion

Currently it's possible for the GC assist to signal completion of the
mark phase, which puts the GC coordinator goroutine on the current P's
run queue, and then return to mutator code that delays until the next
forced preemption before actually yielding control to the GC
coordinator, dragging out completion of the mark phase. This delay can
be further exacerbated if the mutator makes other goroutines runnable
before yielding control, since this will push the GC coordinator on
the back of the P's run queue.

To fix this, this adds a Gosched to the assist if it completed the
mark phase. This immediately and directly yields control to the GC
coordinator. This already happens implicitly in the background mark
workers because they park immediately after completing the mark.

This is one of the reasons completion of the mark phase is being
dragged out and allowing the mutator to allocate without assisting,
leading to the large heap goal overshoot in issue #11677. This is also
a prerequisite to making the assist block when it can't pay off its
debt.

Change-Id: I586adfbecb3ca042a37966752c1dc757f5c7fc78
Reviewed-on: https://go-review.googlesource.com/12670
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agoruntime: disallow GC assists in non-preemptible contexts
Austin Clements [Wed, 22 Jul 2015 19:14:54 +0000 (15:14 -0400)]
runtime: disallow GC assists in non-preemptible contexts

Currently it's possible to perform GC work on a system stack or when
locks are held if there's an allocation that triggers an assist. This
is generally a bad idea because of the fragility of these contexts,
and it's incompatible with two changes we're about to make: one is to
yield after signaling mark completion (which we can't do from a
non-preemptible context) and the other is to make assists block if
there's no other way for them to pay off the assist debt.

This commit simply skips the assist if it's called from a
non-preemptible context. The allocation will still count toward the
assist debt, so it will be paid off by a later assist. There should be
little allocation from non-preemptible contexts, so this shouldn't
harm the overall assist mechanism.

Change-Id: I7bf0e6c73e659fe6b52f27437abf39d76b245c79
Reviewed-on: https://go-review.googlesource.com/12649
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agoruntime: make notetsleep_internal nowritebarrier
Austin Clements [Fri, 24 Jul 2015 19:38:16 +0000 (15:38 -0400)]
runtime: make notetsleep_internal nowritebarrier

When notetsleep_internal is called from notetsleepg, notetsleepg has
just given up the P, so write barriers are not allowed in
notetsleep_internal.

Change-Id: I1b214fa388b1ea05b8ce2dcfe1c0074c0a3c8870
Reviewed-on: https://go-review.googlesource.com/12647
Reviewed-by: Rick Hudson <rlh@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agoruntime: fix mark 2 completion in fractional/idle workers
Austin Clements [Fri, 24 Jul 2015 20:38:19 +0000 (16:38 -0400)]
runtime: fix mark 2 completion in fractional/idle workers

Currently fractional and idle mark workers dispose of their gcWork
cache during mark 2 after incrementing work.nwait and after checking
whether there are any workers or any work available. This creates a
window for two races:

1) If the only remaining work is in this worker's gcWork cache, it
   will see that there are no more workers and no more work on the
   global lists (since it has not yet flushed its own cache) and
   prematurely signal mark 2 completion.

2) After this worker has incremented work.nwait but before it has
   flushed its cache, another worker may observe that there are no
   more workers and no more work and prematurely signal mark 2
   completion.

We can fix both of these by simply moving the cache flush above the
increment of nwait and the test of the completion condition.

This is probably contributing to #11694, though this alone is not
enough to fix it.

Change-Id: Idcf9656e5c460c5ea0d23c19c6c51e951f7716c3
Reviewed-on: https://go-review.googlesource.com/12646
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agoruntime: steal the correct amount of GC assist credit
Austin Clements [Wed, 22 Jul 2015 20:40:50 +0000 (16:40 -0400)]
runtime: steal the correct amount of GC assist credit

GC assists are supposed to steal at most the amount of background GC
credit available so that background GC credit doesn't go negative.
However, they are instead stealing the *total* amount of their debt
but only claiming up to the amount of credit that was available. This
results in draining the background GC credit pool too quickly, which
results in unnecessary assist work.

The fix is trivial: steal the amount of work we meant to steal (which
is already computed).

Change-Id: I837fe60ed515ba91c6baf363248069734a7895ef
Reviewed-on: https://go-review.googlesource.com/12643
Reviewed-by: Rick Hudson <rlh@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agocmd/dist: run misc/cgo/testsovar on darwin and netbsd
Ian Lance Taylor [Mon, 27 Jul 2015 17:30:26 +0000 (10:30 -0700)]
cmd/dist: run misc/cgo/testsovar on darwin and netbsd

CL https://golang.org/cl/12470 has reportedly fixed the problems that
the misc/cgo/testsovar test encountered on darwin and netbsd.  Let's
actually run the test.

Update #10360.
Update #11654.

Change-Id: I4cdd27a8ec8713620e0135780a03f63cfcc538d0
Reviewed-on: https://go-review.googlesource.com/12702
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agoencoding/xml: fix race using finfo.parents in s.trim
Russ Cox [Mon, 27 Jul 2015 17:52:04 +0000 (13:52 -0400)]
encoding/xml: fix race using finfo.parents in s.trim

This race was identified in #9796, but a sequence of fixes
proposed in golang.org/cl/4152 were rolled into
golang.org/cl/5910 which both fixed the race and
modified the name space behavior.

We rolled back the name space changes and lost the race fix.

Fix the race separate from the name space changes,
following the suggestion made by Roger Peppe in
https://go-review.googlesource.com/#/c/4152/7/src/encoding/xml/marshal.go@897

Fixes #9796.
Fixes #11885.

Change-Id: Ib2b68982da83dee9e04db8b8465a8295259bba46
Reviewed-on: https://go-review.googlesource.com/12687
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>

9 years agogo/internal/gcimporter: only run compile test if go tool is available
Ian Lance Taylor [Mon, 27 Jul 2015 17:34:11 +0000 (10:34 -0700)]
go/internal/gcimporter: only run compile test if go tool is available

Fixes build dashboard failures for android and nacl.

Change-Id: Id13896570061d3d8186f7b666ca1c37bcc789b0f
Reviewed-on: https://go-review.googlesource.com/12703
Reviewed-by: David Crawshaw <crawshaw@golang.org>
9 years agoruntime: document gctrace format
Austin Clements [Tue, 21 Jul 2015 15:45:55 +0000 (11:45 -0400)]
runtime: document gctrace format

Fixes #10348.

Change-Id: I3eea9738e3f6fdc1998d04a601dc9b556dd2db72
Reviewed-on: https://go-review.googlesource.com/12453
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agoruntime: always report starting heap size in gctrace
Austin Clements [Tue, 21 Jul 2015 15:38:14 +0000 (11:38 -0400)]
runtime: always report starting heap size in gctrace

Currently the gctrace output reports the trigger heap size, rather
than the actual heap size at the beginning of GC. Often these are the
same, or at least very close. However, it's possible for the heap to
already have exceeded this trigger when we first check the trigger and
start GC; in this case, this output is very misleading. We've
encountered this confusion a few times when debugging and this
behavior is difficult to document succinctly.

Change the gctrace output to report the actual heap size when GC
starts, rather than the trigger.

Change-Id: I246b3ccae4c4c7ea44c012e70d24a46878d7601f
Reviewed-on: https://go-review.googlesource.com/12452
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agoruntime: remove # from gctrace line
Austin Clements [Mon, 20 Jul 2015 19:48:53 +0000 (15:48 -0400)]
runtime: remove # from gctrace line

Whenever someone pastes gctrace output into GitHub, it helpfully turns
the GC cycle number into a link to some unrelated issue. Prevent this
by removing the pound before the cycle number. The fact that this is a
cycle number is probably more obvious at a glance than most of the
other numbers.

Change-Id: Ifa5fc7fe6c715eac50e639f25bc36c81a132ffea
Reviewed-on: https://go-review.googlesource.com/12413
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agocmd/go: do not panic on template I/O error
Russ Cox [Thu, 23 Jul 2015 15:41:35 +0000 (11:41 -0400)]
cmd/go: do not panic on template I/O error

Fixes #11839.

Change-Id: Ie092a3a512a2d35967364b41081a066ab3a6aab4
Reviewed-on: https://go-review.googlesource.com/12571
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agocmd/go: use hg repo for code.google.com shutdown check
Russ Cox [Thu, 23 Jul 2015 06:19:57 +0000 (02:19 -0400)]
cmd/go: use hg repo for code.google.com shutdown check

svn dies due to not being able to validate the googlecode.com certificate.
hg does not even attempt to validate it.

Fixes #11806.

Change-Id: I84ced5aa84bb1e4a4cdb2254f2d08a64a1ef23f6
Reviewed-on: https://go-review.googlesource.com/12558
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agocmd/go: fix custom import path wildcards (go get rsc.io/pdf/...)
Russ Cox [Thu, 23 Jul 2015 06:04:01 +0000 (02:04 -0400)]
cmd/go: fix custom import path wildcards (go get rsc.io/pdf/...)

Fixes TestGoGetWorksWithVanityWildcards,
but that test uses the network and is not run
on the builders.

For #11806.

Change-Id: I35c6677deaf84e2fa9bdb98b62d80d388b5248ae
Reviewed-on: https://go-review.googlesource.com/12557
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agoruntime: log all thread stack traces during GODEBUG=crash on Unix
Ian Lance Taylor [Fri, 24 Jul 2015 23:16:39 +0000 (16:16 -0700)]
runtime: log all thread stack traces during GODEBUG=crash on Unix

This extends https://golang.org/cl/2811, which only applied to Darwin
and GNU/Linux, to all Unix systems.

Fixes #9591.

Change-Id: Iec3fb438564ba2924b15b447c0480f87c0bfd009
Reviewed-on: https://go-review.googlesource.com/12661
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agoRevert "test: do not run external linking test on ppc64le"
Russ Cox [Mon, 27 Jul 2015 16:53:35 +0000 (16:53 +0000)]
Revert "test: do not run external linking test on ppc64le"

Broke most builders.

This reverts commit a60c5366f91934a36793bde74556f4b637954665.

Change-Id: Iae952cfcc73ef5da621616a0b3d586b60d1ce9c9
Reviewed-on: https://go-review.googlesource.com/12684
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agohtml/template: add examples to package and functions
Carlos C [Fri, 19 Jun 2015 09:41:41 +0000 (11:41 +0200)]
html/template: add examples to package and functions

Change-Id: Ib4fb8256863d908580a07e6f2e1c92ea109ea989
Reviewed-on: https://go-review.googlesource.com/11249
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agoruntime/pprof: document content of heap profile
Russ Cox [Thu, 23 Jul 2015 04:14:33 +0000 (00:14 -0400)]
runtime/pprof: document content of heap profile

Fixes #11343.

Change-Id: I46efc24b687b9d060ad864fbb238c74544348e38
Reviewed-on: https://go-review.googlesource.com/12556
Reviewed-by: Rob Pike <r@golang.org>
9 years agonet/http: make Transport return proper error on cancel before response headers
Brad Fitzpatrick [Thu, 23 Jul 2015 01:04:33 +0000 (18:04 -0700)]
net/http: make Transport return proper error on cancel before response headers

Fixes #11020

Change-Id: I52760a01420a11f3c979f678812b3775a3af61e4
Reviewed-on: https://go-review.googlesource.com/12545
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agonet/http: on Transport body write error, wait briefly for a response
Brad Fitzpatrick [Thu, 23 Jul 2015 21:05:54 +0000 (14:05 -0700)]
net/http: on Transport body write error, wait briefly for a response

From https://github.com/golang/go/issues/11745#issuecomment-123555313 :

The http.RoundTripper interface says you get either a *Response, or an
error.

But in the case of a client writing a large request and the server
replying prematurely (e.g. 403 Forbidden) and closing the connection
without reading the request body, what does the client want? The 403
response, or the error that the body couldn't be copied?

This CL implements the aforementioned comment's option c), making the
Transport give an N millisecond advantage to responses over body write
errors.

Updates #11745

Change-Id: I4485a782505d54de6189f6856a7a1f33ce4d5e5e
Reviewed-on: https://go-review.googlesource.com/12590
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agotest: do not run external linking test on ppc64le
Michael Hudson-Doyle [Fri, 24 Jul 2015 03:35:45 +0000 (15:35 +1200)]
test: do not run external linking test on ppc64le

Change-Id: I9b8a6ac1ff6bef3b7f1e033bfd029f2a59e30297
Reviewed-on: https://go-review.googlesource.com/12623
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agonet: deflake TestDialTimeout{,FDLeak} in the case of TCP simultaneous open
Mikio Hara [Mon, 27 Jul 2015 03:19:00 +0000 (12:19 +0900)]
net: deflake TestDialTimeout{,FDLeak} in the case of TCP simultaneous open

Fixes #11872.

Change-Id: Ibc7d8438374c9d90fd4cbefb61426c7f4f96af0d
Reviewed-on: https://go-review.googlesource.com/12691
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agogo/build: make TestDependencies check all systems at once
Russ Cox [Thu, 23 Jul 2015 16:42:18 +0000 (12:42 -0400)]
go/build: make TestDependencies check all systems at once

We used to use build.Import to get the dependencies, but that meant
we had to repeat the check for every possible GOOS/GOARCH/cgo
combination, which took too long. So we made the test in short mode
only check the current GOOS/GOARCH/cgo combination.
But some combinations can't run the test at all. For example darwin/arm64
does not run tests with a full source file systems, so it cannot test itself,
so nothing was testing darwin/arm64. This led to bugs like #10455
not being caught.

Rewrite the test to read the imports out of the source files ourselves,
so that we can look at all source files in a directory in one pass,
regardless of which GOOS/GOARCH/cgo/etc they require.
This one complete pass runs in the same amount of time as the
old single combination check ran, so we can now test all systems,
even in short mode.

Change-Id: Ie216303c2515bbf1b6fb717d530a0636e271cb6d
Reviewed-on: https://go-review.googlesource.com/12576
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agoencoding/json: add JSON streaming parse API
Peter Waldschmidt [Sat, 18 Apr 2015 07:23:32 +0000 (03:23 -0400)]
encoding/json: add JSON streaming parse API

This change adds new methods to Decoder.

 * Decoder.Token steps through a JSON document, returning a value for each token.
 * Decoder.Decode unmarshals the entire value at the token stream's current
   position (in addition to its existing function in a stream of JSON values)

Fixes #6050.
Fixes #6499.

Change-Id: Iff283e0e7b537221ae256392aca6529f06ebe211
Reviewed-on: https://go-review.googlesource.com/9073
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agogo/build: update deps list
Russ Cox [Thu, 23 Jul 2015 16:20:18 +0000 (12:20 -0400)]
go/build: update deps list

A while back we discovered that the dependencies test allowed
arbitrary dependencies for packages we forgot to list.
To stop the damage we added a grandfathered list and fixed
the code to expect unlisted packages to have no dependencies.

This CL replaces the grandfathered list with some more
careful placement of dependency rules.

Thankfully, there were no terrible inversions.

Fixes #10487.

Change-Id: I5a6f92435bd2c66c47ec8ab629edbd88b189f028
Reviewed-on: https://go-review.googlesource.com/12575
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
9 years agoruntime/cgo: move TMPDIR magic out of os
Russ Cox [Thu, 23 Jul 2015 16:19:09 +0000 (12:19 -0400)]
runtime/cgo: move TMPDIR magic out of os

It's not clear this really belongs anywhere at all,
but this is a better place for it than package os.
This way package os can avoid importing "C".

Fixes #10455.

Change-Id: Ibe321a93bf26f478951c3a067d75e22f3d967eb7
Reviewed-on: https://go-review.googlesource.com/12574
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Reviewed-by: Dave Cheney <dave@cheney.net>
9 years agogo/internal/gcimporter: reenable TestImport
Russ Cox [Thu, 23 Jul 2015 16:05:34 +0000 (12:05 -0400)]
go/internal/gcimporter: reenable TestImport

It was not running because of invalid use of ArchChar.
I didn't catch this when I scrubbed ArchChar from the tree
because this code wasn't in the tree yet.

The test seems to pass, which is nice.

Change-Id: I59761a7a04a73681e147e25c1e7f010068276aa8
Reviewed-on: https://go-review.googlesource.com/12573
Reviewed-by: Robert Griesemer <gri@golang.org>
9 years agoencoding/xml: restore Go 1.4 name space behavior
Russ Cox [Thu, 23 Jul 2015 14:28:27 +0000 (10:28 -0400)]
encoding/xml: restore Go 1.4 name space behavior

There is clearly work to do here with respect to xml name spaces,
but I don't believe the changes in this cycle are clearly correct.
The changes in this cycle have visible impact on the generated xml,
possibly breaking existing programs, and yet it's not clear that they
are the end of the story: there is still significant confusion about how
name spaces work or should work (see #9519, #9775, #8167, #7113).

I would like to wait to make breaking changes until we completely
understand what the behavior should be and can evaluate the benefit
of those breaking changes. My main concern here is that we will break
programs in Go 1.5 for the sake of name space adjustments and then
while trying to fix those other bugs we'll break programs in Go 1.6 too.
Let's wait until we know all the changes we want to make before we
decide whether or how to break existing programs.

This CL reverts:

5ae822b encoding/xml: minor changes
bb7e665 encoding/xml: fix xmlns= behavior
9f9d66d encoding/xml: fix default namespace of tags
b69ea01 encoding/xml: fix namespaces in a>b tags
3be158d encoding/xml: encoding name spaces correctly

and adjusts tests from

a9dddb5 encoding/xml: add more EncodeToken tests.

to expect Go 1.4 behavior.

I have confirmed that the name space parts of the test suite
as of this CL passes against the Go 1.4 encoding/xml package,
indicating that this CL successfully restores the Go 1.4 behavior.

(Other tests do not, but that's because there were some real
bug fixes in this cycle that are being kept. Specifically, the
tests that don't pass in Go 1.4 are TestMarshal's NestedAndComment
case, TestEncodeToken's encoding of newlines, and
TestSimpleUseOfEncodeToken returning an error for invalid
token types.)

I also checked that the Go 1.4 tests pass when run against
this copy of the sources.

Fixes #11841.

Change-Id: I97de06761038b40388ef6e3a55547ff43edee7cb
Reviewed-on: https://go-review.googlesource.com/12570
Reviewed-by: Nigel Tao <nigeltao@golang.org>
9 years agonet/http: fix a data race when Request.Cancel is used
Brad Fitzpatrick [Fri, 24 Jul 2015 23:27:07 +0000 (16:27 -0700)]
net/http: fix a data race when Request.Cancel is used

The "add a Request.Cancel channel" change (https://golang.org/cl/11601)
added support for "race free" cancellation, but introduced a data race. :)

Noticed while running "go test -race net/http". The test is skipped in
short mode, so we never saw it on the dashboard.

Change-Id: Ica14579d8723f8f9d1691e8d56c30b585b332c64
Reviewed-on: https://go-review.googlesource.com/12663
Reviewed-by: Aaron Jacobs <jacobsa@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agoA+C: Add another email address for Brian Gitonga Marete.
Brian Gitonga Marete [Mon, 27 Jul 2015 01:13:19 +0000 (04:13 +0300)]
A+C: Add another email address for Brian Gitonga Marete.

Change-Id: I2c21b012534be20443157c6b77ef21bd585902b0
Reviewed-on: https://go-review.googlesource.com/12636
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocmd/go: mention go tool compile etc. in the help text for build
Rob Pike [Fri, 24 Jul 2015 04:37:58 +0000 (14:37 +1000)]
cmd/go: mention go tool compile etc. in the help text for build

Not everyone is aware that go build is a wrapper for other
tools. Mention this in the text for go help build so people using
other build systems won't just wrap go build, which is usually a
mistake (it doesn't do incremental builds by default, for instance).

Update #11854.

Change-Id: I759f91f23ccd3671204c39feea12a3bfaf9f0114
Reviewed-on: https://go-review.googlesource.com/12625
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agoruntime: pass a smaller buffer to sched_getaffinity on ARM
Michael Hudson-Doyle [Fri, 24 Jul 2015 02:26:29 +0000 (14:26 +1200)]
runtime: pass a smaller buffer to sched_getaffinity on ARM

The system stack is only around 8kb on ARM so one can't put an 8kb buffer on
the stack. More than 1024 ARM cores seems sufficiently unlikely for the
foreseeable future.

Fixes #11853

Change-Id: I7cb27c1250a6153f86e269c172054e9dfc218c72
Reviewed-on: https://go-review.googlesource.com/12622
Reviewed-by: Austin Clements <austin@google.com>
9 years agocmd/cgo: document how CGO_ENABLED works today
Ian Lance Taylor [Fri, 24 Jul 2015 00:14:48 +0000 (17:14 -0700)]
cmd/cgo: document how CGO_ENABLED works today

Fixes #9530.

Change-Id: Iadfc027c7164e3ba35adb5c67deb42b51d3498ca
Reviewed-on: https://go-review.googlesource.com/12603
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Dave Cheney <dave@cheney.net>
9 years agointernal/singleflight: deflake TestDoDupSuppress
Austin Clements [Sun, 26 Jul 2015 20:03:13 +0000 (16:03 -0400)]
internal/singleflight: deflake TestDoDupSuppress

Currently TestDoDupSuppress can fail if the goroutines created by its
loop run sequentially. This is rare, but it has caused failures on the
dashboard and in stress testing.

While I think there's no way to eliminate all possible thread
schedules that could make this test fail because it depends on waiting
until a Group.Do blocks, it is possible to make it much more robust.

This commit deflakes this test by forcing at least one invocation of
fn to start and all goroutines to reach the line just before the Do
call before allowing fn to proceed. fn then waits 10 milliseconds
before returning to allow the goroutines to pass through the Do.

With this change, in 50,000 runs of the stress testing configuration,
the number of calls to fn never even exceeded 1.

Fixes #11784.

Change-Id: Ie5adf5764545050ec407619769a656251c4cff04
Reviewed-on: https://go-review.googlesource.com/12681
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocrypt/rand: update docs for Linux
Jeff R. Allen [Thu, 23 Jul 2015 13:45:23 +0000 (15:45 +0200)]
crypt/rand: update docs for Linux

Update the docs to explain the code added in
commit 67e1d400.

Fixes #11831.

Change-Id: I8fe72e449507847c4bd9d77de40947ded7f2ff9d
Reviewed-on: https://go-review.googlesource.com/12515
Reviewed-by: Dave Cheney <dave@cheney.net>
9 years agocmd/compile: add missing quotation mark
Matthew Dempsky [Fri, 24 Jul 2015 21:55:07 +0000 (14:55 -0700)]
cmd/compile: add missing quotation mark

Change-Id: I102901e3df76830ccd5ab74d757203d103eef9e8
Reviewed-on: https://go-review.googlesource.com/12657
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agoruntime: require gdb version 7.9 for gdb test
Ian Lance Taylor [Fri, 24 Jul 2015 05:40:30 +0000 (22:40 -0700)]
runtime: require gdb version 7.9 for gdb test

Issue 11214 reports problems with older versions of gdb.  It does work
with gdb 7.9 on my Ubuntu Trusty system, so take that as the minimum
required version.

Fixes #11214.

Change-Id: I61b732895506575be7af595f81fc1bcf696f58c2
Reviewed-on: https://go-review.googlesource.com/12626
Reviewed-by: Austin Clements <austin@google.com>
9 years agocmd/go: document environment variables
Ian Lance Taylor [Fri, 24 Jul 2015 01:57:29 +0000 (18:57 -0700)]
cmd/go: document environment variables

This adds documentation for all the environment variables I could
locate in the go tool and the commands that it invokes.

Fixes #9672.

Change-Id: Id5f09160a3a8a938af4a3fcb8757eb3eced05416
Reviewed-on: https://go-review.googlesource.com/12620
Reviewed-by: Rob Pike <r@golang.org>
9 years agoruntime: fix runtime·raise for dragonfly amd64
Ian Lance Taylor [Fri, 24 Jul 2015 02:00:15 +0000 (19:00 -0700)]
runtime: fix runtime·raise for dragonfly amd64

Fixes #11847.

Change-Id: I21736a4c6f6fb2f61aec1396ce2c965e3e329e92
Reviewed-on: https://go-review.googlesource.com/12621
Reviewed-by: Mikio Hara <mikioh.mikioh@gmail.com>
9 years agogo/types: fix suspect or
Damian Gryski [Thu, 23 Jul 2015 20:12:24 +0000 (22:12 +0200)]
go/types: fix suspect or

In https://go-review.googlesource.com/#/c/8611/ , these tests were
supposed to be skipped only for linux and darwin, as the comment says.
This patch fixes the logic in the if test.

Change-Id: Iff0a32186267457a414912c4c3ee4495650891a2
Reviewed-on: https://go-review.googlesource.com/12517
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>

9 years agocmd/compile: prepend captured args to called-closure params
David Chase [Thu, 23 Jul 2015 18:17:07 +0000 (14:17 -0400)]
cmd/compile: prepend captured args to called-closure params

Old code appended, did not play well with a closure
with a ... param.

Fixes #11075.

Change-Id: Ib7c8590c5c4e576e798837e7499e00f3494efb4a
Reviewed-on: https://go-review.googlesource.com/12580
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: David Chase <drchase@google.com>

9 years agoRevert "bytes: document that Buffer values must not be copied"
Alan Donovan [Thu, 23 Jul 2015 18:34:31 +0000 (18:34 +0000)]
Revert "bytes: document that Buffer values must not be copied"

This reverts commit b1177d390cf0c3733836e5941f77b828e21c8a09.

Change-Id: Iffbd63d5993633143a81572b223e3c5dd2353206
Reviewed-on: https://go-review.googlesource.com/12581
Reviewed-by: Alan Donovan <adonovan@google.com>
9 years agocmd/link: don't generate .exe extension for external Windows link
Ian Lance Taylor [Wed, 15 Jul 2015 16:05:33 +0000 (09:05 -0700)]
cmd/link: don't generate .exe extension for external Windows link

On Windows, gcc -o foo will generate foo.exe.  Prevent that from
happening by adding a final '.' if necessary so that GCC thinks that
the file already has an extension.

Also remove the initial output file when doing an external link, and
use mayberemoveoutfile, not os.Remove, when building an archive
(otherwise we will do the wrong thing for -buildmode=c-archive -o
/dev/null).

I didn't add a test, as it requires using cgo and -o on Windows.

Fixes #11725.

Change-Id: I6ea12437bb6b4b9b8ee5c3b52d83509fa2437b2d
Reviewed-on: https://go-review.googlesource.com/12243
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agospec: be precise about rune/string literals and comments
Robert Griesemer [Sat, 30 May 2015 00:36:26 +0000 (17:36 -0700)]
spec: be precise about rune/string literals and comments

See #10248 for details.

Fixes #10248.

Change-Id: I373545b2dca5d1da1c7149eb0a8f6c6dd8071a4c
Reviewed-on: https://go-review.googlesource.com/10503
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
9 years agobytes: document that Buffer values must not be copied
Alan Donovan [Thu, 23 Jul 2015 16:07:58 +0000 (12:07 -0400)]
bytes: document that Buffer values must not be copied

Change-Id: If0821a2af987b78ed8024b40d9ffa68032518b22
Reviewed-on: https://go-review.googlesource.com/12572
Reviewed-by: Robert Griesemer <gri@golang.org>
9 years agocmd/compile: adjust annotation of implicit operations.
David Chase [Wed, 22 Jul 2015 19:03:02 +0000 (15:03 -0400)]
cmd/compile: adjust annotation of implicit operations.

Limit probe to ODOT/OIND/ODOTPTR for now; that works.

Fixes #11790

Change-Id: I411271e702c5fe6ceb880ca47c7dacc37ffcbb6a
Reviewed-on: https://go-review.googlesource.com/12532
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agoencoding/xml: EncodeToken silently eats tokens with invalid type
Didier Spezia [Wed, 15 Jul 2015 20:09:24 +0000 (20:09 +0000)]
encoding/xml: EncodeToken silently eats tokens with invalid type

EncodeToken takes a Token (i.e. an interface{}) as a parameter,
and expects a value of type StartElement, EndElement, CharData,
Comment, ProcInst, or Directive.

If a pointer is passed instead, or any type which does not match
this list, the token is silently ignored.

Added a default case in the type switch to issue a proper error
when the type is invalid.

The behavior could be later improved by allowing pointers to
token to be accepted as well, but not for go1.5.

Fixes #11719

Change-Id: Ifd13c1563450b474acf66d57669fdccba76c1949
Reviewed-on: https://go-review.googlesource.com/12252
Reviewed-by: Andrew Gerrand <adg@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agoruntime: make pcln table check not trigger next to foreign code
Russ Cox [Thu, 23 Jul 2015 06:23:14 +0000 (02:23 -0400)]
runtime: make pcln table check not trigger next to foreign code

Foreign code can be arbitrarily aligned,
so the function before it can have
arbitrarily much padding.
We can't call pcvalue on values in the padding.

Fixes #11653.

Change-Id: I7d57f813ae5a2409d1520fcc909af3eeef2da131
Reviewed-on: https://go-review.googlesource.com/12550
Reviewed-by: Rob Pike <r@golang.org>
9 years agocmd/go: document internal and vendor
Russ Cox [Wed, 22 Jul 2015 15:33:42 +0000 (11:33 -0400)]
cmd/go: document internal and vendor

Fixes #11606.

Change-Id: I70d38c22812c17119b998aad9c1c68e7cf74e98a
Reviewed-on: https://go-review.googlesource.com/12524
Reviewed-by: Rob Pike <r@golang.org>
9 years agoruntime/trace: fix TestTraceSymbolize networking
Russ Cox [Tue, 21 Jul 2015 00:20:05 +0000 (20:20 -0400)]
runtime/trace: fix TestTraceSymbolize networking

We use 127.0.0.1 instead of localhost in Go networking tests.
The reporter of #11774 has localhost defined to be 120.192.83.162,
for reasons unknown.

Also, if TestTraceSymbolize calls Fatalf (for example because Listen
fails) then we need to stop the trace for future tests to work.
See failure log in #11774.

Fixes #11774.

Change-Id: Iceddb03a72d31e967acd2d559ecb78051f9c14b7
Reviewed-on: https://go-review.googlesource.com/12521
Reviewed-by: Rob Pike <r@golang.org>
9 years agocmd/link: write combined dwarf file to same directory as output file
Russ Cox [Wed, 22 Jul 2015 22:02:52 +0000 (18:02 -0400)]
cmd/link: write combined dwarf file to same directory as output file

Fixes #11681.

Change-Id: I679d71ed25ac585af7d43611be01c1a0c4807871
Reviewed-on: https://go-review.googlesource.com/12554
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agocmd/pprof: fix race between viewer and web command
Russ Cox [Wed, 22 Jul 2015 21:48:49 +0000 (17:48 -0400)]
cmd/pprof: fix race between viewer and web command

Fixes #11729.

Change-Id: I6e5e23169ac1368afcbd016ed544a710aa045326
Reviewed-on: https://go-review.googlesource.com/12553
Reviewed-by: Rob Pike <r@golang.org>
9 years agodoc: mention the ppc64(le) ports in release notes
Rob Pike [Wed, 22 Jul 2015 01:24:27 +0000 (11:24 +1000)]
doc: mention the ppc64(le) ports in release notes

Also make the spelling consistent in asm.html

Change-Id: Ifa751eee288fe0634cd317eb827f3e408b199620
Reviewed-on: https://go-review.googlesource.com/12501
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agonet: make GODEBUG=netdns=cgo force cgo as documented
Brad Fitzpatrick [Thu, 23 Jul 2015 00:45:32 +0000 (17:45 -0700)]
net: make GODEBUG=netdns=cgo force cgo as documented

It wasn't working. The wrong variable was used.

This would ideally have tests. It's also DEBUG.

Fixes #11816

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

9 years agonet: compute the Dialer deadline exactly once.
Paul Marks [Mon, 20 Jul 2015 23:04:25 +0000 (16:04 -0700)]
net: compute the Dialer deadline exactly once.

When dialing with a relative Timeout instead of an absolute Deadline,
the deadline function only makes sense if called before doing any
time-consuming work.

This change calls deadline exactly once, storing the result until the
Dial operation completes.  The partialDeadline implementation is
reverted to the following patch set 3:
https://go-review.googlesource.com/#/c/8768/3..4/src/net/dial.go

Otherwise, when dialing a name with multiple IP addresses, or when DNS
is slow, the recomputed deadline causes the total Timeout to exceed that
requested by the user.

Fixes #11796

Change-Id: I5e1f0d545f9e86a4e0e2ac31a9bd108849cf0fdf
Reviewed-on: https://go-review.googlesource.com/12442
Run-TryBot: Paul Marks <pmarks@google.com>
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agoos/exec: close read pipe if copy to io.Writer fails
Russ Cox [Wed, 22 Jul 2015 20:50:00 +0000 (16:50 -0400)]
os/exec: close read pipe if copy to io.Writer fails

Fixes #10400.

Change-Id: Ic486cb8af4c40660fd1a2e3d10986975acba3f19
Reviewed-on: https://go-review.googlesource.com/12537
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agocmd/go: for get -t and list, look up path in vendor directories
Ian Lance Taylor [Tue, 21 Jul 2015 20:59:35 +0000 (13:59 -0700)]
cmd/go: for get -t and list, look up path in vendor directories

This is needed to handle vendor directories correctly.  It was already
done for the regular imports when the package was loaded, but not for
the test-only imports.

It would be nice to do this while loading the package, but that breaks
the code that checks for direct references to vendor packages when
running go test.  This change is relatively contained.

While we're at it, skip "C" test imports in go get.

Fixes #11628.
Fixes #11717.

Change-Id: I9cc308cf45683e3ff905320c2b5cb45db7716846
Reviewed-on: https://go-review.googlesource.com/12488
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agoruntime: handle linux CPU masks up to 64k CPUs
Russ Cox [Wed, 22 Jul 2015 20:12:26 +0000 (16:12 -0400)]
runtime: handle linux CPU masks up to 64k CPUs

Fixes #11823.

Change-Id: Ic949ccb9657478f8ca34fdf1a6fe88f57db69f24
Reviewed-on: https://go-review.googlesource.com/12535
Reviewed-by: Austin Clements <austin@google.com>
9 years agonet/mail: enhanced Address.String and ParseAddress to match RFC 5322
MathiasB [Fri, 10 Apr 2015 10:14:16 +0000 (12:14 +0200)]
net/mail: enhanced Address.String and ParseAddress to match RFC 5322

Updated Address.String so it restores quoted local parts, which wasn't
done before.
When parsing `<" "@example.com>`, the formatted string returned
`< @example>`, which doens't match RFC 5322, since a space is not atext.
Another example is `<"bob@valid"@example.com>` which returned
`<bob@valid@example.com>`, which is completely invalid.
I also added support for quotes and backslashes in a quoted local part.

Besides formatting a parsed Address, the ParseAddress function also
needed more testing and finetuning for special cases.
Things like `<.john.doe@example.com>` and `<john..doe@example.com>`
e.a. were accepted, but are invalid.
I fixed those details and add tests for some other special cases.

Fixes #10768

Change-Id: Ib0caf8ad603eb21e32fcb957a5f1a0fe5d1c6e6e
Reviewed-on: https://go-review.googlesource.com/8724
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agonet: do not look up abc by default
Russ Cox [Tue, 21 Jul 2015 02:16:29 +0000 (22:16 -0400)]
net: do not look up abc by default

Fixes #11665.

Change-Id: I0897e8cf695434e77d14dcb1d96f21747edfe37c
Reviewed-on: https://go-review.googlesource.com/12523
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agoruntime/cgo: make compatible with race detector
Russ Cox [Wed, 22 Jul 2015 19:31:54 +0000 (15:31 -0400)]
runtime/cgo: make compatible with race detector

Some routines run without and m or g and cannot invoke the
race detector runtime. They must be opaque to the runtime.
That used to be true because they were written in C.
Now that they are written in Go, disable the race detector
annotations for those functions explicitly.

Add test.

Fixes #10874.

Change-Id: Ia8cc28d51e7051528f9f9594b75634e6bb66a785
Reviewed-on: https://go-review.googlesource.com/12534
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agocmd/link: elide individual gcbits symbols
Russ Cox [Wed, 22 Jul 2015 18:59:56 +0000 (14:59 -0400)]
cmd/link: elide individual gcbits symbols

Same as we do for string symbols.

Fixes #11583.

Change-Id: Ia9264f6faf486697d987051b7f9851d37d8ad381
Reviewed-on: https://go-review.googlesource.com/12531
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agoruntime/pprof: ignore too few samples on Windows test
Russ Cox [Wed, 22 Jul 2015 17:22:42 +0000 (13:22 -0400)]
runtime/pprof: ignore too few samples on Windows test

Fixes #10842.

Change-Id: I7de98f3073a47911863a252b7a74d8fdaa48c86f
Reviewed-on: https://go-review.googlesource.com/12529
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agoruntime: if we don't handle a signal on a non-Go thread, raise it
Ian Lance Taylor [Wed, 22 Jul 2015 05:34:48 +0000 (22:34 -0700)]
runtime: if we don't handle a signal on a non-Go thread, raise it

In the past badsignal would crash the program.  In
https://golang.org/cl/10757044 badsignal was changed to call sigsend,
to fix issue #3250.  The effect of this was that when a non-Go thread
received a signal, and os/signal.Notify was not being used to check
for occurrences of the signal, the signal was ignored.

This changes the code so that if os/signal.Notify is not being used,
then the signal handler is reset to what it was, and the signal is
raised again.  This lets non-Go threads handle the signal as they
wish.  In particular, it means that a segmentation violation in a
non-Go thread will ordinarily crash the process, as it should.

Fixes #10139.
Update #11794.

Change-Id: I2109444aaada9d963ad03b1d071ec667760515e5
Reviewed-on: https://go-review.googlesource.com/12503
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>

9 years agocmd/go: support git.apache.org Git repos
Konstantin Shaposhnikov [Thu, 14 May 2015 16:53:10 +0000 (00:53 +0800)]
cmd/go: support git.apache.org Git repos

This change fixes resolution of secure (https) repo URL for
git.apache.org Git repositories.

E.g. the correct repo URL for git.apache.org/thrift.git/lib/go/thrift is
https://git.apache.org/thrift.git, not https://git.apache.org/thrift

Fixes #10797

Change-Id: I67d5312ad8620eb780e42c2e002c8f286f60645a
Reviewed-on: https://go-review.googlesource.com/10092
Reviewed-by: Andrew Gerrand <adg@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agomath/big: document rounding for Rat.FloatToString
Robert Griesemer [Wed, 22 Jul 2015 19:33:21 +0000 (12:33 -0700)]
math/big: document rounding for Rat.FloatToString

Fixes #11523.

Change-Id: I172f6facd555a1c6db76f25d5097343c20dea59a
Reviewed-on: https://go-review.googlesource.com/12507
Reviewed-by: Alan Donovan <adonovan@google.com>
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agoruntime: disable TestGoroutineParallelism on uniprocessor
Russ Cox [Tue, 21 Jul 2015 00:30:41 +0000 (20:30 -0400)]
runtime: disable TestGoroutineParallelism on uniprocessor

It's a bad test and it's worst on uniprocessors.

Fixes #11143.

Change-Id: I0164231ada294788d7eec251a2fc33e02a26c13b
Reviewed-on: https://go-review.googlesource.com/12522
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agoruntime: fix comments referring to trace functions in runtime/pprof
Austin Clements [Wed, 22 Jul 2015 15:54:41 +0000 (11:54 -0400)]
runtime: fix comments referring to trace functions in runtime/pprof

ae1ea2a moved trace-related functions from runtime/pprof to
runtime/trace, but missed a doc comment and a code comment. Update
these to reflect the move.

Change-Id: I6e1e8861e5ede465c08a2e3f80b976145a8b32d8
Reviewed-on: https://go-review.googlesource.com/12525
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
9 years agodoc: add line break in install-source.html
Hari haran [Wed, 22 Jul 2015 11:00:32 +0000 (16:30 +0530)]
doc: add line break in install-source.html

Change-Id: I8633a005da7d0c34a5f074fbd979c8e0fc1fba37
Reviewed-on: https://go-review.googlesource.com/12505
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocmd/dist: add command output for dist tests
Ingo Krabbe [Wed, 22 Jul 2015 07:23:21 +0000 (09:23 +0200)]
cmd/dist: add command output for dist tests

It is very useful to see which test commands are executed.
This is of global use, but I wrote it for #11654.

Change-Id: I9bfc8e55d5bef21f4c49b917f58bc9a44aefcade
Reviewed-on: https://go-review.googlesource.com/12510
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agocrypto/elliptic: call IsOnCurve via the interface.
Adam Langley [Wed, 22 Jul 2015 16:31:29 +0000 (09:31 -0700)]
crypto/elliptic: call IsOnCurve via the interface.

https://go-review.googlesource.com/#/c/2421/ contains an unfortunate
slip where IsOnCurve is called on the CurveParams rather than the curve.
This doesn't really matter, but it's a pain for people doing tricks with
crypto/elliptic and means that 1.5 would be a regression for them
without this change.

See https://groups.google.com/forum/#!topic/golang-dev/i8OPUTYctOk

Change-Id: Ifa5f25f9a95d7484cb53d4883cfd78dc58a0f9a7
Reviewed-on: https://go-review.googlesource.com/12506
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agocrypto/x509: disable sha2 test with system APIs
Russ Cox [Wed, 22 Jul 2015 17:11:54 +0000 (13:11 -0400)]
crypto/x509: disable sha2 test with system APIs

Fixes #11730.

Change-Id: I5bc60779a87dc07899dd70659a830996bf7812ca
Reviewed-on: https://go-review.googlesource.com/12527
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocmd/go: fix missing internal import error
Russ Cox [Tue, 21 Jul 2015 00:05:37 +0000 (20:05 -0400)]
cmd/go: fix missing internal import error

Fixes #11331.

Change-Id: I19b8172421044c301bc136fc8f7bfdadbf880e25
Reviewed-on: https://go-review.googlesource.com/12450
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
9 years agocrypto/tls: check cert chain during VerifyHostname
Russ Cox [Wed, 22 Jul 2015 16:54:00 +0000 (12:54 -0400)]
crypto/tls: check cert chain during VerifyHostname

Fixes #9063.

Change-Id: I536ef1f0b30c94c1ebf7922d84cb2f701b7d8a1a
Reviewed-on: https://go-review.googlesource.com/12526
Reviewed-by: Adam Langley <agl@golang.org>
Run-TryBot: Adam Langley <agl@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agostrconv: add examples to package
Carlos C [Tue, 23 Jun 2015 21:18:35 +0000 (23:18 +0200)]
strconv: add examples to package

Change-Id: I69a2b6a99a53c875162be8a7d86455559cd74504
Reviewed-on: https://go-review.googlesource.com/11371
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agoruntime/trace: add new package
Dmitry Vyukov [Wed, 22 Jul 2015 11:09:26 +0000 (13:09 +0200)]
runtime/trace: add new package

Move tracing functions from runtime/pprof to the new runtime/trace package.

Fixes #9710

Change-Id: I718bcb2ae3e5959d9f72cab5e6708289e5c8ebd5
Reviewed-on: https://go-review.googlesource.com/12511
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agoencoding/json: fix decoding of JSON null values
Didier Spezia [Tue, 28 Apr 2015 11:20:19 +0000 (11:20 +0000)]
encoding/json: fix decoding of JSON null values

JSON decoding currently fails for null values bound to any type
which does implement the JSON Unmarshaler interface without checking
for null values (such as time.Time).

It also fails for types implementing the TextUnmarshaler interface.

The expected behavior of the JSON decoding engine in such case is
to process null by keeping the value unchanged without producing
any error.

Make sure null values are handled by the decoding engine itself,
and never passed to the UnmarshalText or UnmarshalJSON methods.

Fixes #9037

Change-Id: I261d85587ba543ef6f1815555b2af9311034d5bb
Reviewed-on: https://go-review.googlesource.com/9376
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agomisc/makerelease: delete
Andrew Gerrand [Tue, 21 Jul 2015 23:44:05 +0000 (09:44 +1000)]
misc/makerelease: delete

This is now superseded by golang.org/x/build/cmd/release.

Fixes #8472

Change-Id: I59664d84996a0fbb5c90582a4702714b3b3cf302
Reviewed-on: https://go-review.googlesource.com/12500
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agolib/time: update to IANA release 2015e.
David Symonds [Wed, 22 Jul 2015 02:42:28 +0000 (12:42 +1000)]
lib/time: update to IANA release 2015e.

Fixes #11810.

Change-Id: I8453e53a72e242a69ea34eb393999e7291d4358f
Reviewed-on: https://go-review.googlesource.com/12502
Run-TryBot: David Symonds <dsymonds@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
9 years agodoc: add a clause about embedded methods to go1compat
Rob Pike [Tue, 21 Jul 2015 04:05:13 +0000 (14:05 +1000)]
doc: add a clause about embedded methods to go1compat

This is a corner case but it is suggested we call it out.

Fixes #11798.

Change-Id: I2ddb5b363cd2921666dbf03bbf98107697ca40e5
Reviewed-on: https://go-review.googlesource.com/12460
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agocmd/dist: remove prints during test registration
Brad Fitzpatrick [Tue, 21 Jul 2015 19:47:22 +0000 (12:47 -0700)]
cmd/dist: remove prints during test registration

dist test should not print (especially to stdout) during test
registration.  This confuses other tools interacting with dist using
dist test --list, etc.

Change-Id: Ie4f82c13e49590c23a7a235d90ddbc4f5ed81e0b
Reviewed-on: https://go-review.googlesource.com/12487
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agocmd/go: fix typo in comment
Ian Lance Taylor [Tue, 21 Jul 2015 21:05:59 +0000 (14:05 -0700)]
cmd/go: fix typo in comment

Change-Id: I3d5e46d376953fbdd21ce8c161214eaed6378d84
Reviewed-on: https://go-review.googlesource.com/12490
Reviewed-by: Andrew Gerrand <adg@golang.org>
9 years agocmd/go: pass an unmodified environment to a go run program
Ian Lance Taylor [Tue, 21 Jul 2015 19:17:29 +0000 (12:17 -0700)]
cmd/go: pass an unmodified environment to a go run program

Fixes #11709.
Fixed #11449.

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

9 years agogo/types: make types.Typ a slice, unexport UniverseByte/Rune
Robert Griesemer [Tue, 21 Jul 2015 19:32:59 +0000 (12:32 -0700)]
go/types: make types.Typ a slice, unexport UniverseByte/Rune

In lieu of the more invasive https://go-review.googlesource.com/#/c/12373/ .

Change-Id: I0221783fcaa8af04520c80cd2993d7d542d2c431
Reviewed-on: https://go-review.googlesource.com/12486
Reviewed-by: Alan Donovan <adonovan@google.com>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocmd/go: skip TestGoInstallErrorOnCrossCompileToBin in short mode
Ian Lance Taylor [Tue, 21 Jul 2015 18:17:08 +0000 (11:17 -0700)]
cmd/go: skip TestGoInstallErrorOnCrossCompileToBin in short mode

That test will install cmd/pack for linux_386; we don't want to change
GOROOT in short mode.

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