1
0
mirror of https://github.com/golang/go synced 2024-10-04 17:21:20 -06:00
Commit Graph

23073 Commits

Author SHA1 Message Date
Marcel van Lohuizen
23cb8864b5 runtime: use Run for more benchmarks
Names for Append?Bytes are slightly changed in addition to adding a slash.

Change-Id: I0291aa29c693f9040fd01368eaad9766259677df
Reviewed-on: https://go-review.googlesource.com/23426
Run-TryBot: Marcel van Lohuizen <mpvl@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-25 17:46:50 +00:00
Marcel van Lohuizen
d2aa5f95cc compress/flate: simplify using subtests and sub-benchmarks
This causes the large files to be loaded only once per benchmark.

This CL also serves as an example use case of sub(tests|-benchmarks).

This CL ensures that names are identical to the original
except for an added slashes. Things could be
simplified further if this restriction were dropped.

Change-Id: I45e303e158e3152e33d0d751adfef784713bf997
Reviewed-on: https://go-review.googlesource.com/23420
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Marcel van Lohuizen <mpvl@golang.org>
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-25 17:44:22 +00:00
Marcel van Lohuizen
89283781c6 testing: added package doc for sub(tests/benchmarks)
Change-Id: I6991cd7a41140da784a1ff8d69c5ea2032d05850
Reviewed-on: https://go-review.googlesource.com/23354
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Marcel van Lohuizen <mpvl@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-25 17:37:28 +00:00
Marcel van Lohuizen
5dd922c935 compress/lzw: use Run for benchmarks
load file only once per group.

Change-Id: I965661507055e6e100506bf14d37133ecdd2cc5e
Reviewed-on: https://go-review.googlesource.com/23423
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Marcel van Lohuizen <mpvl@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-25 17:11:12 +00:00
Marcel van Lohuizen
095fbdcc91 runtime: use of Run for some benchmarks
Names of sub-benchmarks are preserved, short of the additional slash.

Change-Id: I9b3f82964f9a44b0d28724413320afd091ed3106
Reviewed-on: https://go-review.googlesource.com/23425
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Marcel van Lohuizen <mpvl@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-25 16:49:02 +00:00
Robert Griesemer
824e1f2e08 text/scanner: better error message if no error handler is installed
This is reverting golang.org/cl/19622 and introducing "<input>"
as filename if no filename is specified.

Fixes #15813.

Change-Id: Iafc74b789fa33f48ee639c42d4aebc6f06435f95
Reviewed-on: https://go-review.googlesource.com/23402
Reviewed-by: Russ Cox <rsc@golang.org>
2016-05-25 15:44:28 +00:00
Keith Randall
786e51d7ba cmd/compile: add generated tests for constant folding
Covers a bunch of constant-folding rules in generic.rules that aren't
being covered currently.

Increases coverage in generic.rules from 65% to 72%.

Change-Id: I7bf58809faf22e97070183b42e6dd7d3f35bf5f9
Reviewed-on: https://go-review.googlesource.com/23407
Run-TryBot: Todd Neal <todd@tneal.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Todd Neal <todd@tneal.org>
2016-05-25 14:11:10 +00:00
David Crawshaw
9f38796270 reflect: remove type info for unexported methods
Also remove some of the now unnecessary corner case handling and
tests I've been adding recently for unexported method data.

For #15673

Change-Id: Ie0c7b03f2370bbe8508cdc5be765028f08000bd7
Reviewed-on: https://go-review.googlesource.com/23410
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-25 12:15:32 +00:00
Elias Naur
f2f3b6cd8f cmd/link: fix ARM gold linker check
CL 23400 introduced a check to make sure the gold linker is used
on ARM host links. The check itself works, but the error checking
logic was reversed; fix it.

I manually verified that the check now correctly rejects host links
on my RPi2 running an ancient rasbian without the gold linker
installed.

Updates #15696

Change-Id: I927832620f0a60e91a71fdedf8cbd2550247b666
Reviewed-on: https://go-review.googlesource.com/23421
Run-TryBot: Elias Naur <elias.naur@gmail.com>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-25 11:50:49 +00:00
Elias Naur
72eb46c5a0 runtime,runtime/cgo: save callee-saved FP register on arm
Other GOARCHs already handle their callee-saved FP registers, but
arm was missing. Without this change, code using Cgo and floating
point code might fail in mysterious and hard to debug ways.

There are no floating point registers when GOARM=5, so skip the
registers when runtime.goarm < 6.

darwin/arm doesn't support GOARM=5, so the check is left out of
rt0_darwin_arm.s.

Fixes #14876

Change-Id: I6bcb90a76df3664d8ba1f33123a74b1eb2c9f8b2
Reviewed-on: https://go-review.googlesource.com/23140
Run-TryBot: Elias Naur <elias.naur@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Minux Ma <minux@golang.org>
2016-05-25 06:54:28 +00:00
Ian Lance Taylor
fa3f484800 encoding/csv: clarify that this package supports RFC 4180
The intent of this comment is to reduce the number of issues opened
against the package to add support for new kinds of CSV formats, such as
issues #3150, #8458, #12372, #12755.

Change-Id: I452c0b748e4ca9ebde3e6cea188bf7774372148e
Reviewed-on: https://go-review.googlesource.com/23401
Reviewed-by: Andrew Gerrand <adg@golang.org>
2016-05-25 01:47:53 +00:00
Robert Griesemer
93e8e70499 all: fixed a handful of typos
Change-Id: Ib0683f27b44e2f107cca7a8dcc01d230cbcd5700
Reviewed-on: https://go-review.googlesource.com/23404
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-05-24 21:18:03 +00:00
Austin Clements
a640d95172 runtime: update SP when jumping stacks in traceback
When gentraceback starts on a system stack in sigprof, it is
configured to jump to the user stack when it reaches the end of the
system stack. Currently this updates the current frame's FP, but not
its SP. This is okay on non-LR machines (x86) because frame.sp is only
used to find defers, which the bottom-most frame of the user stack
will never have.

However, on LR machines, we use frame.sp to find the saved LR. We then
use to resolve the function of the next frame, which is used to
resolved the size of the next frame. Since we're not updating frame.sp
on a stack jump, we read the saved LR from the system stack instead of
the user stack and wind up resolving the wrong function and hence the
wrong frame size for the next frame.

This has had remarkably few ill effects (though the resulting profiles
must be wrong). We noticed it because of a bad interaction with stack
barriers. Specifically, once we get the next frame size wrong, we also
get the location of its LR wrong. If we happen to get a stack slot
that contains a stale stack barrier LR (for a stack barrier we already
hit) and hasn't been overwritten with something else as we re-grew the
stack, gentraceback will fail with a "found next stack barrier at ..."
error, pointing at the slot that it thinks is an LR, but isn't.

Fixes #15138.

Updates #15313 (might fix it).

Change-Id: I13cfa322b44c0c2f23ac2b3d03e12631e4a6406b
Reviewed-on: https://go-review.googlesource.com/23291
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rick Hudson <rlh@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2016-05-24 21:07:24 +00:00
Jeff R. Allen
3474610fbc math/rand: Doc fix for how many bits Seed uses
Document the fact that the default Source uses only
the bottom 31 bits of the given seed.

Fixes #15788

Change-Id: If20d1ec44a55c793a4a0a388f84b9392c2102bd1
Reviewed-on: https://go-review.googlesource.com/23352
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-24 19:07:46 +00:00
Jeff R. Allen
2f9eeea212 cmd/go: document testdata directory in "go help test"
Document the correct use of the testdata directory
where test writers might be expecting to find it.

It seems that alldocs.go was out of date, so it
has picked up some other changes with this commit.

Fixes #14715.

Change-Id: I0a22676bb7a64b2a61b56495f7ea38db889d8b37
Reviewed-on: https://go-review.googlesource.com/23353
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-24 19:05:09 +00:00
David Crawshaw
a0abecf102 cmd/link: ensure -fuse-ld=gold uses gold
Fixes #15696

Change-Id: I134e918dc56f79a72a04aa54f415371884113d2a
Reviewed-on: https://go-review.googlesource.com/23400
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-05-24 18:56:11 +00:00
Marcel van Lohuizen
7b9d3ff4cb testing: don't be silent if a test's goroutine fails a test after test exits
Fixes #15654

Change-Id: I9bdaa9b76d480d75f24d95f0235efd4a79e3593e
Reviewed-on: https://go-review.googlesource.com/23320
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Marcel van Lohuizen <mpvl@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
2016-05-24 16:27:47 +00:00
Aliaksandr Valialkin
dcc42c7d11 cmd/vet: do not check print-like functions with unknown type
Fixes #15787

Change-Id: I559ba886527b474dbdd44fe884c78973b3012377
Reviewed-on: https://go-review.googlesource.com/23351
Run-TryBot: Rob Pike <r@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
2016-05-24 16:13:44 +00:00
Russ Cox
524956f8b9 io: remove SizedReaderAt
It's not clear we want to enshrine an io interface in which Size cannot
return an error. Because this requires more thought before committing
to the API, remove from Go 1.7.

Fixes #15818.

Change-Id: Ic4138ffb0e033030145a12d33f78078350a8381f
Reviewed-on: https://go-review.googlesource.com/23392
Reviewed-by: Austin Clements <austin@google.com>
Run-TryBot: Russ Cox <rsc@golang.org>
2016-05-24 15:37:27 +00:00
Russ Cox
85e3c9e6b8 cmd/compile, go/types: omit needless word in error message
CL 21462 and CL 21463 made this message say explicitly that the problem
was a struct field in a map, but the word "directly" is unnecessary,
sounds wrong, and makes the error long.

Change-Id: I2fb68cdaeb8bd94776b8022cf3eae751919ccf6f
Reviewed-on: https://go-review.googlesource.com/23373
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: David Chase <drchase@google.com>
2016-05-24 15:07:16 +00:00
Russ Cox
34b17d4dc5 encoding/json: rename Indent method to SetIndent
CL 21057 added this method during the Go 1.7 cycle
(so it is not yet released and still possible to revise).

This makes it clearer that the method is not doing something
(like func Indent does), but just changing a setting about doing
something later.

Also document that this is in some sense irreversible.
I think that's probably a mistake but the original CL discussion
claimed it as a feature, so I'll leave it alone.

For #6492.

Change-Id: If4415c869a9196501056c143811a308822d5a420
Reviewed-on: https://go-review.googlesource.com/23295
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
2016-05-24 15:01:29 +00:00
Russ Cox
4aea7a12b6 encoding/json: change DisableHTMLEscaping to SetEscapeHTML
DisableHTMLEscaping is now SetEscapeHTML, allowing the escaping
to be toggled, not just disabled. This API is new for Go 1.7,
so there are no compatibility concerns (quite the opposite,
the point is to fix the API before we commit to it in Go 1.7).

Change-Id: I96b9f8f169a9c44995b8a157a626eb62d0b6dea7
Reviewed-on: https://go-review.googlesource.com/23293
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
2016-05-24 14:25:43 +00:00
Russ Cox
7f9255c212 net: revise IP.String result for malformed IP address to add ? back
In earlier versions of Go the result was simply "?".
A change in this cycle made the result echo back the hex bytes
of the address, which is certainly useful, but now the result is
not clearly indicating an error. Put the "?" back, at the beginning
of the hex string, to make the invalidity of the string clearer.

Change-Id: I3e0f0b6a005601cd98d982a62288551959185b40
Reviewed-on: https://go-review.googlesource.com/23376
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-24 13:54:31 +00:00
Russ Cox
8e724e7bba cmd/go: fix //go:binary-only-package check
The use of a prefix check was too liberal.
Noted in review after submit.

Change-Id: I4fe1df660997efd225609e818040b8392fab79f0
Reviewed-on: https://go-review.googlesource.com/23375
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-24 13:54:24 +00:00
Russ Cox
1261023637 encoding/json: additional tests and fixes for []typedByte encoding/decoding
CL 19725 changed the encoding of []typedByte to look for
typedByte.MarshalJSON and typedByte.MarshalText.
Previously it was handled like []byte, producing a base64 encoding of the underlying byte data.

CL 19725 forgot to look for (*typedByte).MarshalJSON and (*typedByte).MarshalText,
as the marshaling of other slices would. Add test and fix for those.

This CL also adds tests that the decoder can handle both the old and new encodings.
(This was true even in Go 1.6, which is the only reason we can consider this
not an incompatible change.)

For #13783.

Change-Id: I7cab8b6c0154a7f2d09335b7fa23173bcf856c37
Reviewed-on: https://go-review.googlesource.com/23294
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
2016-05-24 13:35:36 +00:00
Russ Cox
ab4414773e math/big: write t*10 to multiply t by 10
The compiler has caught up.
In fact the compiler is ahead; it knows about a magic multiply-by-5 instruction:

	// compute '0' + byte(r - t*10) in AX
	MOVQ	t, AX
	LEAQ	(AX)(AX*4), AX
	SHLQ	$1, AX
	MOVQ	r, CX
	SUBQ	AX, CX
	LEAL	48(CX), AX

For comparison, the shifty version compiles to:

	// compute '0' + byte(r - t*10) in AX
	MOVQ	t, AX
	MOVQ	AX, CX
	SHLQ	$3, AX
	MOVQ	r, DX
	SUBQ	AX, DX
	SUBQ	CX, DX
	SUBQ	CX, DX
	LEAL	48(DX), AX

Fixes #2671.

Change-Id: Ifbf23dbfeb19c0bb020fa44eb2f025943969fb6b
Reviewed-on: https://go-review.googlesource.com/23372
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-24 13:34:20 +00:00
Keith Randall
7a9f6c2b56 cmd/compile: benchmark needs dominator tree
Now that CSE uses dom tree to order partitions, we need the
dom tree computed before benchmarking CSE.

Fixes #15801

Change-Id: Ifa4702c7b75250f34de185e69a880b3f3cc46a12
Reviewed-on: https://go-review.googlesource.com/23361
Reviewed-by: David Chase <drchase@google.com>
2016-05-23 20:21:15 +00:00
Robert Griesemer
30fc940c70 go/types: don't drop type in n:1 var decl if one is given
In n:1 variable declarations (multiple lhs variables with single
multi-valued initialization expression) where also a variable
type is provided, make sure that that type is assigned to all
variables on the lhs before the init expression assignment is
checked. Otherwise, (some) variables are assumed to take the type
of the corresponding value of the multi-valued init expression.

Fixes #15755.

Change-Id: I969cb5a95c85e28dbb38abd7fa7df16ff5554c03
Reviewed-on: https://go-review.googlesource.com/23313
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-05-23 18:19:40 +00:00
Kenny Grant
65adb6ab9a time: run genzabbrs.go with new source data
The source xml data has changed, so running genzabbrs.go
regenerates a new time zone file in zoneinfo_abbrs_windows.go
which adds some zones and adjusts others.

Now set export ZONEINFO=$GOROOT/lib/time/zoneinfo.zip to use zoneinfo.zip in go tip.

Change-Id: I19f72359cc808094e5dcb420e480a00c6b2205d7
Reviewed-on: https://go-review.googlesource.com/23321
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-23 18:14:21 +00:00
Brad Fitzpatrick
def50f8e48 net/http: update bundled http2
Updates x/net/http2 to git rev 0c607074 for https://golang.org/cl/23311,
"http2: prevent Server from sending status 100 header after anything else"

New test is in the x/net/http2 package (not bundled to std).

Fixes #14030

Change-Id: Ifc6afa4a5fe35977135428f6d0e9f7c164767720
Reviewed-on: https://go-review.googlesource.com/23312
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-21 01:29:57 +00:00
Mikio Hara
82ec4cd79f net: don't crash DNS flood test on darwin
Also renames the test function to TestDNSFlood.

Updates #15659.

Change-Id: Ia562004c43bcc19c2fee9440321c27b591f85da5
Reviewed-on: https://go-review.googlesource.com/23077
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-05-21 00:23:53 +00:00
Brad Fitzpatrick
7ab698b022 time: document that After uses memory until duration times out
Fixes #15698

Change-Id: I616fc06dcf04092bafdaf56fb1afba2a998a6d83
Reviewed-on: https://go-review.googlesource.com/23304
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-05-20 22:51:51 +00:00
Robert Griesemer
054a721dca cmd/compile: read safemode bit from package header
Ignore respective bit in export data, but leave the info to
minimize format changes for 1.7. Scheduled to remove by 1.8.

For #15772.

Change-Id: Ifb3beea655367308a4e2d5dc8cb625915f904287
Reviewed-on: https://go-review.googlesource.com/23285
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2016-05-20 21:41:50 +00:00
Brad Fitzpatrick
cc0d8c86e3 net/http: deflake TestTransportEventTrace_h2
Fixes #15765

Change-Id: Id0a89d90ef9d3fffa9af0affca8c10a26fe6b7bc
Reviewed-on: https://go-review.googlesource.com/23284
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-05-20 21:40:02 +00:00
Brad Fitzpatrick
db5af0d711 net/http: update bundled http2
Updates x/net/http2 to git rev 4d07e8a49 for CL 23287:

   http2: let handlers close Request.Body without killing streams
   https://golang.org/cl/23287

Fixes #15425

Change-Id: I20b6e37cd09aa1d5a040c122ca0daf14b8916559
Reviewed-on: https://go-review.googlesource.com/23301
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-05-20 21:20:00 +00:00
Brad Fitzpatrick
4cad610401 os/exec: remove Cmd.RunContext and Cmd.WaitContext, add CommandContext
Fixes #15775

Change-Id: I0a6c2ca09d3850c3538494711f7a9801b9500411
Reviewed-on: https://go-review.googlesource.com/23300
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-05-20 21:19:32 +00:00
Brad Fitzpatrick
85e39f8387 net/http: also clone DynamicRecordSizingDisabled in cloneTLSConfig
Updates #15771

Change-Id: I5dad96bdca19d680dd00cbd17b72a03e43eb557e
Reviewed-on: https://go-review.googlesource.com/23283
Reviewed-by: Tom Bergan <tombergan@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
2016-05-20 17:10:18 +00:00
David Crawshaw
be1b930653 reflect: hide unexported methods that do not satisfy interfaces
Fixes #15673

Change-Id: Ib36d8db3299a93d92665dbde012d52c2c5332ac0
Reviewed-on: https://go-review.googlesource.com/23253
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-20 14:36:14 +00:00
Brad Fitzpatrick
b3bf2e7803 net/http: update bundled http2
Updates x/net/http2 to git rev 8a52c78 for golang.org/cl/23258
(http2: fix Transport.CloseIdleConnections when http1+http2 are wired together)

Fixes #14607

Change-Id: I038badc69e230715b8ce4e398eb5e6ede73af918
Reviewed-on: https://go-review.googlesource.com/23280
Reviewed-by: Andrew Gerrand <adg@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-20 05:53:06 +00:00
Jess Frazelle
1ded9fdcff syscall: fix unshare test on mips
Change-Id: Iedce3770a92112802f3a45c7b95ee145ab5b187e
Reviewed-on: https://go-review.googlesource.com/23282
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
2016-05-20 05:52:35 +00:00
Brad Fitzpatrick
16f846a9cb net/http: update bundled http2
Updates x/net/http2 to git rev 202ff482 for https://golang.org/cl/23235 (Expect:
100-continue support for HTTP/2)

Fixes a flaky test too, and changes the automatic HTTP/2 behavior to
no longer special-case the DefaultTransport, because
ExpectContinueTimeout is no longer unsupported by the HTTP/2
transport.

Fixes #13851
Fixes #15744

Change-Id: I3522aace14179a1ca070fd7063368a831167a0f7
Reviewed-on: https://go-review.googlesource.com/23254
Reviewed-by: Andrew Gerrand <adg@golang.org>
2016-05-20 02:57:18 +00:00
Mikio Hara
9cd2c700de net: deflake TestDialTimeoutMaxDuration
Fixes #15745.

Change-Id: I6f9a1dcf0b1d97cb443900c7d8da09ead83d4b6a
Reviewed-on: https://go-review.googlesource.com/23243
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-05-20 01:26:21 +00:00
Jess Frazelle
8527b8ef9b syscall: add Unshare flags to SysProcAttr on Linux
This patch adds Unshare flags to SysProcAttr for Linux systems.

Fixes #1954

Change-Id: Id819c3f92b1474e5a06dd8d55f89d74a43eb770c
Reviewed-on: https://go-review.googlesource.com/23233
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-05-20 00:51:46 +00:00
Robert Griesemer
448246adff cmd/compile: don't exit early because of hidden error messages
Non-syntax errors are always counted to determine if to exit
early, but then deduplication eliminates them. This can lead
to situations which report "too many errors" and only one
error is shown.

De-duplicate non-syntax errors early, at least the ones that
appear consecutively, and only count the ones actually being
shown. This doesn't work perfectly as they may not appear in
sequence, but it's cheap and good enough.

Fixes #14136.

Change-Id: I7b11ebb2e1e082f0d604b88e544fe5ba967af1d7
Reviewed-on: https://go-review.googlesource.com/23259
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2016-05-19 23:17:54 +00:00
Brad Fitzpatrick
dc4427f372 context: make DeadlineExceeded have a Timeout method
Fixes #14238

Change-Id: I1538bfb5cfa63e36a89df1f6eb9f5a0dcafb6ce5
Reviewed-on: https://go-review.googlesource.com/23256
Reviewed-by: Dave Cheney <dave@cheney.net>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-19 23:09:16 +00:00
Brad Fitzpatrick
0b80659832 net/http/httptest: restore historic ResponseRecorder.HeaderMap behavior
In Go versions 1 up to and including Go 1.6,
ResponseRecorder.HeaderMap was both the map that handlers got access
to, and was the map tests checked their results against. That did not
mimic the behavior of the real HTTP server (Issue #8857), so HeaderMap
was changed to be a snapshot at the first write in
https://golang.org/cl/20047. But that broke cases where the Handler
never did a write (#15560), so revert the behavior.

Instead, introduce the ResponseWriter.Result method, returning an
*http.Response. It subsumes ResponseWriter.Trailers which was added
for Go 1.7 in CL 20047. Result().Header now contains the correct
answer, and HeaderMap is unchanged in behavior from previous Go
releases, so we don't break people's tests. People wanting the correct
behavior can use ResponseWriter.Result.

Fixes #15560
Updates #8857

Change-Id: I7ea9b56a6b843103784553d67f67847b5315b3d2
Reviewed-on: https://go-review.googlesource.com/23257
Reviewed-by: Damien Neil <dneil@google.com>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-19 23:02:34 +00:00
Brad Fitzpatrick
3b50adbc4f build: unset GOBIN during build
Fixes #14340

Change-Id: I43e1624fafc972fb868708c3857fc8acf1bfbbd7
Reviewed-on: https://go-review.googlesource.com/23255
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
2016-05-19 18:40:53 +00:00
Austin Clements
44497ebacb runtime: fix goroutine priority elevation
Currently it's possible for user code to exploit the high scheduler
priority of the GC worker in conjunction with the runnext optimization
to elevate a user goroutine to high priority so it will always run
even if there are other runnable goroutines.

For example, if a goroutine is in a tight allocation loop, the
following can happen:

1. Goroutine 1 allocates, triggering a GC.
2. G 1 attempts an assist, but fails and blocks.
3. The scheduler runs the GC worker, since it is high priority.
   Note that this also starts a new scheduler quantum.
4. The GC worker does enough work to satisfy the assist.
5. The GC worker readies G 1, putting it in runnext.
6. GC finishes and the scheduler runs G 1 from runnext, giving it
   the rest of the GC worker's quantum.
7. Go to 1.

Even if there are other goroutines on the run queue, they never get a
chance to run in the above sequence. This requires a confluence of
circumstances that make it unlikely, though not impossible, that it
would happen in "real" code. In the test added by this commit, we
force this confluence by setting GOMAXPROCS to 1 and GOGC to 1 so it's
easy for the test to repeated trigger GC and wake from a blocked
assist.

We fix this by making GC always put user goroutines at the end of the
run queue, instead of in runnext. This makes it so user code can't
piggy-back on the GC's high priority to make a user goroutine act like
it has high priority. The only other situation where GC wakes user
goroutines is waking all blocked assists at the end, but this uses the
global run queue and hence doesn't have this problem.

Fixes #15706.

Change-Id: I1589dee4b7b7d0c9c8575ed3472226084dfce8bc
Reviewed-on: https://go-review.googlesource.com/23172
Reviewed-by: Rick Hudson <rlh@golang.org>
2016-05-19 18:18:13 +00:00
Austin Clements
91740582c3 runtime: add 'next' flag to ready
Currently ready always puts the readied goroutine in runnext. We're
going to have to change this for some uses, so add a flag for whether
or not to use runnext.

For now we always pass true so this is a no-op change.

For #15706.

Change-Id: Iaa66d8355ccfe4bbe347570cc1b1878c70fa25df
Reviewed-on: https://go-review.googlesource.com/23171
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rick Hudson <rlh@golang.org>
2016-05-19 18:17:58 +00:00
Ian Lance Taylor
79ba1e44c7 cmd/cgo: mark stub functions as no_sanitize_thread
When the generated stub functions write back the results to the stack,
they can in some cases be writing to the same memory on the g0 stack.
There is no race here (assuming there is no race in the Go code), but
the thread sanitizer does not know that.  Turn off the thread sanitizer
for the stub functions to prevent false positive warnings.

Current clang suggests the no_sanitize("thread") attribute, but that
does not work with clang 3.6 or GCC.  clang 3.6, GCC, and current clang
all support the no_sanitize_thread attribute, so use that
unconditionally.

The test case and first version of the patch are from Dmitriy Vyukov.

Change-Id: I80ce92824c6c8cf88ea0fe44f21cf50cf62474c9
Reviewed-on: https://go-review.googlesource.com/23252
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-19 17:29:13 +00:00
Joel Sing
0dcd330bc8 runtime/cgo: make cgo work with openbsd ABI changes
OpenBSD 6.0 (due out November 2016) will support PT_TLS, which will
allow for the OpenBSD cgo pthread_create() workaround to be removed.

However, in order for Go to continue working on supported OpenBSD
releases (the current release and the previous release - 5.9 and 6.0,
once 6.0 is released), we cannot enable PT_TLS immediately. Instead,
adjust the existing code so that it works with the previous TCB
allocation and the new TIB allocation. This allows the same Go
runtime to work on 5.8, 5.9 and later 6.0.

Once OpenBSD 5.9 is no longer supported (May 2017, when 6.1 is
released), PT_TLS can be enabled and the additional cgo runtime
code removed.

Change-Id: I3eed5ec593d80eea78c6656cb12557004b2c0c9a
Reviewed-on: https://go-review.googlesource.com/23197
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Joel Sing <joel@sing.id.au>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-19 15:43:37 +00:00
Keith Randall
d603c27c6b cmd/compile: large ptr literals must escape
They get rewritten to NEWs, and they must be marked as escaping
so walk doesn't try to allocate them back onto the stack.

Fixes #15733

Change-Id: I433033e737c3de51a9e83a5a273168dbc9110b74
Reviewed-on: https://go-review.googlesource.com/23223
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
2016-05-19 15:12:01 +00:00
Mikio Hara
1ab9428eec net: deflake TestDialerDualStack
Fixes #15316.
Fixes #15574.

Change-Id: I3ec8bffd35b9e5123de4be983a53fc0b8c2a0895
Reviewed-on: https://go-review.googlesource.com/23242
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-05-19 14:47:33 +00:00
Mikio Hara
086d7b0e9e net: deflake TestDialerDualStackFDLeak
Fixes #14717.
Updates #15157.

Change-Id: I7238b4fe39f3670c2dfe09b3a3df51a982f261ed
Reviewed-on: https://go-review.googlesource.com/23244
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-05-19 14:31:49 +00:00
Ian Lance Taylor
1f7a0d4b5e runtime: don't do a plain throw when throwsplit == true
The test case in #15639 somehow causes an invalid syscall frame. The
failure is obscured because the throw occurs when throwsplit == true,
which causes a "stack split at bad time" error when trying to print the
throw message.

This CL fixes the "stack split at bad time" by using systemstack. No
test because there shouldn't be any way to trigger this error anyhow.

Update #15639.

Change-Id: I4240f3fd01bdc3c112f3ffd1316b68504222d9e1
Reviewed-on: https://go-review.googlesource.com/23153
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
2016-05-19 04:37:45 +00:00
Scott Bell
2a12035f8e expvar: slightly expand documentation for Var's String method
Fixes #15088.

Change-Id: I7727829a4062e15c0e5e3beff4d0bfc1fa327b0f
Reviewed-on: https://go-review.googlesource.com/23232
Reviewed-by: Andrew Gerrand <adg@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-05-19 04:20:47 +00:00
Brad Fitzpatrick
255e206b2b net/http: update bundled http2
Updates x/net/http2 to git rev 5916dcb1 for:

* http2, lex/httplex: make Transport reject bogus headers before sending
  https://golang.org/cl/23229

* http2: reject more trailer values
  https://golang.org/cl/23230

Fixes #14048
Fixes #14188

Change-Id: Iaa8beca6e005267a3e849a10013eb424a882f2bb
Reviewed-on: https://go-review.googlesource.com/23234
Reviewed-by: Andrew Gerrand <adg@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-19 03:51:11 +00:00
Mikio Hara
8d428ed218 net: don't return io.EOF from zero byte reads on Plan 9
Updates #15735.
Fixes #15741.

Change-Id: Ic4ad7e948e8c3ab5feffef89d7a37417f82722a1
Reviewed-on: https://go-review.googlesource.com/23199
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-05-19 03:50:54 +00:00
Brad Fitzpatrick
5bcdd63933 net: don't return io.EOF from zero byte reads
Updates #15735

Change-Id: I42ab2345443bbaeaf935d683460fc2c941b7679c
Reviewed-on: https://go-review.googlesource.com/23227
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-05-19 01:04:49 +00:00
Ian Lance Taylor
c08436d1c8 runtime: print PC, not the counter, for a cgo traceback
Change-Id: I54ed7a26a753afb2d6a72080e1f50ce9fba7c183
Reviewed-on: https://go-review.googlesource.com/23228
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-18 23:47:13 +00:00
Ian Lance Taylor
538537a28d runtime: check only up to ptrdata bytes for pointers
Fixes #14508.

Change-Id: I237d0c5a79a73e6c97bdb2077d8ede613128b978
Reviewed-on: https://go-review.googlesource.com/23224
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
2016-05-18 23:39:06 +00:00
David Benjamin
ebbe4f8db7 crypto/tls: Never resume sessions across different versions.
Instead, decline the session and do a full handshake. The semantics of
cross-version resume are unclear, and all major client implementations
treat this as a fatal error. (This doesn't come up very much, mostly if
the client does the browser version fallback without sharding the
session cache.)

See BoringSSL's bdf5e72f50e25f0e45e825c156168766d8442dde and OpenSSL's
9e189b9dc10786c755919e6792e923c584c918a1.

Change-Id: I51ca95ac1691870dd0c148fd967739e2d4f58824
Reviewed-on: https://go-review.googlesource.com/21152
Reviewed-by: Adam Langley <agl@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-18 21:20:33 +00:00
Brad Fitzpatrick
d8bd7b24fc net/http: update bundled x/net/http2 for Server context changes
Updates x/net/http2 to golang.org/cl/23220
(http2: with Go 1.7 set Request.Context in ServeHTTP handlers)

Fixes #15134

Change-Id: I73bac2601118614528f051e85dab51dc48e74f41
Reviewed-on: https://go-review.googlesource.com/23221
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
2016-05-18 21:20:10 +00:00
Brad Fitzpatrick
1efec481d0 net/http: further restrict when Transport's automatic HTTP/2 happens
Make the temporary, conservative restrictions from rev 79d9f48c in Go
1.6 permanent, and also don't do automatic TLS if the user configured
a Dial or DialTLS hook. (Go 1.7 has Transport.Dialer instead, for
tweaking dialing parameters)

Fixes #14275

Change-Id: I5550d5c1e3a293e103eb4251a3685dc204a23941
Reviewed-on: https://go-review.googlesource.com/23222
Reviewed-by: Andrew Gerrand <adg@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-18 20:53:43 +00:00
Keith Randall
075880a8e8 cmd/compile: fix build
Run live vars test only on ssa builds.
We can't just drop KeepAlive ops during regalloc.  We need
to replace them with copies.

Change-Id: Ib4b3b1381415db88fdc2165fc0a9541b73ad9759
Reviewed-on: https://go-review.googlesource.com/23225
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2016-05-18 20:44:00 +00:00
Ian Lance Taylor
6ab45c09f6 runtime: add KeepAlive function
Fixes #13347.

Change-Id: I591a80a1566ce70efb5f68e3ad69e7e3ab98cd9b
Reviewed-on: https://go-review.googlesource.com/23102
Reviewed-by: Austin Clements <austin@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-18 20:42:37 +00:00
Keith Randall
3572c6418b cmd/compile: keep pointer input arguments live throughout function
Introduce a KeepAlive op which makes sure that its argument is kept
live until the KeepAlive.  Use KeepAlive to mark pointer input
arguments as live after each function call and at each return.

We do this change only for pointer arguments.  Those are the
critical ones to handle because they might have finalizers.
Doing compound arguments (slices, structs, ...) is more complicated
because we would need to track field liveness individually (we do
that for auto variables now, but inputs requires extra trickery).

Turn off the automatic marking of args as live.  That way, when args
are explicitly nulled, plive will know that the original argument is
dead.

The KeepAlive op will be the eventual implementation of
runtime.KeepAlive.

Fixes #15277

Change-Id: I5f223e65d99c9f8342c03fbb1512c4d363e903e5
Reviewed-on: https://go-review.googlesource.com/22365
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Russ Cox <rsc@golang.org>
2016-05-18 19:25:27 +00:00
Andrew Gerrand
d52022676d html/template: mention risks of the CSS, HTML, JS, etc. types
Fixes #15399

Change-Id: I5b9645cb9ddede6981ce0a005e0c6fdd8a751c6f
Reviewed-on: https://go-review.googlesource.com/22824
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Minux Ma <minux@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2016-05-18 18:31:18 +00:00
Brad Fitzpatrick
8f13080267 net/http: allow Client.CheckRedirect to use most recent response
Fixes #10069

Change-Id: I3819ff597d5a0c8e785403bf9d65a054f50655a6
Reviewed-on: https://go-review.googlesource.com/23207
Reviewed-by: Russ Cox <rsc@golang.org>
2016-05-18 18:01:50 +00:00
Brad Fitzpatrick
5d92aefc18 vendor, net/http: update vendored hpack
Updates x/net/http2/hpack to rev 6050c111 for:

   http2/hpack: forbid excess and invalid padding in hpack decoder
   https://golang.org/cl/23067

Updates #15614

Change-Id: I3fbf9b265bfa5e49e6aa97d8c34e08214cfcc49a
Reviewed-on: https://go-review.googlesource.com/23208
Reviewed-by: Carl Mastrangelo <notcarl@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-18 16:38:25 +00:00
Brad Fitzpatrick
1119af8976 net/http: update bundled x/net/http2 for httptrace changes
Updates x/net/http2 to 3b99394 for golang.org/cl/23205

And associated tests.

Fixes #12580

Change-Id: I1f4b59267b453d241f2afaa315b7fe10d477e52d
Reviewed-on: https://go-review.googlesource.com/23206
Reviewed-by: Andrew Gerrand <adg@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-18 16:12:05 +00:00
Brad Fitzpatrick
4d2ac544a4 net/http: fix spurious logging in Transport when server closes idle conn
In https://golang.org/3210, Transport errors occurring before
receiving response headers were wrapped in another error type to
indicate to the retry logic elsewhere that the request might be
re-tryable. But a check for err == io.EOF was missed, which then became
false once io.EOF was wrapped in the beforeRespHeaderError type.

The beforeRespHeaderError was too fragile. Remove it. I tried to fix
it in an earlier version of this CL and just broke different things
instead.

Also remove the "markBroken" method. It's redundant and confusing.

Also, rename the checkTransportResend method to shouldRetryRequest and
make it return a bool instead of an error. This also helps readability.

Now the code recognizes the two main reasons we'd want to retry a
request: because we never wrote the request in the first place (so:
count the number of bytes we've written), or because the server hung
up on us before we received response headers for an idempotent request.

As an added bonus, this could make POST requests safely re-tryable
since we know we haven't written anything yet. But it's too late in Go
1.7 to enable that, so we'll do that later (filed #15723).

This also adds a new internal (package http) test, since testing this
blackbox at higher levels in transport_test wasn't possible.

Fixes #15446

Change-Id: I2c1dc03b1f1ebdf3f04eba81792bd5c4fb6b6b66
Reviewed-on: https://go-review.googlesource.com/23160
Reviewed-by: Andrew Gerrand <adg@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-18 15:13:56 +00:00
Ilya Tocar
9d73e146da hash/crc64: Use slicing by 8.
Similar to crc32 slicing by 8.
This also fixes a Crc64KB benchmark actually using 1024 bytes.

Crc64/ISO64KB-4       147µs ± 0%      37µs ± 0%   -75.05%  (p=0.000 n=18+18)
Crc64/ISO4KB-4       9.19µs ± 0%    2.33µs ± 0%   -74.70%  (p=0.000 n=19+20)
Crc64/ISO1KB-4       2.31µs ± 0%    0.60µs ± 0%   -73.81%  (p=0.000 n=19+15)
Crc64/ECMA64KB-4      147µs ± 0%      37µs ± 0%   -75.05%  (p=0.000 n=20+20)
Crc64/Random64KB-4    147µs ± 0%      41µs ± 0%   -72.17%  (p=0.000 n=20+18)
Crc64/Random16KB-4   36.7µs ± 0%    36.5µs ± 0%    -0.54%  (p=0.000 n=18+19)

name                old speed     new speed      delta
Crc64/ISO64KB-4     446MB/s ± 0%  1788MB/s ± 0%  +300.72%  (p=0.000 n=18+18)
Crc64/ISO4KB-4      446MB/s ± 0%  1761MB/s ± 0%  +295.20%  (p=0.000 n=18+20)
Crc64/ISO1KB-4      444MB/s ± 0%  1694MB/s ± 0%  +281.46%  (p=0.000 n=19+20)
Crc64/ECMA64KB-4    446MB/s ± 0%  1788MB/s ± 0%  +300.77%  (p=0.000 n=20+20)
Crc64/Random64KB-4  446MB/s ± 0%  1603MB/s ± 0%  +259.32%  (p=0.000 n=20+18)
Crc64/Random16KB-4  446MB/s ± 0%   448MB/s ± 0%    +0.54%  (p=0.000 n=18+20)

Change-Id: I1c7621d836c486d6bfc41dbe1ec2ff9ab11aedfc
Reviewed-on: https://go-review.googlesource.com/22222
Run-TryBot: Ilya Tocar <ilya.tocar@intel.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2016-05-18 14:38:04 +00:00
Lee Hinman
6cd698d71d crypto/x509: add Admin & User Keychains to FetchPEMRoots on Darwin
in root_cgo_darwin.go only certificates from the System Domain
were being used in FetchPEMRoots.  This patch adds support for
getting certificates from all three domains (System, Admin,
User).  Also it will only read trusted certificates from those
Keychains.  Because it is possible to trust a non Root certificate,
this patch also adds a checks to see if the Subject and Issuer
name are the same.

Fixes #14514

Change-Id: Ia03936d7a61d1e24e99f31c92f9927ae48b2b494
Reviewed-on: https://go-review.googlesource.com/20351
Reviewed-by: Russ Cox <rsc@golang.org>
2016-05-18 14:26:59 +00:00
Adam Langley
b30fcbc9f5 crypto/ecdsa: reject negative inputs.
The fact that crypto/ecdsa.Verify didn't reject negative inputs was a
mistake on my part: I had unsigned numbers on the brain. However, it
doesn't generally cause problems. (ModInverse results in zero, which
results in x being zero, which is rejected.)

The amd64 P-256 code will crash when given a large, negative input.

This fixes both crypto/ecdsa to reject these values and also the P-256
code to ignore the sign of inputs.

Change-Id: I6370ed7ca8125e53225866f55b616a4022b818f8
Reviewed-on: https://go-review.googlesource.com/22093
Run-TryBot: Adam Langley <agl@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-05-18 14:18:48 +00:00
Monty Taylor
2ba8fc5b08 vcs: Add support for git.openstack.org
Go is being proposed as an officially supported language for elements of
OpenStack:

  https://review.openstack.org/#/c/312267/

As such, repos that exist in OpenStack's git infrastructure
are likely to become places from which people might want to go get
things. Allow optional .git suffixes to allow writing code that depends
on git.openstack.org repos that will work with older go versions while
we wait for this support to roll out.

Change-Id: Ia64bdb1dafea33b1c3770803230d30ec1059df22
Reviewed-on: https://go-review.googlesource.com/23135
Reviewed-by: Russ Cox <rsc@golang.org>
2016-05-18 14:11:33 +00:00
David Chase
d35a4158ab cmd/compile: reduce element size of arrays in sparse{map,set}
sparseSet and sparseMap only need 32 bit integers in their
arrays, since a sparseEntry key is also limited to 32 bits.
This appears to reduce the space allocated for at least
one pathological compilation by 1%, perhaps more.

Not necessarily for 1.7, but it saves a little and is very
low-risk.

Change-Id: Icf1185859e9f5fe1261a206b441e02c34f7d02fd
Reviewed-on: https://go-review.googlesource.com/22972
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2016-05-18 14:05:14 +00:00
Cuihtlauac ALVARADO
2380a039c0 runtime: in tests, make sure gdb does not start with a shell
On some systems, gdb is set to: "startup-with-shell on". This
breaks runtime_test. This just make sure gdb does not start by
spawning a shell.

Fixes #15354

Change-Id: Ia040931c61dea22f4fdd79665ab9f84835ecaa70
Reviewed-on: https://go-review.googlesource.com/23142
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-18 14:03:22 +00:00
Matthew Dempsky
c65647d620 cmd/compile: handle unsafe.Pointer(f()) correctly
Previously statements like

    f(unsafe.Pointer(g()), int(h()))

would be reordered into a sequence of statements like

    autotmp_g := g()
    autotmp_h := h()
    f(unsafe.Pointer(autotmp_g), int(autotmp_h))

which can leave g's temporary value on the stack as a uintptr, rather
than an unsafe.Pointer. Instead, recognize uintptr-to-unsafe.Pointer
conversions when reordering function calls to instead produce:

    autotmp_g := unsafe.Pointer(g())
    autotmp_h := h()
    f(autotmp_g, int(autotmp_h))

Fixes #15329.

Change-Id: I2cdbd89d233d0d5c94791513a9fd5fd958d11ed5
Reviewed-on: https://go-review.googlesource.com/22273
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2016-05-18 14:01:22 +00:00
Mikio Hara
d4ed8da996 net: don't increase test table rows when using -test.count flag
Change-Id: I7881e3353dc5cd9755a79ea0eab146c6a0a08306
Reviewed-on: https://go-review.googlesource.com/23195
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-18 08:19:51 +00:00
Mikio Hara
6de34e6e25 net: deflake TestLookupPort on Android
Looks like some version of Android still fails with "servname not
supported for ai_socktype". It probably doesn't support
ai_socktype=SOCK_STREAM.

Updates #14576.

Change-Id: I77ecff147d5b759e3281b3798c60f150a4aab811
Reviewed-on: https://go-review.googlesource.com/23194
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-05-18 08:18:56 +00:00
Brad Fitzpatrick
cdcb8271a4 regexp/syntax: clarify that \Z means Perl's \Z
Fixes #14793

Change-Id: I408056d096cd6a999fa5e349704b5ea8e26d2e4e
Reviewed-on: https://go-review.googlesource.com/23201
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-18 04:43:32 +00:00
Ian Lance Taylor
23a59ba17c runtime: deflake TestSignalExitStatus
The signal might get delivered to a different thread, and that thread
might not run again before the currently running thread returns and
exits. Sleep to give the other thread time to pick up the signal and
crash.

Not tested for all cases, but, optimistically:
Fixes #14063.

Change-Id: Iff58669ac6185ad91cce85e0e86f17497a3659fd
Reviewed-on: https://go-review.googlesource.com/23203
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Mikio Hara <mikioh.mikioh@gmail.com>
2016-05-18 04:08:08 +00:00
Emmanuel Odeke
ac66bb3431 crypto/x509: fix typo in docs for CreateCertificateRequest
Update the doc for CreateCertificateRequest
to state that it creates a
  `new certificate request`
instead of just a
  `new certificate`

Fixes #14649.

Change-Id: Ibbbcf91d74168998990990e78e5272a6cf294d51
Reviewed-on: https://go-review.googlesource.com/23204
Reviewed-by: Russ Cox <rsc@golang.org>
2016-05-18 03:06:56 +00:00
Brad Fitzpatrick
f962e6e0e2 net/http: add test confirming a connection reuse case
Verify that for a server doing chunked encoding, with the final data
and EOF arriving together, the client will reuse the connection even
if it closes the body without seeing an EOF. The server sends at least
one non-zero chunk and one zero chunk. This verifies that the client's
bufio reading reads ahead and notes the EOF, so even if the JSON
decoder doesn't read the EOF itself, as long as somebody sees it, a
close won't forcible tear down the connection. This was true at least
of https://golang.org/cl/21291

No code change. Test already passed (even with lots of runs, including
in race mode with randomized goroutine scheduling).

Updates #15703

Change-Id: I2140b3eec6b099b6b6e54f153fe271becac5d949
Reviewed-on: https://go-review.googlesource.com/23200
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
2016-05-18 01:24:02 +00:00
James Chacon
733162fd6c runtime: prevent racefini from being invoked more than once
racefini calls __tsan_fini which is C code and at the end of it
invoked the standard C library exit(3) call. This has undefined
behavior if invoked more than once. Specifically in C++ programs
it caused static destructors to run twice. At least on glibc
impls it also means the at_exit handlers list (where those are
stored) also free's a list entry when it completes these. So invoking
twice results in a double free at exit which trips debug memory
allocation tracking.

Fix all of this by using an atomic as a boolean barrier around
calls to racefini being invoked > 1 time.

Fixes #15578

Change-Id: I49222aa9b8ded77160931f46434c61a8379570fc
Reviewed-on: https://go-review.googlesource.com/22882
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
Run-TryBot: Dmitry Vyukov <dvyukov@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-18 01:04:55 +00:00
Alessandro Arzilli
f744717d19 debug/gosym: parse remote packages correctly
Fixes #15675

Change-Id: I8bad220988e5d690f20804db970b2db037c81187
Reviewed-on: https://go-review.googlesource.com/23086
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-17 22:16:38 +00:00
Mikio Hara
7b597f4d92 net: deflake TestLookupPort for embedded, security-hardened platforms
Fixes #14576.

Change-Id: I760907c67c97cb827cf48ba7eb0bb2f4f8d4d790
Reviewed-on: https://go-review.googlesource.com/23111
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-05-17 21:51:18 +00:00
Colin Cross
9d36cac99c reflect: remove out of date UTF-8 StructOf restriction
The initial implementation of reflect.StructOf in
https://golang.org/cl/9251 had a limitation that field names had to be
ASCII, which was later lifted by https://golang.org/cl/21777.  Remove
the out-of-date documentation disallowing UTF-8 field names.

Updates: #5748
Updates: #15064

Change-Id: I2c5bfea46bfd682449c6e847fc972a1a131f51b7
Reviewed-on: https://go-review.googlesource.com/23170
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-05-17 21:15:46 +00:00
Konstantin Shaposhnikov
1a3e4f05a0 os/signal: fix wrong constant name in the documentation
os.SIGINT is not defined, os.Interrupt or syscall.SIGINT should be used.

Change-Id: I39867726d28e179d1160a4fd353b7bea676c9dbb
Reviewed-on: https://go-review.googlesource.com/23127
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-05-17 14:55:14 +00:00
Mikio Hara
495e3c60aa net: use IPv4/IPv6 reserved address blocks for documentation
Also replaces google.com with golang.org in package documentation.

Updates #15228.

Change-Id: I554fa960878fa44557a522635ed412d8d7548d3f
Reviewed-on: https://go-review.googlesource.com/23126
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-05-17 04:02:11 +00:00
Mikio Hara
ca831135b3 net: simplify interfaceTable for BSD variants
This change drops parseInterfaceTable which becomes unnecessary by the
golang.org/x/net/route plumbing.

Change-Id: I05f96e347de950bb1e9292bb3eeff01bb40e292f
Reviewed-on: https://go-review.googlesource.com/23125
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-17 00:14:41 +00:00
Scott Bell
5ccd571f3e crypto/tls: document certificate chains in LoadX509KeyPair
Fixes #15348

Change-Id: I9e0e1e3a26fa4cd697d2c613e6b4952188b7c7e1
Reviewed-on: https://go-review.googlesource.com/23150
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-05-16 23:19:05 +00:00
andrew werner
ccdca832c5 io: make chained multiReader Read more efficient
before this change, when io.MultiReader was called many times but contain few
underlying readers, calls to Read were unnecessarily expensive.

Fixes #13558

Change-Id: I3ec4e88c7b50c075b148331fb1b7348a5840adbe
Reviewed-on: https://go-review.googlesource.com/17873
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-16 22:55:42 +00:00
Simon Thulbourn
28c201860e mime/multipart: sort header keys to ensure reproducible output
Adds a transparent sort to the mime/multipart package, which is
only used in the CreatePart func. This will ensure the ordering
of the MIMEHeader.

The point of this change was to ensure the output would be consistent
and something that could be depended on.

Fixes #13522

Change-Id: I9584ef9dbe98ce97d536d897326914653f8d9ddf
Reviewed-on: https://go-review.googlesource.com/17497
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-05-16 22:55:16 +00:00
Ian Lance Taylor
c1b32acefb runtime: yield after raising signal that should kill process
Issue #15613 points out that the darwin builders have been getting
regular failures in which a process that should exit with a SIGPIPE
signal is instead exiting with exit status 2. The code calls
runtime.raise. On most systems runtime.raise is the equivalent of
pthread_kill(gettid(), sig); that is, it kills the thread with the
signal, which should ensure that the program does not keep going. On
darwin, however, runtime.raise is actually kill(getpid(), sig); that is,
it sends a signal to the entire process. If the process decides to
deliver the signal to a different thread, then it is possible that in
some cases the thread that calls raise is able to execute the next
system call before the signal is actually delivered. That would cause
the observed error.

I have not been able to recreate the problem myself, so I don't know
whether this actually fixes it. But, optimistically:

Fixed #15613.

Change-Id: I60c0a9912aae2f46143ca1388fd85e9c3fa9df1f
Reviewed-on: https://go-review.googlesource.com/23152
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-05-16 22:19:05 +00:00
David Chase
6b99fb5bea cmd/compile: use sparse algorithm for phis in large program
This adds a sparse method for locating nearest ancestors
in a dominator tree, and checks blocks with more than one
predecessor for differences and inserts phi functions where
there are.

Uses reversed post order to cut number of passes, running
it from first def to last use ("last use" for paramout and
mem is end-of-program; last use for a phi input from a
backedge is the source of the back edge)

Includes a cutover from old algorithm to new to avoid paying
large constant factor for small programs.  This keeps normal
builds running at about the same time, while not running
over-long on large machine-generated inputs.

Add "phase" flags for ssa/build -- ssa/build/stats prints
number of blocks, values (before and after linking references
and inserting phis, so expansion can be measured), and their
product; the product governs the cutover, where a good value
seems to be somewhere between 1 and 5 million.

Among the files compiled by make.bash, this is the shape of
the tail of the distribution for #blocks, #vars, and their
product:

	 #blocks	#vars	    product
 max	6171	28180	173,898,780
99.9%	1641	 6548	 10,401,878
  99%	 463	 1909	    873,721
  95%	 152	  639	     95,235
  90%	  84	  359	     30,021

The old algorithm is indeed usually fastest, for 99%ile
values of usually.

The fix to LookupVarOutgoing
( https://go-review.googlesource.com/#/c/22790/ )
deals with some of the same problems addressed by this CL,
but on at least one bug ( #15537 ) this change is still
a significant help.

With this CL:
/tmp/gopath$ rm -rf pkg bin
/tmp/gopath$ time go get -v -gcflags -memprofile=y.mprof \
   github.com/gogo/protobuf/test/theproto3/combos/...
...
real	4m35.200s
user	13m16.644s
sys	0m36.712s
and pprof reports 3.4GB allocated in one of the larger profiles

With tip:
/tmp/gopath$ rm -rf pkg bin
/tmp/gopath$ time go get -v -gcflags -memprofile=y.mprof \
   github.com/gogo/protobuf/test/theproto3/combos/...
...
real	10m36.569s
user	25m52.286s
sys	4m3.696s
and pprof reports 8.3GB allocated in the same larger profile

With this CL, most of the compilation time on the benchmarked
input is spent in register/stack allocation (cumulative 53%)
and in the sparse lookup algorithm itself (cumulative 20%).

Fixes #15537.

Change-Id: Ia0299dda6a291534d8b08e5f9883216ded677a00
Reviewed-on: https://go-review.googlesource.com/22342
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-16 21:08:05 +00:00
Austin Clements
466cae6ca9 runtime: use GOTRACEBACK=system for TestStackBarrierProfiling
This should help with debugging failures.

For #15138 and #15477.

Change-Id: I77db2b6375d8b4403d3edf5527899d076291e02c
Reviewed-on: https://go-review.googlesource.com/23134
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rick Hudson <rlh@golang.org>
2016-05-16 20:16:50 +00:00
Scott Bell
181000896e encoding/json: document that object keys are sorted
Fixes #15424

Change-Id: Ib9e97509f5ac239ee54fe6fe37152a7f5fc75087
Reviewed-on: https://go-review.googlesource.com/23109
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-05-16 19:43:53 +00:00
Austin Clements
64770f642f runtime: use conventional shift style for gcBitsChunkBytes
The convention for writing something like "64 kB" is 64<<10, since
this is easier to read than 1<<16. Update gcBitsChunkBytes to follow
this convention.

Change-Id: I5b5a3f726dcf482051ba5b1814db247ff3b8bb2f
Reviewed-on: https://go-review.googlesource.com/23132
Reviewed-by: Rick Hudson <rlh@golang.org>
2016-05-16 18:28:38 +00:00
Austin Clements
30ded16596 runtime: remove obsolete comment from scanobject
Change-Id: I5ebf93b60213c0138754fc20888ae5ce60237b8c
Reviewed-on: https://go-review.googlesource.com/23131
Reviewed-by: Rick Hudson <rlh@golang.org>
2016-05-16 18:28:35 +00:00
Dan Peterson
b66b97e0a1 net/http: mention ALPN in http.Server.TLSNextProto documentation
Make clear negotiation can happen via NPN or ALPN, similar to
http.Transport.TLSNextProto and x/net/http2.NextProtoTLS.

Change-Id: Ied00b842bc04e11159d6d2107beda921cefbc6ca
Reviewed-on: https://go-review.googlesource.com/23108
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-05-16 15:05:04 +00:00
Artyom Pervukhin
6a6c1d9841 net/http/httputil: don't add User-Agent header by proxy made with NewSingleHostReverseProxy
If client does not provided User-Agent header, do not set default one
used by net/http package when doing request to backend.

Fixes #15524

Change-Id: I9a46bb3b7ec106bc7c3071e235b872d279994d67
Reviewed-on: https://go-review.googlesource.com/23089
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-05-16 15:03:59 +00:00
Mikio Hara
a101b85e00 syscall: fix missing use of use function in sysctl
Updates #13372.

Change-Id: Id2402a781474e9d0bb0901c5844adbd899f76cbd
Reviewed-on: https://go-review.googlesource.com/23123
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-05-15 20:56:39 +00:00
Mikio Hara
5fae488633 syscall: deprecate BPF/LSF
Updates #14982.

Change-Id: Id12b1e61456832d2b2ffbdbe8cf0a1db4444b1e4
Reviewed-on: https://go-review.googlesource.com/23122
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-05-15 20:56:15 +00:00
Mikio Hara
6d66819587 syscall: deprecate routing message APIs for BSD variants
Also removes unnecessary test cases for avoiding unexpected failures on
newer operating systems.

Updates #14724.

Change-Id: I2291585d951fb70383da68293a6ac1ff3524c7f7
Reviewed-on: https://go-review.googlesource.com/22452
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-05-15 20:55:56 +00:00
David du Colombier
6cc6ef82ea mime: fix mime type file name on Plan 9
There was a typo introduced in the initial
implementation of the Plan 9 support of
the mime package.

On Plan 9, the mime type file name should be
/sys/lib/mimetype instead of /sys/lib/mimetypes.

Change-Id: If0f0a9b6f3fbfa8dde551f790e83bdd05e8f0acb
Reviewed-on: https://go-review.googlesource.com/23087
Run-TryBot: Minux Ma <minux@golang.org>
Reviewed-by: Minux Ma <minux@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-15 19:56:08 +00:00
Mikio Hara
b4bf0663fa net: golang.org/x/net/route plumbing
This change makes use of new routing message APIs for BSD variants to
support FreeBSD 11 and newer versions of other BSDs.

Fixes #7849.
Fixes #14724.

Change-Id: I56c7886d6622cdeddd7cc29c8a8062dcc06216d5
Reviewed-on: https://go-review.googlesource.com/22451
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-15 06:24:02 +00:00
Keith Randall
0bc14f57ec strings: fix Contains on amd64
The 17-31 byte code is broken.  Disabled it.

Added a bunch of tests to at least cover the cases
in indexShortStr.  I'll channel Brad and wonder why
this CL ever got in without any tests.

Fixes #15679

Change-Id: I84a7b283a74107db865b9586c955dcf5f2d60161
Reviewed-on: https://go-review.googlesource.com/23106
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-15 05:21:03 +00:00
Mikio Hara
aba7b3e91c vendor: import golang.org/x/net/route
golang.org/x/net/route becomes vendor/golang.org/x/net/route.

At git rev 30be488 (golang.org/cl/22446)

Updates #14724.

Change-Id: I41cfb5443aeecac4c71e843c09eb8c1d4b7413ea
Reviewed-on: https://go-review.googlesource.com/22450
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-05-14 23:06:17 +00:00
Alex Brainman
2699da1809 time: set Local.name on windows
Local.String() returns "Local" on every OS, but windows.
Change windows code to do like others.

Updates #15568

Change-Id: I7a4d2713d940e2a01cff9d7f5cefc89def07546a
Reviewed-on: https://go-review.googlesource.com/23078
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-05-14 17:30:16 +00:00
Kevin Burke
5f833121cb archive/zip: use HTTPS for documentation link
The resource is available over (and redirects to) HTTPS, it seems like a good
idea to save a redirect and ensure an encrypted connection.

Change-Id: I262c7616ae289cdd756b6f67573ba6bd7e3e0ca6
Reviewed-on: https://go-review.googlesource.com/23104
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-05-14 17:27:44 +00:00
Konstantin Shaposhnikov
094afe0cf1 cmd/vendor: move cmd/internal/unvendor packages to cmd/vendor
Updates #14047

Change-Id: I4b150533393bfb90e840497095ac32bcca4f04c2
Reviewed-on: https://go-review.googlesource.com/23114
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-05-14 17:21:52 +00:00
Austin Clements
6181db53db runtime: improve heapBitsSetType documentation
Currently the heapBitsSetType documentation says that there are no
races on the heap bitmap, but that isn't exactly true. There are no
*write-write* races, but there are read-write races. Expand the
documentation to explain this and why it's okay.

Change-Id: Ibd92b69bcd6524a40a9dd4ec82422b50831071ed
Reviewed-on: https://go-review.googlesource.com/23092
Reviewed-by: Rick Hudson <rlh@golang.org>
2016-05-14 13:49:57 +00:00
Austin Clements
d8b08c3aa4 runtime: perform publication barrier even for noscan objects
Currently we only execute a publication barrier for scan objects (and
skip it for noscan objects). This used to be okay because GC would
never consult the object itself (so it wouldn't observe uninitialized
memory even if it found a pointer to a noscan object), and the heap
bitmap was pre-initialized to noscan.

However, now we explicitly initialize the heap bitmap for noscan
objects when we allocate them. While the GC will still never consult
the contents of a noscan object, it does need to see the initialized
heap bitmap. Hence, we need to execute a publication barrier to make
the bitmap visible before user code can expose a pointer to the newly
allocated object even for noscan objects.

Change-Id: Ie4133c638db0d9055b4f7a8061a634d970627153
Reviewed-on: https://go-review.googlesource.com/23043
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rick Hudson <rlh@golang.org>
2016-05-14 13:49:51 +00:00
Mikio Hara
041cc148fa net: deflake TestPointToPointInterface and TestInterfaceArrivalAndDeparture
Fixes #6879.

Change-Id: I9ed2460cf14cb9322d9521e7af910efa48abdaf0
Reviewed-on: https://go-review.googlesource.com/23112
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-05-14 00:53:51 +00:00
Tom Bergan
19619c21c3 net, net/http: don't trace DNS dials
This fixes change https://go-review.googlesource.com/#/c/23069/, which
assumes all DNS requests are UDP. This is not true -- DNS requests can
be TCP in some cases. See:
https://tip.golang.org/src/net/dnsclient_unix.go#L154
https://en.wikipedia.org/wiki/Domain_Name_System#Protocol_transport

Also, the test code added by the above change doesn't actually test
anything because the test uses a faked DNS resolver that doesn't
actually make any DNS queries. I fixed that by adding another test
that uses the system DNS resolver.

Updates #12580

Change-Id: I6c24c03ebab84d437d3ac610fd6eb5353753c490
Reviewed-on: https://go-review.googlesource.com/23101
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-14 00:14:25 +00:00
David Crawshaw
0cc710dca6 reflect: fix method type string
By picking up a spurious tFlagExtraStar, the method type was printing
as unc instead of func.

Updates #15673

Change-Id: I0c2c189b99bdd4caeb393693be7520b8e3f342bf
Reviewed-on: https://go-review.googlesource.com/23103
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-13 17:44:48 +00:00
Mikio Hara
2cc0f22096 Revert "cmd/build: reject non-existant directories in ImportDir"
This reverts commit 7af2ce3f15.

The commit had a wrong prefix in the description line, probably
misreconginized something. As a result it broke golang.org/x/tools/godoc
and golang.org/x/tools/cmd/godoc like the following:

--- FAIL: TestCLI (10.90s)
--- FAIL: TestWeb (13.74s)
FAIL
FAIL        golang.org/x/tools/cmd/godoc    36.428s
--- FAIL: TestCommandLine (0.00s)
FAIL
FAIL        golang.org/x/tools/godoc        0.068s

Change-Id: I362a862a4ded8592dec7488a28e7a256adee148f
Reviewed-on: https://go-review.googlesource.com/23076
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
Reviewed-by: Andrew Gerrand <adg@golang.org>
2016-05-13 17:30:23 +00:00
Brad Fitzpatrick
15f2d0e452 net, net/http: don't trace UDP dials
The httptrace.ConnectStart and ConnectDone hooks are just about the
post-DNS connection to the host. We were accidentally also firing on
the UDP dials to DNS. Exclude those for now. We can add them back
later as separate hooks if desired. (but they'd only work for pure Go
DNS)

This wasn't noticed earlier because I was developing on a Mac at the
time, which always uses cgo for DNS. When running other tests on
Linux, I started seeing UDP dials.

Updates #12580

Change-Id: I2b2403f2483e227308fe008019f1100f6300250b
Reviewed-on: https://go-review.googlesource.com/23069
Reviewed-by: Andrew Gerrand <adg@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-13 01:19:05 +00:00
Alex Brainman
4cffe44e36 syscall: separate stdlib imports from others in mksyscall_windows.go
Change-Id: I6610b872578d161e535565258039d9f064f01456
Reviewed-on: https://go-review.googlesource.com/23070
Reviewed-by: Nigel Tao <nigeltao@golang.org>
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-13 00:36:07 +00:00
Andrew Gerrand
eb69476c66 text/template: detect pathologically recursive template invocations
Return an error message instead of eating memory and eventually
triggering a stack overflow.

Fixes #15618

Change-Id: I3dcf1d669104690a17847a20fbfeb6d7e39e8751
Reviewed-on: https://go-review.googlesource.com/23091
Reviewed-by: Rob Pike <r@golang.org>
2016-05-12 22:32:30 +00:00
Mohit Agarwal
8f48efb31c fmt: remove extra space in too few arguments example
Change-Id: Iae4855c52c4da9755277251d22121226507ea26a
Reviewed-on: https://go-review.googlesource.com/23074
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-05-12 20:45:48 +00:00
Emmanuel Odeke
7af2ce3f15 cmd/build: reject non-existant directories in ImportDir
Re-apply @adg's CL https://golang.org/cl/7129048 that was
previously disabled in https://golang.org/cl/7235052 because
it broke `godoc net/http` for go1.1.

Currently `godoc net/http` seems to work fine with this CL.

Fixes #3428.

Change-Id: I7df06df02fd62dededac6ec60bea62561be59cf1
Reviewed-on: https://go-review.googlesource.com/23013
Run-TryBot: Andrew Gerrand <adg@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
2016-05-12 20:21:29 +00:00
Dmitry Vyukov
7ae273923c cmd/trace: split large traces into parts
Trace viewer cannot handle traces larger than 256MB (limit on js string size):
https://github.com/catapult-project/catapult/issues/627
And even that is problematic (chrome hangs and crashes).
Split large traces into 100MB parts. Somewhat clumsy, but I don't see any other
solution (other than rewriting trace viewer). At least it works reliably now.

Fixes #15482

Change-Id: I993b5f43d22072c6f5bd041ab5888ce176f272b2
Reviewed-on: https://go-review.googlesource.com/22731
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2016-05-12 17:53:59 +00:00
Aliaksandr Valialkin
ccf2c01992 go/types: fix certain vet warnings
Updates #11041

Change-Id: I4e1c670d2b7fc04927d77c6f933cee39b7d48b6e
Reviewed-on: https://go-review.googlesource.com/23083
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-12 17:35:27 +00:00
Michael Munday
a8a2b38fb9 cmd/compile/internal/gc: minor cleanup of init.go comments
Step 5 was deleted in f3575a9 however the numbering of the other
steps wasn't adjusted accordingly.

While we're here: clean up the whitespace, add curly braces where
appropriate and delete semicolons.

Change-Id: I4e77b2d3ee8460abe4bfb993674f83e35be8ff17
Reviewed-on: https://go-review.googlesource.com/23066
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-05-12 16:48:09 +00:00
Aliaksandr Valialkin
e54dfc2ec4 testing: fix vet warning
Updates #11041

Change-Id: I32a381854e6a4fd791db380150efab57e6dfc38c
Reviewed-on: https://go-review.googlesource.com/23081
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-05-12 16:22:42 +00:00
Aliaksandr Valialkin
376e641540 cmd: fixed certain vet warnings
Updates #11041

Change-Id: I7f2583d08f344d6622027c5e8a5de1f5d2f2881c
Reviewed-on: https://go-review.googlesource.com/23082
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-12 15:58:30 +00:00
Aliaksandr Valialkin
a71584975d reflect: fix vet warnings
Updated #11041

Change-Id: I4a110ba8fefb367a1049b4a65dd20c39eb890ea2
Reviewed-on: https://go-review.googlesource.com/23080
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-12 15:58:28 +00:00
Joel Sing
5bd37b8e78 runtime: stop using sigreturn on openbsd/386
In future releases of OpenBSD, the sigreturn syscall will no longer
exist. As such, stop using sigreturn on openbsd/386 and just return
from the signal trampoline (as we already do for openbsd/amd64 and
openbsd/arm).

Change-Id: Ic4de1795bbfbfb062a685832aea0d597988c6985
Reviewed-on: https://go-review.googlesource.com/23024
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-12 07:32:01 +00:00
Alex Brainman
81b70f3751 syscall: make mksyscall_windows.go -systemdll flag true by default
Updates #15167

Change-Id: I826f67e75011ba79325a1294ac0d70d7c6a3e32f
Reviewed-on: https://go-review.googlesource.com/23022
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-12 03:15:06 +00:00
Robert Griesemer
21d781070c cmd/compile: use one format for exporting calls of builtin functions
Minor cleanup. Each of these cases appears both during export and
import when running all.bash and thus is tested by all.bash.

Change-Id: Iaa4a5a5b163cefe33e43d08d396e02a02e5c22a5
Reviewed-on: https://go-review.googlesource.com/23060
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-11 22:57:12 +00:00
Brad Fitzpatrick
eb9062b7bf net/http: keep HTTP/1.0 keep-alive conns open if response can't have a body
Fixes #15647

Change-Id: I588bfa4eb336d1da1fcda8d06e32ed13c0b51c70
Reviewed-on: https://go-review.googlesource.com/23061
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-11 22:14:27 +00:00
Johan Sageryd
114051aa1d text/template: fix typo in documentation
Change-Id: I4ccfaa16e153aad001d670891b3848264e63cf6f
Reviewed-on: https://go-review.googlesource.com/23031
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-05-11 21:24:16 +00:00
Robert Griesemer
ef62f641c3 cmd/compile: use ONAME instead of OPACK in binary export format
This is addressing feedback given on golang.org/cl/23052;
we do it in a separate CL to separate the functional from
the rename change.

ONAME was not used in the export data, but it's the natural node op
where we used OPACK instead. Renamed.

Furthermore, OPACK and ONONAME nodes are replaced by the type checker
with ONAME nodes, so OPACK nodes cannot occur when exporting type-checked
code. Removed a special-case for OPACK nodes since they don't appear.

Change-Id: I78b01a1badbf60e9283eaadeca2578a65d28cbd2
Reviewed-on: https://go-review.googlesource.com/23053
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2016-05-11 20:41:04 +00:00
Robert Griesemer
aff4889089 cmd/compile: clean up encoding of method expressions and add test
Fixes #15646.

Change-Id: Ic13d1adc0a358149209195cdb03811eeee506fb8
Reviewed-on: https://go-review.googlesource.com/23052
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2016-05-11 19:23:04 +00:00
Joe Tsai
e9407ae514 cmd/pprof: remove tempDir when no longer needed
The pprof tools properly cleans up all files it creates, but forgets
to clean up the temporary directory itself. This CL fixes that.

Fixes #13863

Change-Id: I1151c36cdad5ace7cc97e7e04001cf0149ef0f63
Reviewed-on: https://go-review.googlesource.com/23019
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Joe Tsai <thebrokentoaster@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-11 18:25:07 +00:00
Marc-Antoine Ruel
2ffb3e5d90 os: fix Remove for file with read only attribute on Windows
Include integration test. Confirmed that without the fix, the test case
TestDeleteReadOnly fails.

This permits to revert "cmd/go: reset read-only flag during TestIssue10952"
This reverts commit 3b7841b3af.

Fixes #9606

Change-Id: Ib55c151a8cf1a1da02ab18c34a9b58f615c34254
Reviewed-on: https://go-review.googlesource.com/18235
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-11 17:37:55 +00:00
Brad Fitzpatrick
4d8031cf3c net/http: make the MaxBytesReader.Read error sticky
Fixes #14981

Change-Id: I39b906d119ca96815801a0fbef2dbe524a3246ff
Reviewed-on: https://go-review.googlesource.com/23009
Reviewed-by: Andrew Gerrand <adg@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-11 17:10:58 +00:00
Ian Lance Taylor
20e362dae7 cmd/cgo: remove //extern for check functions in gccgo Go prologue
The //extern comments are incorrect and cause undefined symbol
errorswhen building cgo code with -compiler=gccgo. The code is already
designed to use weak references, and that support relies on the cgo
check functions being treated as local functions.

Change-Id: Ib38a640cc4ce6eba74cfbf41ba7147ec88769ec0
Reviewed-on: https://go-review.googlesource.com/23014
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-11 17:07:24 +00:00
Brad Fitzpatrick
9a57fa31ff net/http: document ResponseWriter read-vs-write concurrency rules
Summary: Go's HTTP/1.x server closes the request body once writes are
flushed. Go's HTTP/2 server supports concurrent read & write.

Added a TODO to make the HTTP/1.x server also support concurrent
read+write. But for now, document it.

Updates #15527

Change-Id: I81f7354923d37bfc1632629679c75c06a62bb584
Reviewed-on: https://go-review.googlesource.com/23011
Reviewed-by: Andrew Gerrand <adg@golang.org>
2016-05-11 16:54:01 +00:00
Hiroshi Ioka
80423f1e64 os/exec: cleanup and remove duplicated code
Change-Id: Ia2f61427b1cc09064ac4c0563bccbd9b98767a0e
Reviewed-on: https://go-review.googlesource.com/18118
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-11 16:48:46 +00:00
Mikio Hara
c1e8892060 net: fix nits found by vet
Change-Id: I323231f31c4e1e7415661ebd943a90b2f1e9da1c
Reviewed-on: https://go-review.googlesource.com/23020
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-05-11 08:30:53 +00:00
Mikio Hara
d1981ac313 net: reorganize interface tests to avoid vague flakiness
This change reorganizes test cases for surveying network interfaces and
address prefixes to make sure which part of the functionality is broken.

Updates #7849.

Change-Id: If6918075802eef69a7f1ee040010b3c46f4f4b97
Reviewed-on: https://go-review.googlesource.com/22990
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-05-11 08:29:58 +00:00
David du Colombier
b4538d7aaa Revert "os: enable TestGetppid on Plan 9"
This reverts commit a677724edf.

Change-Id: I6a54ac26a6deca5b2a39ec9f899469a88b543d3d
Reviewed-on: https://go-review.googlesource.com/22980
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-05-11 06:00:33 +00:00
Alex Brainman
0efc16284b syscall: remove mksyscall_windows.go -xsys flag
Also run "go generate" in
internal/syscall/windows and internal/syscall/windows/registry

Updates #15167

Change-Id: I0109226962f81857fe11d308b869d561ea8ed9f9
Reviewed-on: https://go-review.googlesource.com/23021
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-11 05:59:24 +00:00
Robert Griesemer
d958dab095 go/importer: use correct path when checking if package was already imported
The importer uses a global (shared) package map across multiple imports
to determine if a package was imported before. That package map is usually
indexed by package (import) path ('id' in this code). However, the binary
importer was using the incoming (possibly unclean) path.

Fixes #15517.

Change-Id: I0c32a708dfccf345e0353fbda20ad882121e437c
Reviewed-on: https://go-review.googlesource.com/23012
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2016-05-11 03:29:38 +00:00
Alex Brainman
b6712946c1 runtime: make mksyscall_windows.go flags do what they say they do
The -systemdll and -xsys flags generate broken code in some situations
(see issue for details). Fix all that.

This CL only fixes bugs in existing code, but I have more changes comming:

golang.org/x/sys/windows is not the only package that uses mksyscall_windows.go.
golang.org/x/exp/shiny and github.com/derekparker/delve do too. I also have
few personal packages that use mksyscall_windows.go. None of those packages
are aware of new -xsys flag. I would like to change mksyscall_windows.go, so
external packages do not need to use -xsys flag. I would love to get rid of
-xsys flag altogether, but I don't see how it is possible. So I will, probably,
replace -xsys with a flag that means opposite to -xsys, and use new flag
everywhere in standard libraries. Flag name suggestions are welcome.

-systemdll flag makes users code more "secure". I would like to make -systemdll
behaviour a default for all mksyscall_windows.go users. We use that already in
standard library. If we think "secure" is important, we should encourage it in
all users code. If mksyscall_windows.go user insist on using old code, provide
-use_old_loaddll (need good name here) flag for that. So -systemdll flag will
be replaced with -use_old_loaddll.

Fixes #15167

Change-Id: I516369507867358ba1b66aabe00a17a7b477016e
Reviewed-on: https://go-review.googlesource.com/21645
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-05-11 02:30:27 +00:00
Brad Fitzpatrick
9628e6fd1d runtime/testdata/testprogcgo: fix Windows C compiler warning
Noticed and fix by Alex Brainman.

Tested in https://golang.org/cl/23005 (which makes all compiler
warnings fatal during development)

Fixes #15623

Change-Id: Ic19999fce8bb8640d963965cc328574efadd7855
Reviewed-on: https://go-review.googlesource.com/23010
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2016-05-10 23:11:44 +00:00