]> Cypherpunks repositories - gostls13.git/log
gostls13.git
9 years agoruntime/pprof: skip TestStackBarrierProfiling
Austin Clements [Tue, 5 Jan 2016 16:33:25 +0000 (11:33 -0500)]
runtime/pprof: skip TestStackBarrierProfiling

This test triggers a large number of usleep(100)s. linux/arm, openbsd,
and solaris have very poor timer resolution on the builders, so
usleep(100) actually gives up the whole scheduling quantum. On Linux
and OpenBSD (and probably Solaris), profiling signals are only
generated when a process completes a whole scheduling quantum, so this
test often gets zero profiling signals and fails.

Until we figure out what to do about this, skip this test on these
platforms.

Updates #13405.

Change-Id: Ica94e4a8ae7a8df3e5a840504f83ee2ec08727df
Reviewed-on: https://go-review.googlesource.com/18252
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Austin Clements <austin@google.com>

9 years agoruntime: fix exit status when killed by signal
Ian Lance Taylor [Fri, 1 Jan 2016 23:44:12 +0000 (15:44 -0800)]
runtime: fix exit status when killed by signal

Previously, when a program died because of a SIGHUP, SIGINT, or SIGTERM
signal it would exit with status 2.  This CL fixes the runtime to exit
with a status indicating that the program was killed by a signal.

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

9 years agoruntime: set SIGCONT to _SigNotify + _SigDefault
Ian Lance Taylor [Thu, 31 Dec 2015 20:06:31 +0000 (12:06 -0800)]
runtime: set SIGCONT to _SigNotify + _SigDefault

Use the current ability to say that we don't do anything with SIGCONT by
default, but programs can catch it using signal.Notify if they want.

Fixes #8953.

Change-Id: I67d40ce36a029cbc58a235cbe957335f4a58e1c5
Reviewed-on: https://go-review.googlesource.com/18185
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocmd/compile: suppress export of Note field within exported bodies
David Chase [Thu, 31 Dec 2015 00:47:36 +0000 (19:47 -0500)]
cmd/compile: suppress export of Note field within exported bodies

Added a format option to inhibit output of .Note field in
printing, and enabled that option during export.
Added test.

Fixes #13777.

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

9 years agonet: run all timeout tests in parallel
Russ Cox [Tue, 29 Dec 2015 17:10:38 +0000 (12:10 -0500)]
net: run all timeout tests in parallel

For #10571.

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

9 years agomisc/cgo/testcshared: print a little more about GOROOT on failure
Russ Cox [Mon, 4 Jan 2016 20:08:03 +0000 (15:08 -0500)]
misc/cgo/testcshared: print a little more about GOROOT on failure

For #13789.

Change-Id: I83973298a35afcf55627f0a72223098306a51f4b
Reviewed-on: https://go-review.googlesource.com/18233
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agocmd/dist: wait for pending tests before exiting
Russ Cox [Mon, 4 Jan 2016 20:03:45 +0000 (15:03 -0500)]
cmd/dist: wait for pending tests before exiting

When 'go tool dist test' stops, it was intended that it first wait for
pending background tests, like a failed compilation waits for pending
background compiles. But these three lines prevented that.
Fix by deleting them. (The actual loop already contains the correct
logic to avoid running the others and to wait for what's left.)

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

9 years agonet/http: relax recently-updated rules and behavior of CloseNotifier
Brad Fitzpatrick [Mon, 4 Jan 2016 20:38:20 +0000 (20:38 +0000)]
net/http: relax recently-updated rules and behavior of CloseNotifier

The CloseNotifier implementation and documentation was
substantially changed in https://golang.org/cl/17750 but it was a bit
too aggressive.

Issue #13666 highlighted that in addition to breaking external
projects, even the standard library (httputil.ReverseProxy) didn't
obey the new rules about not using CloseNotifier until the
Request.Body is fully consumed.

So, instead of fixing httputil.ReverseProxy, dial back the rules a
bit. It's now okay to call CloseNotify before consuming the request
body. The docs now say CloseNotifier may wait to fire before the
request body is fully consumed, but doesn't say that the behavior is
undefined anymore. Instead, we just wait until the request body is
consumed and start watching for EOF from the client then.

This CL also adds a test to ReverseProxy (using a POST request) that
would've caught this earlier.

Fixes #13666

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

9 years agocmd/internal/obj: fix PCSP table at runtime.morestack calls
Matthew Dempsky [Wed, 30 Dec 2015 23:19:54 +0000 (15:19 -0800)]
cmd/internal/obj: fix PCSP table at runtime.morestack calls

Fixes #13346.

Change-Id: Ic903ee90575e8dbe23905d0678d3295745d1d47f
Reviewed-on: https://go-review.googlesource.com/18154
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agoos: remove unused import to fix build
Ian Lance Taylor [Tue, 5 Jan 2016 01:21:05 +0000 (17:21 -0800)]
os: remove unused import to fix build

Change-Id: Ia8c1c77590115a5ffda144962436d489ed77a423
Reviewed-on: https://go-review.googlesource.com/18227
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agoos, runtime: better EPIPE behavior for command line programs
Ian Lance Taylor [Mon, 28 Dec 2015 19:29:22 +0000 (11:29 -0800)]
os, runtime: better EPIPE behavior for command line programs

Old behavior: 10 consecutive EPIPE errors on any descriptor cause the
program to exit with a SIGPIPE signal.

New behavior: an EPIPE error on file descriptors 1 or 2 cause the
program to raise a SIGPIPE signal.  If os/signal.Notify was not used to
catch SIGPIPE signals, this will cause the program to exit with SIGPIPE.
An EPIPE error on a file descriptor other than 1 or 2 will simply be
returned from Write.

Fixes #11845.
Update #9896.

Change-Id: Ic85d77e386a8bb0255dc4be1e4b3f55875d10f18
Reviewed-on: https://go-review.googlesource.com/18151
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agoruntime: disable a signal by restoring the original disposition
Ian Lance Taylor [Fri, 18 Dec 2015 23:29:51 +0000 (15:29 -0800)]
runtime: disable a signal by restoring the original disposition

Fixes #13034.
Fixes #13042.
Update #9896.

Change-Id: I189f381090223dd07086848aac2d69d2c00d80c4
Reviewed-on: https://go-review.googlesource.com/18062
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agocmd/go: update out of date help text about vendoring
Aaron Jacobs [Mon, 21 Dec 2015 02:01:00 +0000 (13:01 +1100)]
cmd/go: update out of date help text about vendoring

Change-Id: I2b61f3b3ecf28d8f6a8dff94d194b6d3d450ea22
Reviewed-on: https://go-review.googlesource.com/17996
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agotesting: add clear panic for duplicate call to t.Parallel
Russ Cox [Tue, 29 Dec 2015 17:10:01 +0000 (12:10 -0500)]
testing: add clear panic for duplicate call to t.Parallel

Change-Id: I155633b58e1823344a26c3edf11f5626fae080ee
Reviewed-on: https://go-review.googlesource.com/18204
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agoruntime/pprof: shorten a few tests
Russ Cox [Tue, 29 Dec 2015 17:33:16 +0000 (12:33 -0500)]
runtime/pprof: shorten a few tests

For #10571.

Change-Id: I4bdad64e2dfd692ef2adccf2e5e82e9b1996a8ea
Reviewed-on: https://go-review.googlesource.com/18206
Reviewed-by: Austin Clements <austin@google.com>
Run-TryBot: Austin Clements <austin@google.com>

9 years agocmd/link: use current GOROOT for source file paths for standard library
Russ Cox [Tue, 29 Dec 2015 15:16:40 +0000 (10:16 -0500)]
cmd/link: use current GOROOT for source file paths for standard library

This CL changes the source file information in the
standard library's .a files to say "$GOROOT/src/runtime/chan.go"
(with a literal "$GOROOT") instead of spelling out the actual directory.
The linker then substitutes the actual $GOROOT (or $GOROOT_FINAL)
as appropriate.

If people download a binary distribution to an alternate location,
following the instructions at https://golang.org/doc/install#install,
the code before this CL would end up with source paths pointing to
/usr/local/go no matter where the actual sources were.
Now the source paths for built binaries will point to the actual sources
(hopefully).

The source line information in distributed binaries is not affected:
those will still say /usr/local/go. But binaries people build themselves
(their own programs, not the go distribution programs) will be correct.

Fixing this path also fixes the lookup of the runtime-gdb.py file.

Fixes #5533.

Change-Id: I03729baae3fbd8cd636e016275ee5ad2606e4663
Reviewed-on: https://go-review.googlesource.com/18200
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agobuild: prevent the entire repo to be wiped out by cgo test scripts
Didier Spezia [Sat, 2 Jan 2016 14:26:13 +0000 (14:26 +0000)]
build: prevent the entire repo to be wiped out by cgo test scripts

Following the parallelization of some tests, a race condition can
occur in testcarchive, testshared and testcshared.

In some cases, it can result in the go env GOROOT command returning
corrupted data, which are then passed to a rm command.

Make the shell script more robust by not trusting the result of
the go env GOROOT command. It does not really fix the issue, but
at least prevent the entire repository to be deleted.

Updates #13789

Change-Id: Iaf04a7bd078ed3a82e724e35c4b86e6f756f2a2f
Reviewed-on: https://go-review.googlesource.com/18173
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agonet/http: deflake tests in full mode after t.Parallel additions
Brad Fitzpatrick [Mon, 4 Jan 2016 18:27:51 +0000 (18:27 +0000)]
net/http: deflake tests in full mode after t.Parallel additions

https://golang.org/cl/18087 added a bunch of t.Parallel calls, which
aren't compatible with the afterTest func. But in short mode, afterTest
is a no-op. To keep all.bash (short mode) fast, conditionally set
t.Parallel when in short mode, but keep it unset for compatibility with
afterFunc otherwise.

Fixes #13804

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

9 years agoruntime: remove now-unused test string constants
Ian Lance Taylor [Fri, 1 Jan 2016 23:50:23 +0000 (15:50 -0800)]
runtime: remove now-unused test string constants

Change-Id: I491197e1505d02cd107a8788e5377cf1d0a9828c
Reviewed-on: https://go-review.googlesource.com/18157
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agoruntime: implement setsigstack for Solaris
Ian Lance Taylor [Sun, 3 Jan 2016 03:39:37 +0000 (19:39 -0800)]
runtime: implement setsigstack for Solaris

Change-Id: I0280d478b7d0a59d8e2082aa87fab6d7d9f36a18
Reviewed-on: https://go-review.googlesource.com/18158
Reviewed-by: Aram Hăvărneanu <aram@mgk.ro>
9 years agodoc: fix typo in install-source.html.
Benny Siegert [Sun, 3 Jan 2016 20:34:49 +0000 (21:34 +0100)]
doc: fix typo in install-source.html.

Change-Id: I6ea7339ff9412111319e46f2962c6b3880987a1e
Reviewed-on: https://go-review.googlesource.com/18174
Reviewed-by: Minux Ma <minux@golang.org>
9 years agoruntime: treat SIGTSTP/SIGCANCEL on Solaris as we do on GNU/Linux
Ian Lance Taylor [Thu, 31 Dec 2015 20:09:49 +0000 (12:09 -0800)]
runtime: treat SIGTSTP/SIGCANCEL on Solaris as we do on GNU/Linux

Change-Id: I617abd53f5fc883b972a1ef090886b85607e00bb
Reviewed-on: https://go-review.googlesource.com/18155
Reviewed-by: Aram Hăvărneanu <aram@mgk.ro>
9 years agodoc: fix typo
Shenghou Ma [Thu, 31 Dec 2015 16:25:51 +0000 (11:25 -0500)]
doc: fix typo

Fixes #13780.

Change-Id: I629e2ba79b74d693e04c3747812c9a686cae5335
Reviewed-on: https://go-review.googlesource.com/18218
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agodoc: 2016 is the Year of the Gopher.
David Symonds [Thu, 31 Dec 2015 13:00:00 +0000 (00:00 +1100)]
doc: 2016 is the Year of the Gopher.

Change-Id: I85caba8c743dcd82954de75df947053b3d206bdc
Reviewed-on: https://go-review.googlesource.com/18117
Reviewed-by: Minux Ma <minux@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
9 years agoos: change Open(`C:`) to open current directory on C:
Alex Brainman [Wed, 30 Dec 2015 01:13:21 +0000 (12:13 +1100)]
os: change Open(`C:`) to open current directory on C:

Open(`C:`) currently opens root directory on C:. Change that to open
current directory on C:. Just like cmd.exe's "dir C:" command does.
Just like FindFirstFile("C:*") Windows API does. It is also consistent
with what filepath.Join("C:", "a") currently does.

Fixes #13763

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

9 years agodatabase/sql: fix doc typos
Evan Shaw [Wed, 30 Dec 2015 00:23:11 +0000 (13:23 +1300)]
database/sql: fix doc typos

Change-Id: I374dabed6bf9783839d637e9d7fd6f4e61c7eecf
Reviewed-on: https://go-review.googlesource.com/18183
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agoos: fix race condition between (*os.File).Stat and os.Chdir on windows
Hiroshi Ioka [Mon, 28 Dec 2015 12:35:48 +0000 (21:35 +0900)]
os: fix race condition between (*os.File).Stat and os.Chdir on windows

Fixes #13752

Change-Id: I53cfc4ecae90c35b6f1074f3be08489c408a6464
Reviewed-on: https://go-review.googlesource.com/18181
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
9 years agoruntime: move test programs out of source code, coalesce
Russ Cox [Mon, 21 Dec 2015 15:29:21 +0000 (10:29 -0500)]
runtime: move test programs out of source code, coalesce

Now there are just three programs to compile instead of many,
and repeated tests can reuse the compilation result instead of
rebuilding it.

Combined, these changes reduce the time spent testing runtime
during all.bash on my laptop from about 60 to about 30 seconds.
(All.bash itself runs in 5½ minutes.)

For #10571.

Change-Id: Ie2c1798b847f1a635a860d11dcdab14375319ae9
Reviewed-on: https://go-review.googlesource.com/18085
Reviewed-by: Austin Clements <austin@google.com>
Run-TryBot: Austin Clements <austin@google.com>

9 years agonet/http: update docs on Request.Proto, ProtoMajor, ProtoMinor
Brad Fitzpatrick [Tue, 29 Dec 2015 17:54:16 +0000 (09:54 -0800)]
net/http: update docs on Request.Proto, ProtoMajor, ProtoMinor

Change-Id: I4a6928b4674b6aaab3611cad7526347923a0015f
Reviewed-on: https://go-review.googlesource.com/18153
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agocmd/dist: apply final edits from CL 18199.
Russ Cox [Tue, 22 Dec 2015 01:42:40 +0000 (20:42 -0500)]
cmd/dist: apply final edits from CL 18199.

I broke the rule: never click the Submit button on the web.

Change-Id: If81a5cc31c1f28664960bad124cc596f5cab1222
Reviewed-on: https://go-review.googlesource.com/18203
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agocmd/dist: run shards of test dir in parallel
Russ Cox [Tue, 22 Dec 2015 01:42:40 +0000 (20:42 -0500)]
cmd/dist: run shards of test dir in parallel

Saves 15 seconds from all.bash on my laptop (3:20 -> 3:05).

Change-Id: Ic5dc3c7804e78b584789dd856a3dada94000a8e2
Reviewed-on: https://go-review.googlesource.com/18199
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocmd/dist: run wiki, shootout etc tests only on builders
Russ Cox [Mon, 21 Dec 2015 21:15:36 +0000 (16:15 -0500)]
cmd/dist: run wiki, shootout etc tests only on builders

These find approximately nothing.
Takes 5% off my all.bash run time.

For #10571.

Change-Id: I21d3a844af756eb37f59bba0064f24995626da0d
Reviewed-on: https://go-review.googlesource.com/18198
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocmd/dist: run various one-off tests in parallel
Russ Cox [Mon, 21 Dec 2015 21:08:57 +0000 (16:08 -0500)]
cmd/dist: run various one-off tests in parallel

Takes 15% off my all.bash run time
(after this and earlier CLs, now down to 3½ from 5½ minutes).

For #10571.

Change-Id: Iac316ffb730c9ff0a0faa7cc3b82ed4f7e6d4361
Reviewed-on: https://go-review.googlesource.com/18088
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agocmd/dist: run limited tests in race and libgcc=none modes
Russ Cox [Mon, 21 Dec 2015 18:49:12 +0000 (13:49 -0500)]
cmd/dist: run limited tests in race and libgcc=none modes

Mostly we just care that the test binaries link and start up.
No need to run the full test suites.

Takes 12% off my all.bash run time.

For #10571.

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

9 years agobuild: shorten a few packages with long tests
Russ Cox [Mon, 21 Dec 2015 18:50:06 +0000 (13:50 -0500)]
build: shorten a few packages with long tests

Takes 3% off my all.bash run time.

For #10571.

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

9 years agoapi/go1.6.txt: add debug.SetTraceback, build.Package.InvalidGoFiles
Russ Cox [Fri, 18 Dec 2015 20:50:43 +0000 (15:50 -0500)]
api/go1.6.txt: add debug.SetTraceback, build.Package.InvalidGoFiles

Change-Id: Ib00e866e29681631f6fa3a14e7d81c25fc3c8500
Reviewed-on: https://go-review.googlesource.com/18052
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocmd/dist: make test default to --no-rebuild
Russ Cox [Sun, 20 Dec 2015 19:29:20 +0000 (14:29 -0500)]
cmd/dist: make test default to --no-rebuild

I'm tired of having to remember it on every command.
Rebuilding everything is the wrong default.

This CL updates the build script, but the builders may
(or may not) need work, depending on whether they
rebuild using the test command (I doubt it).

Change-Id: I21f202a2f13e73df3f6bd54ae6a317c467b68151
Reviewed-on: https://go-review.googlesource.com/18084
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agoos: add missing copyright notice
Mikio Hara [Tue, 29 Dec 2015 08:52:33 +0000 (17:52 +0900)]
os: add missing copyright notice

Change-Id: I496b701e2fcc944c764002643c7b0b2ce9e08806
Reviewed-on: https://go-review.googlesource.com/18182
Reviewed-by: Dave Cheney <dave@cheney.net>
9 years agoruntime: fix, simplify, and improve scan state in goroutine header
Austin Clements [Mon, 21 Dec 2015 19:26:33 +0000 (11:26 -0800)]
runtime: fix, simplify, and improve scan state in goroutine header

Currently goroutineheader goes through some convolutions to *almost*
print the scan state of a G. However, the code path that would print
the scan state of the G refers to gStatusStrings where it almost
certainly meant to refer to gScanStatusStrings (which is unused), so
it winds up printing the regular status string without the scan state
either way. Furthermore, if the G is in _Gwaiting, we override the
status string and lose where this would indicate the scan state if it
worked.

This commit fixes this so the runtime prints the scan state. However,
rather than using a parallel list of status strings, this simply adds
a conditional print if the scan bit is set. This lets us remove the
string list, prints the scan state even in _Gwaiting, and lets us
strip off the scan bit at the beginning of the function, which
simplifies the rest of it.

Change-Id: Ic0adbe5c05abf4adda93da59f93b578172b28e3d
Reviewed-on: https://go-review.googlesource.com/18092
Reviewed-by: Keith Randall <khr@golang.org>
9 years agoruntime: fix sigaltstack test Skipf format string
Dan Peterson [Thu, 24 Dec 2015 18:26:02 +0000 (14:26 -0400)]
runtime: fix sigaltstack test Skipf format string

Change-Id: I9485ecbd9d546893e4f0db846b08d835fa7515d7
Reviewed-on: https://go-review.googlesource.com/18140
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agoruntime: adjust gsignal stack to current signal stack
Ian Lance Taylor [Tue, 22 Dec 2015 06:27:01 +0000 (22:27 -0800)]
runtime: adjust gsignal stack to current signal stack

If non-Go code calls sigaltstack before a signal is received, use
sigaltstack to determine the current signal stack and set the gsignal
stack to use it.  This makes the Go runtime more robust in the face of
non-Go code.  We still can't handle a disabled signal stack or a signal
triggered with SA_ONSTACK clear, but we now give clear errors for those
cases.

Fixes #7227.
Update #9896.

Change-Id: Icb1607e01fd6461019b6d77d940e59b3aed4d258
Reviewed-on: https://go-review.googlesource.com/18102
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Mikio Hara <mikioh.mikioh@gmail.com>
9 years agoimage/color: have NYCbCrA.RGBA work in 16-bit color.
Nigel Tao [Wed, 23 Dec 2015 06:35:46 +0000 (17:35 +1100)]
image/color: have NYCbCrA.RGBA work in 16-bit color.

This makes NYCbCrA consistent with YCbCr.

Fixes #13706.

Change-Id: Ifced84372e4865925fa6efef9ca2f1de43da70e0
Reviewed-on: https://go-review.googlesource.com/18115
Reviewed-by: Rob Pike <r@golang.org>
9 years agonet/http: fix typo in docstring
Jonathan Boulle [Wed, 23 Dec 2015 22:56:47 +0000 (23:56 +0100)]
net/http: fix typo in docstring

s/activitiy/activity

Change-Id: Ib2bbc929b38b1993000da57daed2d795f4a93997
Reviewed-on: https://go-review.googlesource.com/18131
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocrypto/cipher: fix typo from last change
Rob Pike [Tue, 22 Dec 2015 23:24:21 +0000 (15:24 -0800)]
crypto/cipher: fix typo from last change

s/encrypt/decrypt/

The text is unsafe to cut and paste...

Change-Id: Iab19ddf8182d087e9a4b4d34a9eeabd1d2aa02d6
Reviewed-on: https://go-review.googlesource.com/18104
Reviewed-by: Rob Pike <r@golang.org>
9 years agocrypto/cipher: improve documentation for AEAD
Rob Pike [Tue, 22 Dec 2015 20:46:23 +0000 (12:46 -0800)]
crypto/cipher: improve documentation for AEAD

Give a link to the wikipedia page describing the mechanism and
explain better how to use the same buffer for input and output.

Change-Id: If6dfd6cf9c6dff0517cb715f60a11349dbdd91e0
Reviewed-on: https://go-review.googlesource.com/18103
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agomisc/cgo/testcarchive: skip test4 on darwin/{arm,arm64}
Ian Lance Taylor [Mon, 21 Dec 2015 18:10:17 +0000 (10:10 -0800)]
misc/cgo/testcarchive: skip test4 on darwin/{arm,arm64}

Fixes #13701.

Change-Id: I9825864d23aeba1971cf5f581e1e59ac4c9b87fd
Reviewed-on: https://go-review.googlesource.com/18090
Reviewed-by: David Crawshaw <crawshaw@golang.org>
9 years agonet: fix race in TestTCPStress
Mikio Hara [Tue, 22 Dec 2015 00:35:27 +0000 (09:35 +0900)]
net: fix race in TestTCPStress

Fixes #13704.

Change-Id: I7afef5058fa88b0de41213cf46219b684369f47f
Reviewed-on: https://go-review.googlesource.com/18111
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agonet/internal/socktest: simplify log message format
Mikio Hara [Mon, 21 Dec 2015 07:35:05 +0000 (16:35 +0900)]
net/internal/socktest: simplify log message format

This change replaces the existing log format separated by commas and
spaces with space-separated one.

Change-Id: I9a4b38669025430190c9a1a6b5c82b862866559d
Reviewed-on: https://go-review.googlesource.com/17999
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agonet/http: add new HTTP 451 status code, Unavailable For Legal Reasons.
David Symonds [Tue, 22 Dec 2015 00:29:25 +0000 (11:29 +1100)]
net/http: add new HTTP 451 status code, Unavailable For Legal Reasons.

Approved by the IETF.

https://datatracker.ietf.org/doc/draft-ietf-httpbis-legally-restricted-status/

Change-Id: I688597bb5f7ef7c7a9be660a4fcd2ef02d9dc9f4
Reviewed-on: https://go-review.googlesource.com/18112
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: David Symonds <dsymonds@golang.org>

9 years agotest: add test that gccgo miscompiled
Ian Lance Taylor [Mon, 21 Dec 2015 22:38:25 +0000 (14:38 -0800)]
test: add test that gccgo miscompiled

Change-Id: Ic3f006f86a86de628e14b107f88a5923ea856a58
Reviewed-on: https://go-review.googlesource.com/18093
Reviewed-by: David Symonds <dsymonds@golang.org>
9 years agocmd/compile: const name and label name may match
Robert Griesemer [Fri, 18 Dec 2015 22:21:41 +0000 (14:21 -0800)]
cmd/compile: const name and label name may match

Fixes #13684.

Change-Id: I3977119b6eb1d6b7dc2ea1e7d6656a8f0d421bc1
Reviewed-on: https://go-review.googlesource.com/18060
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
9 years agonet: make use of IPv4 for parsing routing information on windows
Mikio Hara [Fri, 18 Dec 2015 03:39:57 +0000 (12:39 +0900)]
net: make use of IPv4 for parsing routing information on windows

In general the package net deals IPv4 addresses as IPv6 IPv4-mapped
addresses internally for the dual stack era, when we need to support
various techniques on IPv4/IPv6 translation.

This change makes windows implementation follow the same pattern which
BSD variants and Linux do.

Updates #13544.

Also fixes an unintentionally formatted line by accident by gofmt.

Change-Id: I4953796e751fd8050c73094468a0d7b0d33f5516
Reviewed-on: https://go-review.googlesource.com/17992
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
9 years agonet: adjust TestInterfaceHardwareAddrWithGetmac
Alex Brainman [Sat, 19 Dec 2015 06:42:16 +0000 (17:42 +1100)]
net: adjust TestInterfaceHardwareAddrWithGetmac

CL skips interfaces that are not listed on getmac output.

Fixes #13606

Change-Id: Ic25c9dc95e8eeff4d84b78e99131a4f97020164c
Reviewed-on: https://go-review.googlesource.com/17994
Reviewed-by: Mikio Hara <mikioh.mikioh@gmail.com>
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>

9 years agoapi: fix typo in README
Shenghou Ma [Sat, 19 Dec 2015 04:00:12 +0000 (23:00 -0500)]
api: fix typo in README

Fixes #13690.

Change-Id: I3b9b993a2e7ecf07bab7d1935d4c83a86bc6ba3a
Reviewed-on: https://go-review.googlesource.com/18054
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
9 years agoruntime: for c-archive/c-shared, don't install unnecessary signal handlers
Ian Lance Taylor [Wed, 16 Dec 2015 20:16:17 +0000 (12:16 -0800)]
runtime: for c-archive/c-shared, don't install unnecessary signal handlers

Only install signal handlers for synchronous signals that become
run-time panics.  Set the SA_ONSTACK flag for other signal handlers as
needed.

Fixes #13028.
Update #12465.
Update #13034.
Update #13042.

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

9 years agodoc: change go1.6 http heading
Brad Fitzpatrick [Thu, 17 Dec 2015 21:34:41 +0000 (13:34 -0800)]
doc: change go1.6 http heading

Reapply golang.org/cl/17918

Change-Id: I0df40585cdd4dae8d365ed9860a81e0cb23f21b9
Reviewed-on: https://go-review.googlesource.com/18032
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agoruntime: write sigsetstack for Darwin, fix sigaction arg
Ian Lance Taylor [Thu, 17 Dec 2015 22:49:34 +0000 (14:49 -0800)]
runtime: write sigsetstack for Darwin, fix sigaction arg

It turns out that the second argument for sigaction on Darwin has a
different type than the first argument.  The second argument is the user
visible sigaction struct, and does not have the sa_tramp field.

I base this on
  http://www.opensource.apple.com/source/Libc/Libc-1081.1.3/sys/sigaction.c
not to mention actual testing.

While I was at it I removed a useless memclr in setsig, a relic of the C
code.

This CL is Darwin-specific changes.  The tests for this CL are in
https://golang.org/cl/17903 .

Change-Id: I61fe305c72311df6a589b49ad7b6e49b6960ca24
Reviewed-on: https://go-review.googlesource.com/18015
Reviewed-by: David Crawshaw <crawshaw@golang.org>
9 years agodoc: add mention of debug.SetTraceback
Russ Cox [Fri, 18 Dec 2015 16:29:15 +0000 (11:29 -0500)]
doc: add mention of debug.SetTraceback

Change-Id: I59829029769ae08c6c54208a1e38a0794868c5db
Reviewed-on: https://go-review.googlesource.com/18045
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agotesting: use debug.SetTraceback("all") to show all goroutines at test timeout
Russ Cox [Fri, 18 Dec 2015 16:24:55 +0000 (11:24 -0500)]
testing: use debug.SetTraceback("all") to show all goroutines at test timeout

Fixes #13681.

Change-Id: I308930f4d9200fbe0f09cd08c38392ca1bb0db67
Reviewed-on: https://go-review.googlesource.com/18044
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
9 years agoruntime/debug: add SetTraceback
Russ Cox [Fri, 18 Dec 2015 16:19:38 +0000 (11:19 -0500)]
runtime/debug: add SetTraceback

Programs that call panic to crash after detecting a serious problem
may wish to use SetTraceback to force printing of all goroutines first.

Change-Id: Ib23ad9336f405485aabb642ca73f454a14c8baf3
Reviewed-on: https://go-review.googlesource.com/18043
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agodebug/elf: rename Chdr64.Reserved to _
Austin Clements [Fri, 18 Dec 2015 17:53:25 +0000 (09:53 -0800)]
debug/elf: rename Chdr64.Reserved to _

This future-proofs the Chdr64 structure against later versions of ELF
defining this field and declutters the documentation without changing
the layout of the struct.

This structure does not exist in the current release, so this change
is safe.

Change-Id: I239aad7243ddaf063a1f8cd521d8a50b30413281
Reviewed-on: https://go-review.googlesource.com/18028
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agocmd/go: ignore XML errors after Go <meta> tags
Russ Cox [Fri, 18 Dec 2015 19:30:12 +0000 (14:30 -0500)]
cmd/go: ignore XML errors after Go <meta> tags

Fixes #13683.

Change-Id: I26afb3ac346beb95624f9032d94a29b5bc7853ef
Reviewed-on: https://go-review.googlesource.com/18051
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agobytes: document that buffer is reused in Truncate and Reset
Joe Tsai [Fri, 18 Dec 2015 18:24:36 +0000 (10:24 -0800)]
bytes: document that buffer is reused in Truncate and Reset

Fixes #13671

Change-Id: Ic752de6a3030ff25474717505fa05895054217e7
Reviewed-on: https://go-review.googlesource.com/18029
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agonet/http: document that Server.TLSNextProto has automatic HTTP/2 also
Brad Fitzpatrick [Fri, 18 Dec 2015 18:26:51 +0000 (18:26 +0000)]
net/http: document that Server.TLSNextProto has automatic HTTP/2 also

Copy the same sentence from Transport.TLSNextProto.

Change-Id: Ib67bf054e891a68be8ba466a8c52968363374d16
Reviewed-on: https://go-review.googlesource.com/18031
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agocmd/go: do not skip dirs with syntax errors in wildcard matching (like ./...)
Russ Cox [Thu, 17 Dec 2015 18:16:25 +0000 (13:16 -0500)]
cmd/go: do not skip dirs with syntax errors in wildcard matching (like ./...)

Fixes #11407.

Change-Id: If35a8e04a3abf8acf955250c909dde57131b6bb8
Reviewed-on: https://go-review.googlesource.com/17971
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agoruntime: document stack barrier synchronization rules
Austin Clements [Fri, 18 Dec 2015 00:31:56 +0000 (16:31 -0800)]
runtime: document stack barrier synchronization rules

Change-Id: I545e53561f37bceabd26d814d272cecc3ff19847
Reviewed-on: https://go-review.googlesource.com/18024
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agoruntime: require the stack barrier lock to traceback cgo and libcalls
Austin Clements [Fri, 18 Dec 2015 00:09:38 +0000 (16:09 -0800)]
runtime: require the stack barrier lock to traceback cgo and libcalls

Currently, if sigprof determines that the G is in user code (not cgo
or libcall code), it will only traceback the G stack if it can acquire
the stack barrier lock. However, it has no such restriction if the G
is in cgo or libcall code. Because cgo calls count as syscalls, stack
scanning and stack barrier installation can occur during a cgo call,
which means sigprof could attempt to traceback a G in a cgo call while
scanstack is installing stack barriers in that G's stack. As a result,
the following sequence of events can cause the sigprof traceback to
panic with "missed stack barrier":

1. M1: G1 performs a Cgo call (which, on Windows, is any system call,
   which could explain why this is easier to reproduce on Windows).

2. M1: The Cgo call puts G1 into _Gsyscall state.

3. M2: GC starts a scan of G1's stack. It puts G1 in to _Gscansyscall
   and acquires the stack barrier lock.

4. M3: A profiling signal comes in. On Windows this is a global
   (though I don't think this matters), so the runtime stops M1 and
   calls sigprof for G1.

5. M3: sigprof fails to acquire the stack barrier lock (because the
   GC's stack scan holds it).

6. M3: sigprof observes that G1 is in a Cgo call, so it calls
   gentraceback on G1 with its Cgo transition point.

7. M3: gentraceback on G1 grabs the currently empty g.stkbar slice.

8. M2: GC finishes scanning G1's stack and installing stack barriers.

9. M3: gentraceback encounters one of the just-installed stack
   barriers and panics.

This commit fixes this by only allowing cgo tracebacks if sigprof can
acquire the stack barrier lock, just like in the regular user
traceback case.

For good measure, we put the same constraint on libcall tracebacks.
This case is probably already safe because, unlike cgo calls, libcalls
leave the G in _Grunning and prevent reaching a safe point, so
scanstack cannot run during a libcall. However, this also means that
sigprof will always acquire the stack barrier lock without contention,
so there's no cost to adding this constraint to libcall tracebacks.

Fixes #12528. For 1.5.3 (will require some backporting).

Change-Id: Ia5a4b8e3d66b23b02ffcd54c6315c81055c0cec2
Reviewed-on: https://go-review.googlesource.com/18023
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agoruntime: prevent race between setNextBarrierPC and sigprof
Austin Clements [Thu, 17 Dec 2015 23:35:49 +0000 (15:35 -0800)]
runtime: prevent race between setNextBarrierPC and sigprof

Currently, setNextBarrierPC manipulates the stack barriers without
acquiring the stack barrier lock. This is mostly okay because
setNextBarrierPC also runs synchronously on the G and prevents safe
points, but this doesn't prevent a sigprof from occurring during a
setNextBarrierPC and performing a traceback.

Given that setNextBarrierPC simply sets one entry in the stack barrier
array, this is almost certainly safe in reality. However, given that
this depends on a subtle argument, which may not hold in the future,
and that setNextBarrierPC almost never happens, making it nowhere near
performance-critical, we can simply acquire the stack barrier lock and
be sure that the synchronization will work.

Updates #12528. For 1.5.3.

Change-Id: Ife696e10d969f190157eb1cbe762a2de2ebce079
Reviewed-on: https://go-review.googlesource.com/18022
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agodoc: fix typo in go1.6.html
Emmanuel Odeke [Fri, 18 Dec 2015 01:07:01 +0000 (18:07 -0700)]
doc: fix typo in go1.6.html

Change-Id: I7405cf6f65bccbb07a27f2dc2e3802cab591e296
Reviewed-on: https://go-review.googlesource.com/18030
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocmd/vet: add some checks for invalid pointer passing using cgo
Ian Lance Taylor [Wed, 18 Nov 2015 19:09:43 +0000 (11:09 -0800)]
cmd/vet: add some checks for invalid pointer passing using cgo

Update #12416.

Change-Id: I21d97cbe211ccc8048e5a78ea4d89664f4d195ba
Reviewed-on: https://go-review.googlesource.com/17041
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agotest: fix linkmain test
Shenghou Ma [Thu, 17 Dec 2015 21:37:30 +0000 (16:37 -0500)]
test: fix linkmain test

Change-Id: Ie8ec4cfc68abef51e52090a75245f96af874c74a
Reviewed-on: https://go-review.googlesource.com/18000
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agogo/types: add link to tutorial
Alan Donovan [Thu, 17 Dec 2015 19:36:07 +0000 (14:36 -0500)]
go/types: add link to tutorial

Change-Id: Ic4f4bc7ea7478908716b951815280e394c55310b
Reviewed-on: https://go-review.googlesource.com/17975
Reviewed-by: Robert Griesemer <gri@golang.org>
9 years agoapi: create go1.6.txt go1.6beta1
Brad Fitzpatrick [Thu, 17 Dec 2015 22:23:08 +0000 (14:23 -0800)]
api: create go1.6.txt

Change-Id: If2b30ab412d6799c8be01eb007462d6b58660ece
Reviewed-on: https://go-review.googlesource.com/18014
Reviewed-by: Chris Broadfoot <cbro@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agosrc: remove reference to since-deleted dist -s flag
Brad Fitzpatrick [Thu, 17 Dec 2015 22:01:17 +0000 (14:01 -0800)]
src: remove reference to since-deleted dist -s flag

(Found while debugging release problems with go1.6beta1)

Updates #12002

Change-Id: Iec197a754205e7fd28be154f27f17f3315886364
Reviewed-on: https://go-review.googlesource.com/18011
Reviewed-by: Chris Broadfoot <cbro@golang.org>
9 years agodoc: change go1.6 http heading
Brad Fitzpatrick [Thu, 17 Dec 2015 21:34:41 +0000 (13:34 -0800)]
doc: change go1.6 http heading

Change-Id: Iae05082530891175e9c86da244e610bc92759561
Reviewed-on: https://go-review.googlesource.com/17918
Reviewed-by: Chris Broadfoot <cbro@golang.org>
9 years agodoc: Americanise spelling of wilful
Brad Fitzpatrick [Thu, 17 Dec 2015 21:25:02 +0000 (13:25 -0800)]
doc: Americanise spelling of wilful

Fixes #13660

Change-Id: I05bcb4efcb865192a1ef6756e9dccef83505934c
Reviewed-on: https://go-review.googlesource.com/17990
Reviewed-by: Chris Broadfoot <cbro@golang.org>
9 years agonet/http: document ResponseWriter and Handler more; add test
Brad Fitzpatrick [Thu, 17 Dec 2015 20:53:41 +0000 (20:53 +0000)]
net/http: document ResponseWriter and Handler more; add test

Update docs on ResponseWriter and Handler around concurrency.

Also add a test.

The Handler docs were old and used "object" a lot. It was also too
ServeMux-centric.

Fixes #13050
Updates #13659 (new issue found in http2 while writing the test)

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

9 years agocmd/link: reject non-package main toplevel.a file, remove dead code
Russ Cox [Thu, 17 Dec 2015 20:10:25 +0000 (15:10 -0500)]
cmd/link: reject non-package main toplevel.a file, remove dead code

The test for non-package main top-level inputs is done while parsing
the export data. Issue #13468 happened because we were not parsing
the export data when using compiler-generated archives
(that is, when using go tool compile -pack).

Fix this by parsing the export data even for archives.

However, that turns up a different problem: the export data check
reports (one assumes spurious) skew errors now, because it has
not been run since Go 1.2.
(Go 1.3 was the first release to use go tool compile -pack.)

Since the code hasn't run since Go 1.2, it can't be that important.
Since it doesn't work today, just delete it.

Figuring out how to make this code work with Robert's export
format was one of the largest remaining TODOs for that format.
Now we don't have to.

Fixes #13468 and makes the world a better place.

Change-Id: I40a4b284cf140d49d48b714bd80762d6889acdb9
Reviewed-on: https://go-review.googlesource.com/17976
Reviewed-by: Robert Griesemer <gri@golang.org>
9 years agocmd/go: for go get -insecure, do not fall back to HTTP for non-200 responses
Russ Cox [Thu, 17 Dec 2015 05:37:09 +0000 (00:37 -0500)]
cmd/go: for go get -insecure, do not fall back to HTTP for non-200 responses

Since we allow non-200 responses from HTTPS in normal operation,
it seems odd to reject them in -insecure operation.

Fixes #13037 (again).

Change-Id: Ie232f7544ab192addfad407525888db6b967befe
Reviewed-on: https://go-review.googlesource.com/17945
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocmd/go: fix processing of HTTPS 404 without -insecure
Russ Cox [Thu, 17 Dec 2015 05:21:13 +0000 (00:21 -0500)]
cmd/go: fix processing of HTTPS 404 without -insecure

The change here is to move the closeBody call into the if block.
The logging adjustments are just arranging to tell the truth:
in particular if we're not in insecure mode and we get a non-200
error then we do not actually ignore the response
(except as caused by closing the body incorrectly).

As the comment below the change indicates, it is intentional that
we process non-200 pages. The code does process them, because
the if err != nil || status != 200 block does not return.
But that block does close the body, which depending on timing
can apparently poison the later read from the body.

See #13037's initial report:

$ go get -v bosun.org/cmd/bosun/cache
Fetching https://bosun.org/cmd/bosun/cache?go-get=1
ignoring https fetch with status code 404
Parsing meta tags from https://bosun.org/cmd/bosun/cache?go-get=1 (status code 404)
import "bosun.org/cmd/bosun/cache": parsing bosun.org/cmd/bosun/cache: http: read on closed response body
package bosun.org/cmd/bosun/cache: unrecognized import path "bosun.org/cmd/bosun/cache"

The log print about ignoring the https fetch is not strictly true,
since the next thing that happened was parsing the body of that fetch.
But the read on the closed response body failed during parsing.

Moving the closeBody to happen only when we're about to discard the
result and start over (that is, only in -insecure mode) fixes the parse.

At least it should fix the parse. I can't seem to break the parse anymore,
because of #13648 (close not barring future reads anymore),
but this way is clearly better than the old way. If nothing else the old code
closed the body twice when err != nil and -insecure was not given.

Fixes #13037.

Change-Id: Idf57eceb6d5518341a2f7f75eb8f8ab27ed4e0b4
Reviewed-on: https://go-review.googlesource.com/17944
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agoRevert "cmd/go: allow omitted user name in git ssh repo syntax"
Russ Cox [Thu, 17 Dec 2015 20:25:33 +0000 (20:25 +0000)]
Revert "cmd/go: allow omitted user name in git ssh repo syntax"

This caused #13657.
Reverting fixes #13657.

I was trying to be helpful by fixing #12313,
but I don't need the fix myself.
Will leave for someone with more motivation.

This reverts commit 3e9f0636709de7cd86a08785f2e64487580bf5ea.

Change-Id: Ifc78a6196f23e0f58e3b9ad7340e207a2d5de0a6
Reviewed-on: https://go-review.googlesource.com/17977
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agonet/http: don't accept invalid bytes in server request headers
Brad Fitzpatrick [Thu, 17 Dec 2015 19:25:51 +0000 (19:25 +0000)]
net/http: don't accept invalid bytes in server request headers

Fixes #11207

Change-Id: I7f00b638e749fbc7907dc1597347ea426367d13e
Reviewed-on: https://go-review.googlesource.com/17980
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agonet/http: be more consistent about Request.Method "" vs "GET"
Brad Fitzpatrick [Thu, 17 Dec 2015 19:36:43 +0000 (19:36 +0000)]
net/http: be more consistent about Request.Method "" vs "GET"

Patch from Russ.

No bug identified, but I didn't search exhaustively. The new code is
easier to read.

Fixes #13621

Change-Id: Ifda936e4101116fa254ead950b5fe06adb14e977
Reviewed-on: https://go-review.googlesource.com/17981
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agocmd/go: fix git submodule fetch
Russ Cox [Thu, 17 Dec 2015 19:33:06 +0000 (14:33 -0500)]
cmd/go: fix git submodule fetch

Thanks to @toxeus on GitHub for the test case.

Fixes #12612.

Change-Id: I0c32fbe5044f3552053460a5347c062568093dff
Reviewed-on: https://go-review.googlesource.com/17974
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agonet/http: update bundled http2, add tests reading response Body after Close
Brad Fitzpatrick [Thu, 17 Dec 2015 17:56:46 +0000 (17:56 +0000)]
net/http: update bundled http2, add tests reading response Body after Close

Updates to golang.org/x/net/http2 git rev 28273ec9 for
https://golang.org/cl/17937

Fixes #13648

Change-Id: I27c77524b2e4a172c5f8be08f6fbb0f2e2e4b200
Reviewed-on: https://go-review.googlesource.com/17938
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>

9 years agocmd/go: runtime and runtime/internal packages depend on runtime/internal/sys
Ian Lance Taylor [Thu, 17 Dec 2015 18:29:12 +0000 (10:29 -0800)]
cmd/go: runtime and runtime/internal packages depend on runtime/internal/sys

Fixes #13655.

Change-Id: I764019aecdd59743baa436b7339499e6c2126268
Reviewed-on: https://go-review.googlesource.com/17916
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agocmd/go: respect umask when creating executables
Russ Cox [Thu, 17 Dec 2015 06:38:14 +0000 (01:38 -0500)]
cmd/go: respect umask when creating executables

Also update many call sites where I forgot that the permission
argument is going to be masked by umask.

Fixes #12692.

Change-Id: I52b315b06236122ca020950447863fa396b68abd
Reviewed-on: https://go-review.googlesource.com/17950
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agonet: fix the build even harder
Brad Fitzpatrick [Thu, 17 Dec 2015 18:14:52 +0000 (18:14 +0000)]
net: fix the build even harder

Should fix nacl.

Follow-up to
https://golang.org/cl/17936 (fix race) and
https://golang.org/cl/17914 (fix build) for
https://golang.org/cl/16953 (broke the build)

Third time's a charm.

Change-Id: I23930d5cff4235209546952ce2231f165ab5bf8a
Reviewed-on: https://go-review.googlesource.com/17939
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agoruntime: disable gdb test when a GOROOT_FINAL move is pending
Russ Cox [Thu, 17 Dec 2015 15:45:50 +0000 (10:45 -0500)]
runtime: disable gdb test when a GOROOT_FINAL move is pending

Fixes #13577.

Change-Id: I0bb8157d6210b0c7c09380c2163b7d7349495732
Reviewed-on: https://go-review.googlesource.com/17970
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agonet/http: updated bundled http2 to finish trailer support
Brad Fitzpatrick [Thu, 17 Dec 2015 16:45:31 +0000 (16:45 +0000)]
net/http: updated bundled http2 to finish trailer support

This updates the bundled copy of x/net/http2 to git rev d2ecd08
for https://golang.org/cl/17912 (http2: send client trailers)
and enables the final Trailer test for http2.

Fixes #13557

Change-Id: Iaa15552b82bf7a2cb01b7787a2e1ec5ee680a9d3
Reviewed-on: https://go-review.googlesource.com/17935
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agonet: include both ipv4 and ipv6 netsh output in TestInterfacesWithNetsh
Alex Brainman [Tue, 15 Dec 2015 01:03:47 +0000 (12:03 +1100)]
net: include both ipv4 and ipv6 netsh output in TestInterfacesWithNetsh

Also include test for interface state (up or down).

Updates #13606

Change-Id: I03538d65525ddd9c2d0254761861c2df7fc5bd5a
Reviewed-on: https://go-review.googlesource.com/17850
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Mikio Hara <mikioh.mikioh@gmail.com>
Run-TryBot: Russ Cox <rsc@golang.org>

9 years agonet: fix race in test
Brad Fitzpatrick [Thu, 17 Dec 2015 16:50:03 +0000 (16:50 +0000)]
net: fix race in test

Fixes race builders, broken in https://golang.org/cl/16953

Change-Id: Id61171672b69d0ca412de4b44bf2c598fe557906
Reviewed-on: https://go-review.googlesource.com/17936
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agocmd/go: allow ~ as first char of path element in general git import paths
Russ Cox [Thu, 17 Dec 2015 06:53:47 +0000 (01:53 -0500)]
cmd/go: allow ~ as first char of path element in general git import paths

This makes go get gitserver/~user/repo.git/foo work.

Fixes #9193.

Change-Id: I8c9d4096903288f7f0e82d6ed1aa78bf038fb81a
Reviewed-on: https://go-review.googlesource.com/17952
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocmd/go: don't be clever about mtime precision in test
Russ Cox [Thu, 17 Dec 2015 07:07:56 +0000 (02:07 -0500)]
cmd/go: don't be clever about mtime precision in test

This doesn't happen enough in the tests to be worth debugging.
Empirically, I expect this to add 5 seconds to the overall 'go test -short cmd/go'
on systems with precise file systems, and nothing on systems without them
(like my Mac).

Fixes #12205.

Change-Id: I0a17cb37bdedcfc0f921c5ee658737f1698c153b
Reviewed-on: https://go-review.googlesource.com/17953
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agocmd/go: document that package documentation is ignored
Russ Cox [Thu, 17 Dec 2015 07:24:07 +0000 (02:24 -0500)]
cmd/go: document that package documentation is ignored

Fixes #11801.

Change-Id: I2caeac7fdddc7f29015d6db8d4b3e296c8b9c423
Reviewed-on: https://go-review.googlesource.com/17954
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agonet/http: document a few ServeMux behaviors
Russ Cox [Thu, 17 Dec 2015 07:34:29 +0000 (02:34 -0500)]
net/http: document a few ServeMux behaviors

Fixes #13639.
Fixes #11757.

Change-Id: Iecf9ebcd652c23c96477305a41082e5b63b41d83
Reviewed-on: https://go-review.googlesource.com/17955
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocmd/go: allow omitted user name in git ssh repo syntax
Russ Cox [Thu, 17 Dec 2015 06:41:15 +0000 (01:41 -0500)]
cmd/go: allow omitted user name in git ssh repo syntax

No test because the code has no test.

Fixes #12313.

Change-Id: I2cfd0a0422c0cd76f0371c2d3bbbdf5bb3b3f1eb
Reviewed-on: https://go-review.googlesource.com/17951
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocmd/go: document that tests run in the source directory
Russ Cox [Thu, 17 Dec 2015 06:04:06 +0000 (01:04 -0500)]
cmd/go: document that tests run in the source directory

Fixes #13538.

Change-Id: I621bbe2befe838d16d3664d7a5e30d5d7cceae33
Reviewed-on: https://go-review.googlesource.com/17949
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocmd/go: document where get writes, and not vendor directories
Russ Cox [Thu, 17 Dec 2015 06:00:14 +0000 (01:00 -0500)]
cmd/go: document where get writes, and not vendor directories

Fixes #12260.

Change-Id: I95c27aad6de8064b9a205d4ee507bce75926f16d
Reviewed-on: https://go-review.googlesource.com/17948
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocmd/go: document that go generate accepts all build flags
Russ Cox [Thu, 17 Dec 2015 05:54:45 +0000 (00:54 -0500)]
cmd/go: document that go generate accepts all build flags

Fixes #12544.

Change-Id: I5e2fd1fbb21816e9f6fb022e2664484a71093b04
Reviewed-on: https://go-review.googlesource.com/17947
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>