]> Cypherpunks repositories - gostls13.git/log
gostls13.git
8 years agodoc: document go1.7.3 and add note to go1.7.2 that it should not be used
Chris Broadfoot [Wed, 19 Oct 2016 00:32:26 +0000 (17:32 -0700)]
doc: document go1.7.3 and add note to go1.7.2 that it should not be used

Change-Id: I3dd1513e927733ce5c63928da772cb81760ba869
Reviewed-on: https://go-review.googlesource.com/31442
Reviewed-by: Andrew Gerrand <adg@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-on: https://go-review.googlesource.com/33794

8 years agonet: fix writev tests on Android
Elias Naur [Thu, 1 Dec 2016 19:30:22 +0000 (20:30 +0100)]
net: fix writev tests on Android

Change-Id: Iacced25363f54ee2cc1e00a71605dba7fb447162
Reviewed-on: https://go-review.googlesource.com/33772
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agocmd/compile: generate frame pointers for otherwise frameless functions
Keith Randall [Thu, 1 Dec 2016 00:15:32 +0000 (16:15 -0800)]
cmd/compile: generate frame pointers for otherwise frameless functions

func f() {
    g()
}

We mistakenly don't add a frame pointer for f.  This means f
isn't seen when walking the frame pointer linked list.  That
matters for kernel-gathered profiles, and is an impediment for
issues like #16638.

To fix, allocate a stack frame even for otherwise frameless functions
like f.  It is a bit tricky because we need to avoid some runtime
internals that really, really don't want one.

No test at the moment, as only kernel CPU profiles would catch it.
Tests will come with the implementation of #16638.

Fixes #18103

Change-Id: I411206cc9de4c8fdd265bee2e4fa61d161ad1847
Reviewed-on: https://go-review.googlesource.com/33754
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
8 years agocrypto/x509: read Darwin trust settings for root CAs
Quentin Smith [Wed, 30 Nov 2016 20:16:37 +0000 (15:16 -0500)]
crypto/x509: read Darwin trust settings for root CAs

Darwin separately stores bits indicating whether a root certificate
should be trusted; this changes Go to read and use those when
initializing SystemCertPool.

Unfortunately, the trust API is very slow. To avoid a delay of up to
0.5s in initializing the system cert pool, we assume that
the trust settings found in kSecTrustSettingsDomainSystem will always
indicate trust. (That is, all root certs Apple distributes are trusted.)
This is not guaranteed by the API but is true in practice.

In the non-cgo codepath, we do not have that benefit, so we must check
the trust status of every certificate. This causes about 0.5s of delay
in initializing the SystemCertPool.

On OS X 10.11 and older, the "security" command requires a certificate
to be provided in a file and not on stdin, so the non-cgo codepath
creates temporary files for each certificate, further slowing initialization.

Updates #18141.

Change-Id: If681c514047afe5e1a68de6c9d40ceabbce54755
Reviewed-on: https://go-review.googlesource.com/33721
Run-TryBot: Quentin Smith <quentin@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
8 years agocmd/compile: do not inline functions marked cgo_unsafe_args
David Lazar [Wed, 30 Nov 2016 22:09:07 +0000 (17:09 -0500)]
cmd/compile: do not inline functions marked cgo_unsafe_args

Now the net tests pass with -gcflags '-l=4'.

Fixes #18125.

Change-Id: I4e3a46eb0cb3a93b203e74f5bc99c5822331f535
Reviewed-on: https://go-review.googlesource.com/33722
Reviewed-by: Keith Randall <khr@golang.org>
8 years agocmd/objdump: copy gosym.PCValue into internal package
Keith Randall [Thu, 1 Dec 2016 18:10:17 +0000 (10:10 -0800)]
cmd/objdump: copy gosym.PCValue into internal package

... so we don't have to export gosym.PCValue.

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

8 years agocmd/go: hide the "TERM" environment variable from "go bug"
Mohit Agarwal [Thu, 1 Dec 2016 17:50:03 +0000 (23:20 +0530)]
cmd/go: hide the "TERM" environment variable from "go bug"

Fixes #18128

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

8 years agonet/http: clarify Request.Context's lifetime
Brad Fitzpatrick [Thu, 1 Dec 2016 16:50:00 +0000 (16:50 +0000)]
net/http: clarify Request.Context's lifetime

Reverts https://golang.org/cl/23672 and tweaks the text to clarify
HTTP/2 request cancelations also cancel the context (not just closing
the TCP conn).

Fixes #18143

Change-Id: I9f838e09b906d455c98f676e5bc5559f8f7ecb17
Reviewed-on: https://go-review.googlesource.com/33769
Reviewed-by: Chris Broadfoot <cbro@golang.org>
8 years agodatabase/sql: document expectations for named parameters
Daniel Theophanes [Wed, 23 Nov 2016 17:10:30 +0000 (09:10 -0800)]
database/sql: document expectations for named parameters

Require parameter names to not begin with a symbol.

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

8 years agoruntime: fix incorrect comment about bitvector layout
Austin Clements [Wed, 30 Nov 2016 20:48:33 +0000 (15:48 -0500)]
runtime: fix incorrect comment about bitvector layout

Commit 303b69fe packed bitvectors more tightly, but missed a comment
describing their old layout. Update that comment.

Change-Id: I095ccb01f245197054252545f37b40605a550dec
Reviewed-on: https://go-review.googlesource.com/33718
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
8 years agodoc: remove space in "Go 1. 8"
Brad Fitzpatrick [Thu, 1 Dec 2016 16:26:17 +0000 (16:26 +0000)]
doc: remove space in "Go 1. 8"

And reflow paragraph while I'm at it.

Change-Id: Ia13bb364783790fbd9f8b69ef268f8a4b71679cb
Reviewed-on: https://go-review.googlesource.com/33767
Reviewed-by: Chris Broadfoot <cbro@golang.org>
8 years agodoc: clarify zip behavior in go1.8.html
Brad Fitzpatrick [Thu, 1 Dec 2016 03:14:58 +0000 (03:14 +0000)]
doc: clarify zip behavior in go1.8.html

Updates #17929

Change-Id: I03b8847384c6cd8c43fe8bf2d75cd26db7063b8b
Reviewed-on: https://go-review.googlesource.com/33762
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
8 years agodoc: update go1.8 release notes to say NamedArg not NamedParam
Daniel Theophanes [Thu, 1 Dec 2016 15:10:21 +0000 (07:10 -0800)]
doc: update go1.8 release notes to say NamedArg not NamedParam

Fixes #18135

Change-Id: I54ef9d6fc804d0fb77b729a04367a138e40f9ddf
Reviewed-on: https://go-review.googlesource.com/33766
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agoRevert "runtime: handle SIGPIPE in c-archive and c-shared programs"
Elias Naur [Thu, 1 Dec 2016 09:31:08 +0000 (09:31 +0000)]
Revert "runtime: handle SIGPIPE in c-archive and c-shared programs"

This reverts commit d24b57a6a1a3530e590b7c0a72dc78043e198630.

Reason for revert: Further complications arised (issue 18100). We'll try again in Go 1.9.

Change-Id: I5ca93d2643a4be877dd9c2d8df3359718440f02f
Reviewed-on: https://go-review.googlesource.com/33770
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Minux Ma <minux@golang.org>
Run-TryBot: Minux Ma <minux@golang.org>

8 years agodoc/go1.8.html: announce 1.8 will be the last to support linux/arm prior to ARMv6K
Shenghou Ma [Wed, 23 Nov 2016 02:15:52 +0000 (21:15 -0500)]
doc/go1.8.html: announce 1.8 will be the last to support linux/arm prior to ARMv6K

Updates #17082.

Change-Id: I0bf330d1a1ebb7e31e42d03287160b474522c332
Reviewed-on: https://go-review.googlesource.com/33455
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agocmd/dist: add -check-armv6k command to check for ARMv6K
Shenghou Ma [Wed, 30 Nov 2016 04:29:49 +0000 (23:29 -0500)]
cmd/dist: add -check-armv6k command to check for ARMv6K

so that our release note can reference a simple command to check if
the processor implements ARMv6K or not.

Updates #17082.

Change-Id: I9ca52051e5517394a7cd6b778fb822c3ee435f84
Reviewed-on: https://go-review.googlesource.com/33686
Run-TryBot: Minux Ma <minux@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agosort: add Slice example
Brad Fitzpatrick [Thu, 1 Dec 2016 04:29:12 +0000 (04:29 +0000)]
sort: add Slice example

Change-Id: I34ba4eaf1d232b639998ad3bbb0d075dd097722b
Reviewed-on: https://go-review.googlesource.com/33763
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dominik Honnef <dominik@honnef.co>
8 years agoapi: promote next.txt to go1.8.txt, update go tool go1.8beta1
Chris Broadfoot [Thu, 1 Dec 2016 02:43:28 +0000 (18:43 -0800)]
api: promote next.txt to go1.8.txt, update go tool

Change-Id: I37f2893ce14009efe095aac3bc811d650c66bf2a
Reviewed-on: https://go-review.googlesource.com/33761
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agoapi: update next.txt (remove database/sql.NamedParam)
Chris Broadfoot [Thu, 1 Dec 2016 02:37:18 +0000 (18:37 -0800)]
api: update next.txt (remove database/sql.NamedParam)

Updates #18099

Change-Id: I16b4b2dd881d63cbb406d14a4fd960f0a777a452
Reviewed-on: https://go-review.googlesource.com/33760
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agocmd/cgo: fix cgo checking when fetching errno value
Ian Lance Taylor [Wed, 30 Nov 2016 23:46:37 +0000 (15:46 -0800)]
cmd/cgo: fix cgo checking when fetching errno value

Fixes #18126.

Change-Id: I7ae090945ef203673b06eb94817cc5c894b5eadc
Reviewed-on: https://go-review.googlesource.com/33752
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agodoc: go1.8.html review feedback
Brad Fitzpatrick [Thu, 1 Dec 2016 01:59:07 +0000 (01:59 +0000)]
doc: go1.8.html review feedback

TBR=See https://golang.org/cl/33244

Updates #17929

Change-Id: Ic6d449e7822daa70f3fe17e942e9d29233547019
Reviewed-on: https://go-review.googlesource.com/33759
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agoencoding/binary: document the new bool support
Brad Fitzpatrick [Thu, 1 Dec 2016 00:48:51 +0000 (00:48 +0000)]
encoding/binary: document the new bool support

Updates #16856

Change-Id: I57af6b0c0d5ecdaf19cf6f969b05ec9ec03058f1
Reviewed-on: https://go-review.googlesource.com/33756
Reviewed-by: Ian Lance Taylor <iant@golang.org>
8 years agocmd/go: document GOPATH default exception
Russ Cox [Wed, 30 Nov 2016 22:16:32 +0000 (17:16 -0500)]
cmd/go: document GOPATH default exception

Doesn't get defaulted if $HOME/go is a GOROOT.

Change-Id: I6ac8211a74029e4ad70a50f6e7884a039a27ab05
Reviewed-on: https://go-review.googlesource.com/33720
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agodoc, cmd/go: adjust documentation for default GOPATH
Russ Cox [Wed, 30 Nov 2016 19:56:58 +0000 (14:56 -0500)]
doc, cmd/go: adjust documentation for default GOPATH

Replaces CL 33356.

Fixes #17262.

Change-Id: Idfb2343e90771775e51a66c63760f458737a288c
Reviewed-on: https://go-review.googlesource.com/33730
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agocmd/compile: generate code that type checks when inlining variadic functions
David Lazar [Mon, 28 Nov 2016 22:39:31 +0000 (17:39 -0500)]
cmd/compile: generate code that type checks when inlining variadic functions

This fixes a bug in -l=3 or higher.

To inline a variadic function, the compiler generates code that constructs
a slice of arguments for the variadic parameter. Consider the function

  func Foo(xs ...string)

and the call Foo("hello", "world"). To inline the call to Foo, the
compiler used to generate

  xs := [2]string{"hello", "world"}[:]

which doesn't type check:

  invalid operation [2]string literal[:] (slice of unaddressable value).

Now, the compiler generates

  xs := []string{"hello", "world"}

which does type check.

Fixes #18116.

Change-Id: I0ee531ef2e6cc276db6fb12602b25a46d6d5db21
Reviewed-on: https://go-review.googlesource.com/33671
Reviewed-by: Keith Randall <khr@golang.org>
8 years agodoc: document default GOPATH in go1.8.html
Brad Fitzpatrick [Wed, 30 Nov 2016 19:15:01 +0000 (19:15 +0000)]
doc: document default GOPATH in go1.8.html

And fix a bad link.

TBR=See https://golang.org/cl/33244

Updates #17929

Change-Id: Ib16cf55cdc4a5340f2f4f96ad5934a9fe7d49d75
Reviewed-on: https://go-review.googlesource.com/33716
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agodatabase/sql: deflake query cancel tests
Daniel Theophanes [Wed, 30 Nov 2016 17:30:31 +0000 (09:30 -0800)]
database/sql: deflake query cancel tests

Rather then using a sleep in the fake DB, go to a channel
select and wait for the context to be done.

Fixes #18115

Change-Id: I6bc3a29db58c568d0a7ea06c2a354c18c9e798b2
Reviewed-on: https://go-review.googlesource.com/33712
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agoruntime: fix undead arguments in cgocall
Austin Clements [Wed, 30 Nov 2016 15:50:40 +0000 (10:50 -0500)]
runtime: fix undead arguments in cgocall

From the garbage collector's perspective, time can move backwards in
cgocall. However, in the midst of this time warp, the pointer
arguments to cgocall can go from dead back to live. If a stack growth
happens while they're dead and then a GC happens when they become live
again, GC can crash with a bad heap pointer.

Specifically, the sequence that leads to a panic is:

1. cgocall calls entersyscall, which saves the PC and SP of its call
site in cgocall. Call this PC/SP "X". At "X" both pointer arguments
are live.

2. cgocall calls asmcgocall. Call the PC/SP of this call "Y". At "Y"
neither pointer argument is live.

3. asmcgocall calls the C code, which eventually calls back into the
Go code.

4. cgocallbackg remembers the saved PC/SP "X" in some local variables,
calls exitsyscall, and then calls cgocallbackg1.

5. The Go code causes a stack growth. This stack unwind sees PC/SP "Y"
in the cgocall frame. Since the arguments are dead at "Y", they are
not adjusted.

6. The Go code returns to cgocallbackg1, which calls reentersyscall
with the recorded saved PC/SP "X", so "X" gets stashed back into
gp.syscallpc/sp.

7. GC scans the stack. It sees there's a saved syscall PC/SP, so it
starts the traceback at PC/SP "X". At "X" the arguments are considered
live, so it scans them, but since they weren't adjusted, the pointers
are bad, so it panics.

This issue started as of commit ca4089ad, when the compiler stopped
marking arguments as live for the whole function.

Since this is a variable liveness issue, fix it by adding KeepAlive
calls that keep the arguments live across this whole time warp.

The existing issue7978 test has all of the infrastructure for testing
this except that it's currently up to chance whether a stack growth
happens in the callback (it currently only happens on the
linux-amd64-noopt builder, for example). Update this test to force a
stack growth, which causes it to fail reliably without this fix.

Fixes #17785.

Change-Id: If706963819ee7814e6705693247bcb97a6f7adb8
Reviewed-on: https://go-review.googlesource.com/33710
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
8 years agoruntime: use standard comment style in cgocall
Austin Clements [Wed, 30 Nov 2016 15:43:14 +0000 (10:43 -0500)]
runtime: use standard comment style in cgocall

Change-Id: I9f2c2da4aa512729ae40562b06601da95ba50d6f
Reviewed-on: https://go-review.googlesource.com/33689
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
8 years agodatabase/sql: rename NamedParam to NamedArg and Param to Named
Daniel Theophanes [Tue, 29 Nov 2016 17:57:17 +0000 (09:57 -0800)]
database/sql: rename NamedParam to NamedArg and Param to Named

Be consistent with the argument names already provided. Also
parameter is the variable, argument is the value.

Fixes #18099

Change-Id: Idb3f4e9ffc214036c721ddb4f614ec6c95bb7778
Reviewed-on: https://go-review.googlesource.com/33660
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
8 years agonet/http: document how headers are forwarded by Client
Joe Tsai [Tue, 29 Nov 2016 22:42:22 +0000 (14:42 -0800)]
net/http: document how headers are forwarded by Client

Fixes #18096

Change-Id: I22e1abb75dc19c4d1985b6857c79a81b9db5a76c
Reviewed-on: https://go-review.googlesource.com/33670
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agodoc: update go1.8.html to remove mention of logging of bad requests
Brad Fitzpatrick [Wed, 30 Nov 2016 05:20:25 +0000 (05:20 +0000)]
doc: update go1.8.html to remove mention of logging of bad requests

TBR=See https://golang.org/cl/33244

Updates #18095

Change-Id: I80f3a0462e6cc431b03927fa919cda4f6eee8d97
Reviewed-on: https://go-review.googlesource.com/33687
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agodoc: remove two go1.8.txt items
Brad Fitzpatrick [Wed, 30 Nov 2016 04:15:17 +0000 (04:15 +0000)]
doc: remove two go1.8.txt items

Change-Id: I9035d1c9e81c4f772512958fed92d14335b8a9de
Reviewed-on: https://go-review.googlesource.com/33685
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agodoc: more go1.8.html
Brad Fitzpatrick [Wed, 30 Nov 2016 04:12:33 +0000 (04:12 +0000)]
doc: more go1.8.html

Mutex profiling, syscall, fmt, go/types, html/template.

TBR=See https://golang.org/cl/33244

Updates #17929

Change-Id: I1ba0649171d6f6a69646a90eb65db6674cb903af
Reviewed-on: https://go-review.googlesource.com/33684
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agodoc: remove some TODOs from go1.8.html
Brad Fitzpatrick [Wed, 30 Nov 2016 03:24:40 +0000 (03:24 +0000)]
doc: remove some TODOs from go1.8.html

TBR=See https://golang.org/cl/33244

Updates #17929

Change-Id: I5d92bd62b6560d245f77fa042c7e35d9eddc4994
Reviewed-on: https://go-review.googlesource.com/33683
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agonet/http: fix test TestServeMuxHandlerRedirects
Shenghou Ma [Tue, 29 Nov 2016 01:31:18 +0000 (20:31 -0500)]
net/http: fix test TestServeMuxHandlerRedirects

The code was intended to test that mux handler should redirect at
most once, but the added loop condition defeated that. Remove the
loop condition and document the intention better.

Fixes #18068.

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

8 years agodoc: add tool sections to go1.8.html
Brad Fitzpatrick [Wed, 30 Nov 2016 02:04:09 +0000 (02:04 +0000)]
doc: add tool sections to go1.8.html

Some still in TODO form.

TBR=See https://golang.org/cl/33244

Updates #17929

Change-Id: I63547bed3c6ce34b706821a3c150ae03d7d82cf8
Reviewed-on: https://go-review.googlesource.com/33682
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agodoc: add release notes for os and os/signal packages
Ian Lance Taylor [Wed, 30 Nov 2016 01:58:46 +0000 (17:58 -0800)]
doc: add release notes for os and os/signal packages

TBR=See https://golang.org/cl/33244

Updates #17929

Change-Id: I2e5b24fb0b110d833a8b73bccfbf399cb6e37ea2
Reviewed-on: https://go-review.googlesource.com/33681
Reviewed-by: Ian Lance Taylor <iant@golang.org>
8 years agodoc: more go1.8.html additions
Brad Fitzpatrick [Wed, 30 Nov 2016 01:44:15 +0000 (01:44 +0000)]
doc: more go1.8.html additions

And start deleting from go1.8.txt.

TBR=See https://golang.org/cl/33244

Updates #17929

Change-Id: I71011d97b23a7ba94cd51e16ae61fda18e8b96eb
Reviewed-on: https://go-review.googlesource.com/33680
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agodoc: remove remaining cmd/go entries from go1.8.txt
Ian Lance Taylor [Wed, 30 Nov 2016 01:04:31 +0000 (17:04 -0800)]
doc: remove remaining cmd/go entries from go1.8.txt

None of them need to be called out in the release notes.

Change-Id: I143a1879b25063574e4107c1e89264434d45d1d5
Reviewed-on: https://go-review.googlesource.com/33676
Reviewed-by: Ian Lance Taylor <iant@golang.org>
8 years agonet/http: remove logging on bad client requests
Kenny Grant [Tue, 29 Nov 2016 20:40:40 +0000 (20:40 +0000)]
net/http: remove logging on bad client requests

As discussed in #18095 the server should not log for bad user input.

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

8 years agocmd/compile/internal/gc: document variables and functions
Kevin Burke [Sat, 12 Nov 2016 00:56:07 +0000 (16:56 -0800)]
cmd/compile/internal/gc: document variables and functions

Change-Id: I01b2278eb50585331b8ff7ff5e3c1f9c5ba52b63
Reviewed-on: https://go-review.googlesource.com/33156
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
8 years agodoc: note net/UnixListener.SetUnlinkOnClose in go1.8.html
Dan Peterson [Tue, 29 Nov 2016 23:46:34 +0000 (16:46 -0700)]
doc: note net/UnixListener.SetUnlinkOnClose in go1.8.html

TBR=See https://golang.org/cl/33244

Updates #17929

Change-Id: I201ffe489842ff17277424be4a012558d161f0a7
Reviewed-on: https://go-review.googlesource.com/33672
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agogo/ast: fix doc string for ast.GenDecl
Robert Griesemer [Tue, 29 Nov 2016 22:39:06 +0000 (14:39 -0800)]
go/ast: fix doc string for ast.GenDecl

Fixes #18109.

Change-Id: I5e3a44422794b7bae7741523fb7cacb6ba147af7
Reviewed-on: https://go-review.googlesource.com/33669
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agonet: expand nss myhostname fallback detection
Dan Peterson [Wed, 23 Nov 2016 18:35:17 +0000 (11:35 -0700)]
net: expand nss myhostname fallback detection

Expand myhostname fallback detection to properly detect the local
hostname in addition to other supported special names and suffixes.

Fixes #17967

Change-Id: I1fe141fd9838b25886c08b6f2fd325e58be60457
Reviewed-on: https://go-review.googlesource.com/33550
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

8 years agodoc: add note about gccgo go go1.8.html
Ian Lance Taylor [Tue, 29 Nov 2016 22:20:58 +0000 (14:20 -0800)]
doc: add note about gccgo go go1.8.html

TBR=See https://golang.org/cl/33244

Updates #17929

Change-Id: I28559724322007d4259810c209a92ec1cc10f338
Reviewed-on: https://go-review.googlesource.com/33668
Reviewed-by: Ian Lance Taylor <iant@golang.org>
8 years agodoc: add notes about cgo to go1.8.html
Ian Lance Taylor [Tue, 29 Nov 2016 22:17:35 +0000 (14:17 -0800)]
doc: add notes about cgo to go1.8.html

TBR=See https://golang.org/cl/33244

Updates #17929

Change-Id: I0215a7873977be81f2f84374f0b628abaf0e57c1
Reviewed-on: https://go-review.googlesource.com/33667
Reviewed-by: Ian Lance Taylor <iant@golang.org>
8 years agocrypto/tls: update CBC Lucky13 warning a bit
Brad Fitzpatrick [Tue, 29 Nov 2016 20:41:29 +0000 (20:41 +0000)]
crypto/tls: update CBC Lucky13 warning a bit

Some countermeasures were implemented in https://golang.org/cl/18130

Updates #13385

Change-Id: I723e1e3be0fa6d13767b65b145d90c89e92b2774
Reviewed-on: https://go-review.googlesource.com/33665
Reviewed-by: Adam Langley <agl@golang.org>
8 years agodoc: more additions to go1.8.html
Brad Fitzpatrick [Tue, 29 Nov 2016 20:39:47 +0000 (20:39 +0000)]
doc: more additions to go1.8.html

Adds crypto/tls, crypto/x509, math/big, mime.

TBR=See https://golang.org/cl/33244

Updates #17929

Change-Id: I3fa3739e56f8c005e2a43c19f525cc5e2d981935
Reviewed-on: https://go-review.googlesource.com/33666
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agodoc: more go1.8.html tweaks and new context additions section
Brad Fitzpatrick [Tue, 29 Nov 2016 19:36:44 +0000 (19:36 +0000)]
doc: more go1.8.html tweaks and new context additions section

TBR=See https://golang.org/cl/33244

Updates #17929

Change-Id: Id5d5472cf1e41472d8d0f82ee133c7387257ba2b
Reviewed-on: https://go-review.googlesource.com/33664
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agocmd/compile/internal/syntax: remove unused node field
Robert Griesemer [Tue, 29 Nov 2016 18:18:06 +0000 (10:18 -0800)]
cmd/compile/internal/syntax: remove unused node field

The doc field is not yet used - remove it for now (we may end up
with a different solution for 1.9). This reduces memory consumption
for parsing all of std lib by about 40MB and makes parsing slightly
faster.

Change-Id: Iafb00b9c7f1be9c66fdfb29096d3da5049b2fcf5
Reviewed-on: https://go-review.googlesource.com/33661
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
8 years agodatabase/sql: do not bypass the driver locks with Context methods
Daniel Theophanes [Fri, 28 Oct 2016 17:10:46 +0000 (10:10 -0700)]
database/sql: do not bypass the driver locks with Context methods

When context methods were initially added it was attempted to unify
behavior between drivers without Context methods and those with
Context methods to always return right away when the Context expired.
However in doing so the driver call could be executed outside of the
scope of the driver connection lock and thus bypassing thread safety.

The new behavior waits until the driver operation is complete. It then
checks to see if the context has expired and if so returns that error.

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

8 years agocmd/go: report position info in package errors
Dhananjay Nakrani [Sat, 26 Nov 2016 19:21:01 +0000 (11:21 -0800)]
cmd/go: report position info in package errors

Also refactor common position filling code into a function.

Fixes #18011

Change-Id: I76528626da67a7309193fa92af1e361c8e2fcf84
Reviewed-on: https://go-review.googlesource.com/33631
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
8 years agointernal/pprof/profile: parse mutex profile including comments
Hana Kim [Tue, 22 Nov 2016 21:09:28 +0000 (16:09 -0500)]
internal/pprof/profile: parse mutex profile including comments

Skip lines if they are empty or starting with "#" which are valid
legacy pprof output format.

Fixes #18025

Change-Id: I7aee439171496932637b8ae3188700911f569b16
Reviewed-on: https://go-review.googlesource.com/33454
Reviewed-by: Peter Weinberger <pjw@google.com>
8 years agonet/http/httptest: fix typo in doc comment
Michal Bohuslávek [Tue, 29 Nov 2016 09:58:35 +0000 (09:58 +0000)]
net/http/httptest: fix typo in doc comment

Change-Id: I89f276b32015882437e128814573343a4ca53569
Reviewed-on: https://go-review.googlesource.com/33615
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agocmd/compile: don't panic on syntax error in select statement
Robert Griesemer [Tue, 29 Nov 2016 06:34:50 +0000 (22:34 -0800)]
cmd/compile: don't panic on syntax error in select statement

Fixes #18092.

Change-Id: I54e2da2e0f168c068f5e4a1b22ba508d78259168
Reviewed-on: https://go-review.googlesource.com/33658
TryBot-Result: Gobot Gobot <gobot@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
8 years agoruntime: fall back to /proc/self/auxv in Android libs
Austin Clements [Mon, 28 Nov 2016 23:03:16 +0000 (18:03 -0500)]
runtime: fall back to /proc/self/auxv in Android libs

Android's libc doesn't provide access to auxv, so currently the Go
runtime synthesizes a fake, minimal auxv when loaded as a library on
Android. This used to be sufficient, but now we depend on auxv to
retrieve the system physical page size and panic if we can't retrieve
it.

Fix this by falling back to reading auxv from /proc/self/auxv if the
loader-provided auxv is empty and removing the synthetic auxv vectors.

Fixes #18041.

Change-Id: Ia2ec2c764a6609331494a5d359032c56cbb83482
Reviewed-on: https://go-review.googlesource.com/33652
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
8 years agoruntime: extract Linux auxv handling
Austin Clements [Mon, 28 Nov 2016 19:54:38 +0000 (14:54 -0500)]
runtime: extract Linux auxv handling

This refactoring is in preparation for handling auxv differently in
Android shared libraries.

Updates #18041.

Change-Id: If0458a309f9c804e7abd0a58b5a224d89f8da257
Reviewed-on: https://go-review.googlesource.com/33651
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
8 years agodoc: more go1.8.html updates
Brad Fitzpatrick [Tue, 29 Nov 2016 05:57:18 +0000 (05:57 +0000)]
doc: more go1.8.html updates

TBR=See https://golang.org/cl/33244

Updates #17929

Change-Id: I648df63aeb67aa2229c7b4fc23676a78b31140a0
Reviewed-on: https://go-review.googlesource.com/33657
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agodoc: update go1.8.html after feedback from Russ
Brad Fitzpatrick [Tue, 29 Nov 2016 05:19:47 +0000 (05:19 +0000)]
doc: update go1.8.html after feedback from Russ

Address Russ's feedback from https://golang.org/cl/33244

TBR=See https://golang.org/cl/33244

Updates #17929

Change-Id: I708d71f519f6414ecec629d3c273d9e737d8ed50
Reviewed-on: https://go-review.googlesource.com/33656
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agocmd/link: handle STT_COMMON symbols
Ian Lance Taylor [Tue, 29 Nov 2016 00:19:03 +0000 (16:19 -0800)]
cmd/link: handle STT_COMMON symbols

Tested by running

GOTRACEBACK=2 CGO_CFLAGS="-Wa,--elf-stt-common=yes" go test -ldflags=-linkmode=internal

in misc/cgo/test. That failed before this CL, succeeded after.

I don't think it's worth doing that as a regular test, though,
especially since only recent versions of the GNU binutils support the
--elf-stt-common option.

Fixes #18088.

Change-Id: I893d86181faee217b1504c054b0ed3f7c8d977d3
Reviewed-on: https://go-review.googlesource.com/33653
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agoos: fix handling of Windows Unicode console input and ^Z
Russ Cox [Tue, 22 Nov 2016 18:31:16 +0000 (13:31 -0500)]
os: fix handling of Windows Unicode console input and ^Z

Go 1.5 worked with Unicode console input but not ^Z.
Go 1.6 did not work with Unicode console input but did handle one ^Z case.
Go 1.7 did not work with Unicode console input but did handle one ^Z case.

The intent of this CL is for Go 1.8 to work with Unicode console input
and also handle all ^Z cases.

Here's a simple test program for reading from the console.
It prints a "> " prompt, calls read, prints what it gets, and repeats.

package main

import (
    "fmt"
    "os"
)

func main() {
    p := make([]byte, 100)
    fmt.Printf("> ")
    for {
        n, err := os.Stdin.Read(p)
        fmt.Printf("[%d %q %v]\n> ", n, p[:n], err)
    }
}

On Unix, typing a ^D produces a break in the input stream.
If the ^D is at the beginning of a line, then the 0 bytes returned
appear as an io.EOF:

$ go run /tmp/x.go
> hello
[6 "hello\n" <nil>]
> hello^D[5 "hello" <nil>]
> ^D[0 "" EOF]
> ^D[0 "" EOF]
> hello^Dworld
[5 "hello" <nil>]
> [6 "world\n" <nil>]
>

On Windows, the EOF character is ^Z, not ^D, and there has
been a long-standing problem that in Go programs, ^Z on Windows
does not behave in the expected way, namely like ^D on Unix.
Instead, the ^Z come through as literal ^Z characters:

C:\>c:\go1.5.4\bin\go run x.go
> ^Z
[3 "\x1a\r\n" <nil>]
> hello^Zworld
[13 "hello\x1aworld\r\n" <nil>]
>

CL 4310 attempted to fix this bug, then known as #6303,
by changing the use of ReadConsole to ReadFile.
This CL was released as part of Go 1.6 and did fix the case
of a ^Z by itself, but not as part of a larger input:

C:\>c:\go1.6.3\bin\go run x.go
> ^Z
[0 "" EOF]
> hello^Zworld
[13 "hello\x1aworld\r\n" <nil>]
>

So the fix was incomplete.
Worse, the fix broke Unicode console input.

ReadFile does not handle Unicode console input correctly.
To handle Unicode correctly, programs must use ReadConsole.
Early versions of Go used ReadFile to read the console,
leading to incorrect Unicode handling, which was filed as #4760
and fixed in CL 7312053, which switched to ReadConsole
and was released as part of Go 1.1 and still worked as of Go 1.5:

C:\>c:\go1.5.4\bin\go run x.go
> hello
[7 "hello\r\n" <nil>]
> hello world™
[16 "hello world™\r\n" <nil>]
>

But in Go 1.6:

C:\>c:\go1.6.3\bin\go run x.go
> hello
[7 "hello\r\n" <nil>]
> hello world™
[0 "" EOF]
>

That is, changing back to ReadFile in Go 1.6 reintroduced #4760,
which has been refiled as #17097. (We have no automated test
for this because we don't know how to simulate console input
in a test: it appears that one must actually type at a keyboard
to use the real APIs. This CL at least adds a comment warning
not to reintroduce ReadFile again.)

CL 29493 attempted to fix #17097, but it was not a complete fix:
the hello world™ example above still fails, as does Shift-JIS input,
which was filed as #17939.

CL 29493 also broke ^Z handling, which was filed as #17427.

This CL attempts the never before successfully performed trick
of simultaneously fixing Unicode console input and ^Z handling.
It changes the console input to use ReadConsole again,
as in Go 1.5, which seemed to work for all known Unicode input.
Then it adds explicit handling of ^Z in the input stream.
(In the case where standard input is a redirected file, ^Z processing
should not happen, and it does not, because this code path is only
invoked when standard input is the console.)

With this CL:

C:\>go run x.go
> hello
[7 "hello\r\n" <nil>]
> hello world™
[16 "hello world™\r\n" <nil>]
> ^Z
[0 "" EOF]
> [2 "\r\n" <nil>]
> hello^Zworld
[5 "hello" <nil>]
> [0 "" EOF]
> [7 "world\r\n" <nil>]

This almost matches Unix:

$ go run /tmp/x.go
> hello
[6 "hello\n" <nil>]
> hello world™
[15 "hello world™\n" <nil>]
> ^D
[0 "" EOF]
> [1 "\n" <nil>]
> hello^Dworld
[5 "hello" <nil>]
> [6 "world\n" <nil>]
>

The difference is in the handling of hello^Dworld / hello^Zworld.
On Unix, hello^Dworld terminates the read of hello but does not
result in a zero-length read between reading hello and world.
This is dictated by the tty driver, not any special Go code.

On Windows, in this CL, hello^Zworld inserts a zero length read
result between hello and world, which is treated as an interior EOF.
This is implemented by the Go code in this CL, but it matches the
handling of ^Z on the console in other programs:

C:\>copy con x.txt
hello^Zworld
        1 file(s) copied.

C:\>type x.txt
hello
C:\>

A natural question is how to test all this. As noted above, we don't
know how to write automated tests using the actual Windows console.
CL 29493 introduced the idea of substituting a different syscall.ReadFile
implementation for testing; this CL continues that idea but substituting
for syscall.ReadConsole instead. To avoid the regression of putting
ReadFile back, this CL adds a comment warning against that.

Fixes #17427.
Fixes #17939.

Change-Id: Ibaabd0ceb2d7af501d44ac66d53f64aba3944142
Reviewed-on: https://go-review.googlesource.com/33451
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Quentin Smith <quentin@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

8 years agoos: Executable can use /proc/self/exe on android
David Crawshaw [Mon, 28 Nov 2016 22:23:12 +0000 (17:23 -0500)]
os: Executable can use /proc/self/exe on android

Fixes the os test on the Android builder.

Change-Id: Ibb9db712156a620fcccf515e035475c5e2f535a5
Reviewed-on: https://go-review.googlesource.com/33650
Run-TryBot: David Crawshaw <crawshaw@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

8 years agonet/http, net/http/httptest: cross-reference the two NewRequest funcs
Brad Fitzpatrick [Mon, 28 Nov 2016 21:00:29 +0000 (21:00 +0000)]
net/http, net/http/httptest: cross-reference the two NewRequest funcs

Updates #18082

Change-Id: I2e65b115b809c1e1bf813f538989d1a1f96b2876
Reviewed-on: https://go-review.googlesource.com/33636
Reviewed-by: Ian Lance Taylor <iant@golang.org>
8 years agointernal/pprof: don't discard allocations called by reflect.Call
Ian Lance Taylor [Mon, 28 Nov 2016 20:18:29 +0000 (12:18 -0800)]
internal/pprof: don't discard allocations called by reflect.Call

The pprof code discards all heap allocations made by runtime
routines. This caused it to discard heap allocations made by functions
called by reflect.Call, as the calls are made via the functions
`runtime.call32`, `runtime.call64`, etc. Fix the profiler to retain
these heap allocations.

Fixes #18077.

Change-Id: I8962d552f1d0b70fc7e6f7b2dbae8d5bdefb0735
Reviewed-on: https://go-review.googlesource.com/33635
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agonet/http: document restrictions on ETag as expected by ServeContent
Joe Tsai [Sat, 26 Nov 2016 18:18:39 +0000 (10:18 -0800)]
net/http: document restrictions on ETag as expected by ServeContent

Fixes #18054

Change-Id: I6773943a95b92eebd7e347f8f7a80843b4827243
Reviewed-on: https://go-review.googlesource.com/33630
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Joe Tsai <thebrokentoaster@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

8 years agonet: document that Header.Get key is case insensitive
Kaviraj [Wed, 23 Nov 2016 13:33:46 +0000 (19:03 +0530)]
net: document that Header.Get key is case insensitive

Document that key in Header.Get(key) is case insensitive in
http.Header, mail.Header, textproto.Header.

Fixes #18019

Change-Id: Iba7932491e02e555190b6fce053088b580a853ef
Reviewed-on: https://go-review.googlesource.com/33530
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agocmd/asm: fix parsing of the s390x instructions VSTE{G,F,H,B}
Michael Munday [Mon, 28 Nov 2016 16:41:48 +0000 (11:41 -0500)]
cmd/asm: fix parsing of the s390x instructions VSTE{G,F,H,B}

The element index needs to be placed in From3. Before this CL it
was impossible to write a VSTE instruction that could be
successfully parsed, so this won't affect existing assembly code.

Fixes #18075.

Change-Id: I5b71be4c6632b1d5a30820a529122f96fd1bc864
Reviewed-on: https://go-review.googlesource.com/33584
Run-TryBot: Michael Munday <munday@ca.ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bill O'Farrell <billotosyr@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
8 years agonet: add missing comma on BUGS section for consistency
Mikio Hara [Sun, 27 Nov 2016 00:36:54 +0000 (09:36 +0900)]
net: add missing comma on BUGS section for consistency

Change-Id: Ic96fb52f37257e06e77cc08da5c73ea6f9ff158c
Reviewed-on: https://go-review.googlesource.com/33592
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

8 years agonet: update documentation on Conn and PacketConn
Joe Tsai [Tue, 22 Nov 2016 22:07:03 +0000 (14:07 -0800)]
net: update documentation on Conn and PacketConn

Fixes #17982

Change-Id: I4884a6b57905420ac0e37210c411de98c582de1d
Reviewed-on: https://go-review.googlesource.com/33473
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agotesting: comment out flag.Parse from example
Daniel Martí [Wed, 16 Nov 2016 12:26:23 +0000 (12:26 +0000)]
testing: comment out flag.Parse from example

The TestMain docs explain that flag.Parse() should be called if TestMain
itself depends on command-line flags.

The issue here is that the example implementation does not use any
flags, and thus the flag.Parse call is unnecessary. This leads to people
who use this example as a starting point for their own implementations
to forget that the call is not necessary in most cases.

Comment it out instead of removing the line to keep it as a reminder, as
suggested by Minux Ma.

Change-Id: I6ffc5413e7036366ae3cf0f069b7065e832a3b45
Reviewed-on: https://go-review.googlesource.com/33273
Reviewed-by: Minux Ma <minux@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
8 years agodatabase/sql: force users of NamedParam to name struct literals fields
Brad Fitzpatrick [Thu, 24 Nov 2016 02:21:20 +0000 (02:21 +0000)]
database/sql: force users of NamedParam to name struct literals fields

Or they can use sql.Param instead.

Change-Id: Icf21dbcc87170635c3f5d3f49736429a37abe9da
Reviewed-on: https://go-review.googlesource.com/33576
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Daniel Theophanes <kardianos@gmail.com>
Reviewed-by: Minux Ma <minux@golang.org>
8 years agodoc: add database/sql and os changes to go1.8 release notes
Daniel Theophanes [Wed, 23 Nov 2016 23:51:45 +0000 (15:51 -0800)]
doc: add database/sql and os changes to go1.8 release notes

Change-Id: Ib936539946f43556a7dd501f8127054f6a27861f
Reviewed-on: https://go-review.googlesource.com/33553
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agonet/http: fix receiver for Server.Shutdown and Server.Close
Dan Peterson [Wed, 23 Nov 2016 23:29:51 +0000 (16:29 -0700)]
net/http: fix receiver for Server.Shutdown and Server.Close

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

8 years agoruntime/cgo: save correct floating point registers on s390x
Michael Munday [Wed, 23 Nov 2016 19:54:12 +0000 (14:54 -0500)]
runtime/cgo: save correct floating point registers on s390x

When transitioning from C code to Go code we must respect the C
calling convention. On s390x this means that r6-r13, r15 and f8-f15
must be saved and restored by functions that use them.

On s390x we were saving the wrong set of floating point registers
(f0, f2, f4 and f6) rather than f8-f15 which means that Go code
could clobber registers that C code expects to be restored. This
CL modifies the crosscall functions on s390x to save/restore the
correct floating point registers.

Fixes #18035.

Change-Id: I5cc6f552c893a4e677669c8891521bf735492e97
Reviewed-on: https://go-review.googlesource.com/33571
Reviewed-by: Ian Lance Taylor <iant@golang.org>
8 years agotest: remove amd64 build tag from test
Brad Fitzpatrick [Wed, 23 Nov 2016 16:41:15 +0000 (16:41 +0000)]
test: remove amd64 build tag from test

It was supposed to be testing SSA, not amd64.

For #18024

Change-Id: Ibe65d7eb6bed9bc4b3eda68e1eaec5fa39fe8f76
Reviewed-on: https://go-review.googlesource.com/33491
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>

8 years agomath/rand: export Source64, mainly for documentation value
Russ Cox [Wed, 23 Nov 2016 03:46:39 +0000 (22:46 -0500)]
math/rand: export Source64, mainly for documentation value

There is some code value too: types intending to implement
Source64 can write a conversion confirming that.

For #4254 and the Go 1.8 release notes.

Change-Id: I7fc350a84f3a963e4dab317ad228fa340dda5c66
Reviewed-on: https://go-review.googlesource.com/33456
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agodoc: add net/http section to go1.8.html
Brad Fitzpatrick [Wed, 23 Nov 2016 03:46:58 +0000 (03:46 +0000)]
doc: add net/http section to go1.8.html

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

Updates #17929

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

Fixes #18026

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

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

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

Sigh, forgot to run `git mail`.

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

Update #9401.
Fixes #18016.

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

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

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

Fixes #15684

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

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

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

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

Updates #17929

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

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

Fixes #18013.

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

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

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

Updates #17852.

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

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

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

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

Simple panic:

package main

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

Before this CL:

panic: runtime error: index out of range

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

After this CL:

panic: runtime error: index out of range

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

Panic inside defer triggered by panic:

package main

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

Before this CL:

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

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

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

After this CL:

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

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

Fixes #17901.

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

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

Updates #17929

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

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

Updates #16093

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

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

Updates #17929

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

Updates #17929

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

Day 0 is as invalid as day 32.

Fixes #17874

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

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

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

Fixes #18006

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

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

Fixes #14809.

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

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

Fixes #15457.

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

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

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

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

Fixes #17931

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

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

Updates #18008

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

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

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

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

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

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

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

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

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

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

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

Fixes #13229.

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

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

Fixes #17786.

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