]> Cypherpunks repositories - gostls13.git/log
gostls13.git
7 years agodatabase/sql: ensure a Stmt from a Conn executes on the same driver.Conn
Daniel Theophanes [Mon, 12 Jun 2017 17:46:15 +0000 (10:46 -0700)]
database/sql: ensure a Stmt from a Conn executes on the same driver.Conn

Ensure a Stmt prepared on a Conn executes on the same driver.Conn.
This also removes another instance of duplicated prepare logic
as a side effect.

Fixes #20647

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

7 years agoruntime: clean up some silly allp loops
Austin Clements [Tue, 13 Jun 2017 14:33:24 +0000 (10:33 -0400)]
runtime: clean up some silly allp loops

Back in the day, allp was just a pointer to an array. As a result, the
runtime has a few loops of the form:

    for i := 0; ; i++ {
        p := allp[i]
if p == nil {
    break
}
...
    }

This is silly now because it requires that allp be one longer than the
maximum possible number of Ps, but now that allp is in Go it has a
length.

Replace these with range loops.

Change-Id: I91ef4bc7bd3c9d4fda2264f4aa1b1d0271d7f578
Reviewed-on: https://go-review.googlesource.com/45571
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
7 years agogo/build: make -I/-L options in cgo flags absolute
Ian Lance Taylor [Fri, 26 May 2017 05:20:27 +0000 (22:20 -0700)]
go/build: make -I/-L options in cgo flags absolute

Fixes #20266.

Change-Id: I51383820880e3d3566ef3d70650a0863756003ba
Reviewed-on: https://go-review.googlesource.com/44291
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
7 years agocrypto/x509: support excluded domains in name constraints.
Adam Langley [Thu, 9 Feb 2017 00:27:00 +0000 (16:27 -0800)]
crypto/x509: support excluded domains in name constraints.

Change-Id: I4c2c82cb0354f843a3283a650ed2cd2b6aef5895
Reviewed-on: https://go-review.googlesource.com/36900
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Adam Langley <agl@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

7 years agodoc: add encoding changes to 1.9 release notes
Alberto Donizetti [Tue, 13 Jun 2017 13:59:53 +0000 (15:59 +0200)]
doc: add encoding changes to 1.9 release notes

Updates #20587

Change-Id: I160da21ecdee07c6370be8c46cbd04d4fbb07abb
Reviewed-on: https://go-review.googlesource.com/45550
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
7 years agocmd/go: initialize in get before loading packages
Ian Lance Taylor [Fri, 2 Jun 2017 00:38:34 +0000 (17:38 -0700)]
cmd/go: initialize in get before loading packages

Otherwise the packages will not pick up the way that -installsuffix is
changed by -buildmode and -race.

Fixes #20512.

Change-Id: Ieca32c958a531beb6331dff30d7e9a4998867dbb
Reviewed-on: https://go-review.googlesource.com/44630
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
7 years agocmd/internal/obj/arm: fix MOVW to/from FPSR
Ben Shi [Mon, 12 Jun 2017 03:42:55 +0000 (03:42 +0000)]
cmd/internal/obj/arm: fix MOVW to/from FPSR

"MOVW FPSR, g" should be assembled to 0xeef1aa10, but actually
0xee30a110 (RFS). "MOVW g, FPSR" should be 0xeee1aa10, but actually
0xee20a110 (WFS). They should be updated to VFP forms, since the ARM
back end doesn't support non-VFP floating points.

The patch fixes them and adds more assembly encoding tests.

fixes #20643

Change-Id: I3b29490337c6e8d891b400fcedc8b0a87b82b527
Reviewed-on: https://go-review.googlesource.com/45276
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
7 years agotime: run genzabbrs.go to update zoneinfo_abbrs_windows.go
Alex Brainman [Tue, 13 Jun 2017 02:58:11 +0000 (12:58 +1000)]
time: run genzabbrs.go to update zoneinfo_abbrs_windows.go

Last time zoneinfo_abbrs_windows.go was updated in CL 27832.
Time for another update.

Change-Id: I8dc3a1de6f22e90e634b2176188f257a260b6463
Reviewed-on: https://go-review.googlesource.com/45450
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
7 years agoruntime, unicode: use consistent banner for generated code
Brad Fitzpatrick [Sun, 11 Jun 2017 03:08:18 +0000 (20:08 -0700)]
runtime, unicode: use consistent banner for generated code

Per golang.org/s/generatedcode

Updates #nnn

Change-Id: Ia7513ef6bd26c20b62b57b29f7770684a315d389
Reviewed-on: https://go-review.googlesource.com/45470
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Matt Layher <mdlayher@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

7 years agodatabase/sql: correct level of write to same var for race detector
Daniel Theophanes [Mon, 12 Jun 2017 18:28:18 +0000 (11:28 -0700)]
database/sql: correct level of write to same var for race detector

Rather then write to the same variable per fakeConn, write to either
fakeConn or rowsCursor.

Fixes #20646

Change-Id: Ifc79f989bd1606b8e3ebecb1e7844cce3ad06e17
Reviewed-on: https://go-review.googlesource.com/45393
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
7 years agodoc: add net/http changes to go1.9.html
Kale Blankenship [Thu, 8 Jun 2017 04:11:30 +0000 (21:11 -0700)]
doc: add net/http changes to go1.9.html

Change-Id: Ib59e1eea64b0bd2cf8ed778607aafcf74a6239a3
Reviewed-on: https://go-review.googlesource.com/45087
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
7 years agodatabase/sql: properly document QueryRow
Sarah Adams [Mon, 5 Jun 2017 22:45:04 +0000 (15:45 -0700)]
database/sql: properly document QueryRow

Fixes golang/go#20163

Change-Id: I0caf95fc84aa502715848151c93b6e7bee003ea5
Reviewed-on: https://go-review.googlesource.com/44890
Reviewed-by: Daniel Theophanes <kardianos@gmail.com>
7 years agogo/parser: handle last line comments
Hiroshi Ioka [Sat, 10 Jun 2017 01:36:28 +0000 (10:36 +0900)]
go/parser: handle last line comments

Fixes #20636

Change-Id: Icea0012fecb73944c95f6037922505c63b57b245
Reviewed-on: https://go-review.googlesource.com/45295
Reviewed-by: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

7 years agodatabase/sql: prevent race on Rows close with Tx Rollback
Daniel Theophanes [Sun, 11 Jun 2017 05:02:53 +0000 (22:02 -0700)]
database/sql: prevent race on Rows close with Tx Rollback

In addition to adding a guard to the Rows close, add a var
in the fakeConn that gets read and written to on each
operation, simulating writing or reading from the server.

TestConcurrency/TxStmt* tests have been commented out
as they now fail after checking for races on the fakeConn.
See issue #20646 for more information.

Fixes #20622

Change-Id: I80b36ea33d776e5b4968be1683ff8c61728ee1ea
Reviewed-on: https://go-review.googlesource.com/45275
Run-TryBot: Daniel Theophanes <kardianos@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
7 years agoRevert "database/sql: Use Tx.ctx in Tx non-context methods"
Daniel Theophanes [Fri, 9 Jun 2017 18:45:46 +0000 (18:45 +0000)]
Revert "database/sql: Use Tx.ctx in Tx non-context methods"

This reverts commit ef0f7fb92b9458d7d35ee3c10ae853e3dc3077eb.

Reason for revert: Altered behavior of Queries prior to Tx commit. See #20631.

Change-Id: I2548507c2935a7c60b92aae377dcc8e9aca66331
Reviewed-on: https://go-review.googlesource.com/45231
Run-TryBot: Daniel Theophanes <kardianos@gmail.com>
Reviewed-by: Bulat Gaifullin <gaifullinbf@gmail.com>
Reviewed-by: Michael Hudson-Doyle <michael.hudson@canonical.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

7 years agodoc: explain Windows DWARF linker changes in go1.9.html
Alex Brainman [Fri, 9 Jun 2017 07:24:00 +0000 (17:24 +1000)]
doc: explain Windows DWARF linker changes in go1.9.html

Updates #20587

Change-Id: If1f17a110ef3cc367849bd01e2733c60d85f124b
Reviewed-on: https://go-review.googlesource.com/45118
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
7 years agonet: don't run TestDialListenerAddr in short mode on non-builders
Brad Fitzpatrick [Fri, 9 Jun 2017 00:02:53 +0000 (00:02 +0000)]
net: don't run TestDialListenerAddr in short mode on non-builders

It listens on all addresses, which users might not want.

Updates #18806 (follow-up to feedback from CL 45088)

Change-Id: I51de2d3fc3cd88a61eb3c63018c47aea920c0549
Reviewed-on: https://go-review.googlesource.com/45157
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Mikio Hara <mikioh.mikioh@gmail.com>
7 years agoruntime: YIELD in procyield on ARM
Austin Clements [Fri, 9 Jun 2017 19:46:08 +0000 (15:46 -0400)]
runtime: YIELD in procyield on ARM

ARM currently does not use a hardware yield instruction in the spin
loop in procyield because the YIELD instruction was only added in
ARMv6K. However, it appears earlier ARM chips will interpret the YIELD
encoding as an effective NOP (specifically an MSR instruction that
ultimately has no effect on the CPSR register).

Hence, use YIELD in procyield on ARM since it should be, at worst,
harmless.

Fixes #16663.

Change-Id: Id1787ac48862b785b92c28f1ac84cb4908d2173d
Reviewed-on: https://go-review.googlesource.com/45250
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
7 years agoall: single space after period
Brad Fitzpatrick [Fri, 9 Jun 2017 20:17:51 +0000 (20:17 +0000)]
all: single space after period

Done with grep & interactive search & replace, to double-check
replacements. Not many remained after CL 20022.

Fixes #18572

Change-Id: Idbe90ba3b584f9b9661d2bbd141607daaadfa41a
Reviewed-on: https://go-review.googlesource.com/45270
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
7 years agoos/exec: remove BUG for old and unsupported OS
Brad Fitzpatrick [Fri, 9 Jun 2017 16:45:55 +0000 (16:45 +0000)]
os/exec: remove BUG for old and unsupported OS

Nobody uses 10.6 these days anyway.

Fixes #20623

Change-Id: I698c83cbc288082558e34097ff54d1428aed75ec
Reviewed-on: https://go-review.googlesource.com/45171
Reviewed-by: Matt Layher <mdlayher@gmail.com>
7 years agoruntime: print pc with fp/sp in traceback
Austin Clements [Fri, 9 Jun 2017 15:58:53 +0000 (11:58 -0400)]
runtime: print pc with fp/sp in traceback

If we're in a situation where printing the fp and sp in the traceback
is useful, it's almost certainly also useful to print the PC.

Change-Id: Ie48a0d5de8a54b5b90ab1d18638a897958e48f70
Reviewed-on: https://go-review.googlesource.com/45210
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
7 years agodoc: list image changes in 1.9 release notes
Alberto Donizetti [Thu, 8 Jun 2017 08:59:31 +0000 (10:59 +0200)]
doc: list image changes in 1.9 release notes

Updates #20587

Change-Id: I551a21c0226bc66fd7bca737c30cba679b958c37
Reviewed-on: https://go-review.googlesource.com/45091
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
7 years agocmd/compile: don't use ."" as a pkg prefix
Daniel Martí [Wed, 24 May 2017 10:34:56 +0000 (11:34 +0100)]
cmd/compile: don't use ."" as a pkg prefix

This results in names to unexported fields like
net.(*Dialer)."".deadline instead of net.(*Dialer).deadline.

Fixes #18419.

Change-Id: I0415c68b77cc16125c2401320f56308060ac3f25
Reviewed-on: https://go-review.googlesource.com/44070
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
7 years agonet/http: regenerate http2 bundle with bundle fixes to include comments
Brad Fitzpatrick [Fri, 9 Jun 2017 02:49:07 +0000 (02:49 +0000)]
net/http: regenerate http2 bundle with bundle fixes to include comments

The golang.org/x/tools/cmd/bundle tool previously had a bug where it
dropped some comments.

This regenerates it with the fixed version (https://golang.org/cl/45117).

(Upstream is still git rev 3470a06c1, from https://golang.org/cl/44331)

Updates #20548

Change-Id: Ic5d9208a0c8f7facdb7b315c6acab66ace34c0a9
Reviewed-on: https://go-review.googlesource.com/45158
Reviewed-by: Hiroshi Ioka <hirochachacha@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
7 years agodoc/go1.9: runtime release notes
Austin Clements [Thu, 8 Jun 2017 17:35:58 +0000 (13:35 -0400)]
doc/go1.9: runtime release notes

Several of the CLs that were against the runtime are noted in other
places in the release notes, depending on where they are most
user-visible.

Change-Id: I167dc7ff17a4c5f9a5d22d5bd123aa0e99f5639e
Reviewed-on: https://go-review.googlesource.com/45137
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Rick Hudson <rlh@golang.org>
7 years agodoc/go1.9: GC performance release notes
Austin Clements [Thu, 8 Jun 2017 14:17:48 +0000 (10:17 -0400)]
doc/go1.9: GC performance release notes

Change-Id: I361587ba0ddffb5ee4a3d1bdb6219710a30da197
Reviewed-on: https://go-review.googlesource.com/45132
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Rick Hudson <rlh@golang.org>
7 years agocmd/internal/obj/arm: fix encoding of move register/immediate to CPSR
Ben Shi [Fri, 9 Jun 2017 10:24:42 +0000 (10:24 +0000)]
cmd/internal/obj/arm: fix encoding of move register/immediate to CPSR

"MOVW R1, CPSR" is assembled to 0xe129f001, which should be 0xe12cf001.
"MOVW $255, CPSR" is assembled to 0xe329f0ff, which should be 0xe32cf0ff.

This patch fixes them and adds more assembly encoding tests.

fix #20626

Change-Id: Iefc945879ea774edf40438ce39f52c144e1501a1
Reviewed-on: https://go-review.googlesource.com/45170
Reviewed-by: Cherry Zhang <cherryyz@google.com>
7 years agotesting: show in-progress tests upon SIGINT
Meir Fischer [Sun, 4 Jun 2017 04:29:40 +0000 (00:29 -0400)]
testing: show in-progress tests upon SIGINT

Because of parallel tests, which have stalled executions, the RUN
output of a test can be much earlier than its completion output resulting
in hard-to-read verbose output.

The tests are displayed in the order in which the output shows
that they began, to make it easy to line up with the "RUN" output.
Similarly, the definitions of when tests begin and complete is
determined by when RUN and FAIL/SKIP/PASS are output since the
focus of this code is on enhancing readability.

Fixes #19397

Change-Id: I4d0ca3fd268b620484e7a190117f79a33b3dc461
Reviewed-on: https://go-review.googlesource.com/44352
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
7 years agocmd/go: ignore dot and underscore files in fmt, fix, and get -fix
Brad Fitzpatrick [Thu, 8 Jun 2017 22:38:15 +0000 (22:38 +0000)]
cmd/go: ignore dot and underscore files in fmt, fix, and get -fix

No test because as far as I can tell, there aren't existing tests for
these.

Fixes #18383

Change-Id: I06eaef05777a1474886167e3797c5bcd93189d1b
Reviewed-on: https://go-review.googlesource.com/45156
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
7 years agonet/http: remove invalid checks of Request.Proto* for outgoing requests
Brad Fitzpatrick [Thu, 8 Jun 2017 21:43:54 +0000 (21:43 +0000)]
net/http: remove invalid checks of Request.Proto* for outgoing requests

The net/http package has long documented that Request.ProtoMajor and
Request.ProtoMinor are ignored for outgoing requests (HTTP/1.1 or
HTTP/2 is always used, never HTTP/1.0). There was one part in the code
that was actually checking 1.0 vs 1.1, but it appears to have been
harmless. Remove it.

Fixes #18407

Change-Id: I362ed6c47ca2de7a2fbca917ed3e866273cfe41f
Reviewed-on: https://go-review.googlesource.com/45155
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
7 years agosyscall: make windows Exit call runtime.exit
Alex Brainman [Thu, 8 Jun 2017 05:56:53 +0000 (15:56 +1000)]
syscall: make windows Exit call runtime.exit

Both runtime.exit and syscall.Exit call Windows ExitProcess.
But recently (CL 34616) runtime.exit was changed to ignore
Windows CreateThread errors if ExitProcess is called.

This CL adjusts syscall.Exit to do the same.

Fixes #18253 (maybe)

Change-Id: I6496c31b01e7c7d73b69c0b2ae33ed7fbe06736b
Reviewed-on: https://go-review.googlesource.com/45115
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
7 years agonet: make Dial("tcp", ln.Addr().String()) work even with bad IPv6 config
Brad Fitzpatrick [Wed, 7 Jun 2017 21:01:48 +0000 (21:01 +0000)]
net: make Dial("tcp", ln.Addr().String()) work even with bad IPv6 config

Some machines can be configured (or came/come configured) in such a
state that IPv6 only half works: you can bind on [::]:n but not
connect back to it.

This implements a fallback such that it's guaranteed that this pattern
works:

   ln, err := Listen("tcp", ":0")
   ...
   addr := ln.Addr().String() // "[::]:n"
   c, err := Dial("tcp", addr)

... which is also now tested. It will first try to dial "[::]:n", as
before, but if that dial fails, it will also try "0.0.0.0:n".

Fixes #18806 (contains more details)
Fixes #20611 (I was going to fix nacl later, but it was easy enough)

Change-Id: I1107eb197e902ae8185c781ad1bc4e2bc61d1f4c
Reviewed-on: https://go-review.googlesource.com/45088
Reviewed-by: Paul Marks <pmarks@google.com>
7 years agonet: support all PacketConn and Conn returned by Resolver.Dial
Ben Burkert [Thu, 8 Jun 2017 20:19:28 +0000 (13:19 -0700)]
net: support all PacketConn and Conn returned by Resolver.Dial

Allow the Resolver.Dial func to return instances of Conn other than
*TCPConn and *UDPConn. If the Conn is also a PacketConn, assume DNS
messages transmitted over the Conn adhere to section 4.2.1. "UDP usage".
Otherwise, follow section 4.2.2. "TCP usage".

Provides a hook mechanism so that DNS queries generated by the net
package may be answered or modified before being sent to over the
network.

Updates #19910

Change-Id: Ib089a28ad4a1848bbeaf624ae889f1e82d56655b
Reviewed-on: https://go-review.googlesource.com/45153
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
7 years agonet/http: simplify recently added TestServeTLS
Brad Fitzpatrick [Thu, 8 Jun 2017 20:35:02 +0000 (20:35 +0000)]
net/http: simplify recently added TestServeTLS

TestServeTLS was added in CL 44074, merged today.
This cleans up the test a little.

Updates #13228

Change-Id: I6efd798fe5fa015a34addbf60ae26919a1ed283e
Reviewed-on: https://go-review.googlesource.com/45152
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
7 years agolog/syslog: expand docs a bit to reduce confusion
Brad Fitzpatrick [Thu, 8 Jun 2017 17:44:03 +0000 (17:44 +0000)]
log/syslog: expand docs a bit to reduce confusion

Fixes #15731

Change-Id: I6f4da0cbb3b6c93e175f5e384ffa118f383b7c3b
Reviewed-on: https://go-review.googlesource.com/45089
Reviewed-by: Ian Lance Taylor <iant@golang.org>
7 years agoruntime: more diagnostics for TestStackGrowth
Austin Clements [Thu, 8 Jun 2017 17:48:41 +0000 (13:48 -0400)]
runtime: more diagnostics for TestStackGrowth

This adds diagnostics so we can tell if the finalizer has started, in
addition to whether or not it has finished.

Updates #19381.

Change-Id: Icb7b1b0380c9ad1128b17074828945511a6cca5d
Reviewed-on: https://go-review.googlesource.com/45138
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
7 years agocmd/compile: fix real/imag for untyped constant arguments
Robert Griesemer [Wed, 7 Jun 2017 23:22:21 +0000 (16:22 -0700)]
cmd/compile: fix real/imag for untyped constant arguments

Fixes #11945.
Fixes #17446.

Change-Id: Ic674f6ebc0533ab0f97c650689125994941b72e1
Reviewed-on: https://go-review.googlesource.com/45081
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
7 years agoruntime: fix documentation error about runtime.GC()
Austin Clements [Thu, 8 Jun 2017 14:15:38 +0000 (10:15 -0400)]
runtime: fix documentation error about runtime.GC()

runtime.GC no longer triggers a STW GC. This fixes the description of
GODEBUG=gctrace=1 so it doesn't claim otherwise.

Change-Id: Ibd34a55c5ae7b5eda5c2393b9a6674bdf1d51eb3
Reviewed-on: https://go-review.googlesource.com/45131
Reviewed-by: Rick Hudson <rlh@golang.org>
7 years agonet/http: add Server.ServeTLS method
Niklas Schnelle [Mon, 13 Mar 2017 02:13:16 +0000 (07:43 +0530)]
net/http: add Server.ServeTLS method

Server.ServeTLS wraps Server.Serve with added TLS support. This is
particularly useful for serving on manually initialized listeners.
Example use-case includes ability to serve with TLS on listener
provided by systemd's socket activation.

A matching test heavily based on TestAutomaticHTTP2_ListenAndServe
is also included.

Original code by Gurpartap Singh as
https://go-review.googlesource.com/c/38114/

Fixes #13228

Change-Id: I73bb703f501574a84d261c2d7b9243a89fa52d62
Reviewed-on: https://go-review.googlesource.com/44074
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
7 years agonet/http: enable TestLinuxSendfile on mips64
Vladimir Stefanovic [Tue, 6 Jun 2017 14:13:39 +0000 (16:13 +0200)]
net/http: enable TestLinuxSendfile on mips64

The test is passing on a 64bit RFS.

Fixes #18008

Change-Id: Ia4c4f4dde0392c7f6bbe5dbffc97cf848ec5a107
Reviewed-on: https://go-review.googlesource.com/44953
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
7 years agobufio: clarify WriteTo docs
Sam Whited [Mon, 5 Jun 2017 14:21:10 +0000 (09:21 -0500)]
bufio: clarify WriteTo docs

Fixes #19092

Change-Id: I7c0fde6a4cf460017619dbcce1c1ddaa7af1022a
Reviewed-on: https://go-review.googlesource.com/44811
Reviewed-by: Ian Lance Taylor <iant@golang.org>
7 years agogo/types: adjust type-checking of shifts to match compilers
Robert Griesemer [Wed, 7 Jun 2017 18:32:42 +0000 (11:32 -0700)]
go/types: adjust type-checking of shifts to match compilers

For #14822.

Change-Id: Ia3f5558f3e0dcb8ee2dab54a6e9588eecc22511f
Reviewed-on: https://go-review.googlesource.com/45074
Reviewed-by: Alan Donovan <adonovan@google.com>
7 years agospec: clarify restrictions on RHS of non-constant shifts
Robert Griesemer [Wed, 7 Jun 2017 18:06:00 +0000 (11:06 -0700)]
spec: clarify restrictions on RHS of non-constant shifts

For non-constant shifts with an untyped constant shift count, the
spec only said that it must "be converted to unsigned integer type".
go/types accepts any (arbitrarily large) integer value. Both cmd/compile
and gccgo require that the shift count be representable as a uint value
in that case (if the shift count is typed, it may be any unsigned integer
type).

This change adjusts the spec to state what the compilers have been doing
all along. The new wording matches similar rules elsewhere (e.g., for
untyped array and slice indices). Also, while technically this is a
restriction (we could permit arbitrarily large shift counts), in practice
this is irrelevant.

Fixes #14822.

Change-Id: Ia75834c67483cf761c10025c8df758f225ef67c2
Reviewed-on: https://go-review.googlesource.com/45072
Reviewed-by: Ian Lance Taylor <iant@golang.org>
7 years agoruntime: fix tab/space inconsistency in runtime-gdb.py
Austin Clements [Thu, 8 Jun 2017 16:05:31 +0000 (12:05 -0400)]
runtime: fix tab/space inconsistency in runtime-gdb.py

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

7 years agoruntime: fix GDB goroutine N command when N is running
Austin Clements [Wed, 7 Jun 2017 14:30:49 +0000 (10:30 -0400)]
runtime: fix GDB goroutine N command when N is running

The current implementation of "goroutine N cmd" assumes it can get
goroutine N's state from the goroutine's sched buffer. But this only
works if the goroutine is blocked. Extend find_goroutine so that, if
there is no saved scheduler state for a goorutine, it tries to find
the thread the goroutine is running on and use the thread's current
register state. We also extend find_goroutine to understand saved
syscall register state.

Fixes #13887.

Change-Id: I739008a8987471deaa4a9da918655e4042cf969b
Reviewed-on: https://go-review.googlesource.com/45031
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
7 years agotest: add test that caused gccgo undefined symbol error
Ian Lance Taylor [Thu, 8 Jun 2017 03:04:11 +0000 (20:04 -0700)]
test: add test that caused gccgo undefined symbol error

Change-Id: I94aa87fe951701413b479c05b0bc8810255eb01c
Reviewed-on: https://go-review.googlesource.com/45085
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
7 years agocmd/go: fix TestBuildIDContainsArchModeEnv fail on arm64
Wei Xiao [Tue, 6 Jun 2017 02:03:55 +0000 (02:03 +0000)]
cmd/go: fix TestBuildIDContainsArchModeEnv fail on arm64

TestBuildIDContainsArchModeEnv fails on arm64 because defaultGO386 has
different value from x86 (amd64/386). On arm64 defaultGO386 = '387' but
on x86 defaultGO386 = 'sse2'. The difference will make the test succeed
on x86 while fail on arm64 since it generates the same build ID.
Fix it by explicitly setting GO386 instead of using default value

Fixes #20608

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

7 years agocompress/lzw: don't follow code == hi if last is invalid.
Nigel Tao [Thu, 8 Jun 2017 00:58:20 +0000 (10:58 +1000)]
compress/lzw: don't follow code == hi if last is invalid.

Fixes #20597.

Change-Id: Iaa059277c02e80a2fbef59cf8bb3c58d2b90fda0
Reviewed-on: https://go-review.googlesource.com/45111
Reviewed-by: David Symonds <dsymonds@golang.org>
7 years agoreflect: check pkgPath for unexported methods in Implements
Ian Lance Taylor [Wed, 31 May 2017 22:38:34 +0000 (15:38 -0700)]
reflect: check pkgPath for unexported methods in Implements

Fixes #20541.

Change-Id: Ifdfdf3616482b71761daf6d114b779a8ec532051
Reviewed-on: https://go-review.googlesource.com/44495
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
7 years agonet/http: delete vestigial method
Brad Fitzpatrick [Wed, 7 Jun 2017 21:29:01 +0000 (21:29 +0000)]
net/http: delete vestigial method

Fixes #19850

Change-Id: I8c86e288159408c687c2a85f458ade282adae450
Reviewed-on: https://go-review.googlesource.com/45077
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
7 years agosync: remove note about creating with structures
Joonas Kuorilehto [Wed, 24 May 2017 17:37:53 +0000 (20:37 +0300)]
sync: remove note about creating with structures

Remove note that sync.Cond, sync.Mutex, sync.RWMutex and atomic.Value
can be created as part of other data structures. Structs can be embedded
by default, and default should not be repeated.

Fixes #20471.

Change-Id: If3f5703d3f60abd96482b58ca43450d02a9e645a
Reviewed-on: https://go-review.googlesource.com/44071
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
7 years agocmd/compile: separate code for len, cap from code for real, imag
Robert Griesemer [Wed, 7 Jun 2017 21:14:20 +0000 (14:14 -0700)]
cmd/compile: separate code for len, cap from code for real, imag

Prep work for issues mentioned below. No semantic or functionality change.

For #11945.
For #17446.

Change-Id: Ia1bb2b87647a6daa47f7863c0eb42cf5e1d35a7c
Reviewed-on: https://go-review.googlesource.com/45076
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
7 years agotime: vendor tzdata-2017b and update test
Alberto Donizetti [Mon, 5 Jun 2017 08:20:00 +0000 (10:20 +0200)]
time: vendor tzdata-2017b and update test

This change updates the vendored tzdata database to version 2017b
(released 2017-03-20).

The TestFirstZone test (which always uses the vendored database) is
updated to make it work with the new timezones database. (The Tokelau
abbreviation was changed from 'TKT' to the numeric abbreviation in
tzdata-2017a)

Fixes #19376

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

7 years agocmd/compile: don't implicitly dereference pointer to arrays for real/imag
Robert Griesemer [Wed, 7 Jun 2017 20:10:05 +0000 (13:10 -0700)]
cmd/compile: don't implicitly dereference pointer to arrays for real/imag

Fixes #20602.

Change-Id: Iac1589484dec626c018314e0cea7efce091fd87d
Reviewed-on: https://go-review.googlesource.com/45075
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
7 years agodatabase/sql: Use Tx.ctx in Tx non-context methods
Bulat Gaifullin [Tue, 6 Jun 2017 17:20:06 +0000 (20:20 +0300)]
database/sql: Use Tx.ctx in Tx non-context methods

The Tx methods Query and Exec uses context.Background()
even Tx was created by context.
This patch enables using Tx.ctx in all Tx methods
which do not has context arg.
Backward compatibility:
- If Tx has created without context, nothing changes.
- If Tx has created with context and non-context method is called:
  - If context is expired, the execution fails,
    but it can fail on Commit or Rollback as well,
    so in terms of whole transaction - nothing changes.
  - If context is not expired, nothing changes too.

Fixes #20098
Change-Id: I9570a2deaace5875bb4c5dcf7b3a084a6bcd0d00
Reviewed-on: https://go-review.googlesource.com/44956
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Daniel Theophanes <kardianos@gmail.com>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

7 years agofmt: remove unnecessary trailing commas in doc.go
Rob Phoenix [Wed, 7 Jun 2017 19:19:15 +0000 (20:19 +0100)]
fmt: remove unnecessary trailing commas in doc.go

Change-Id: Ib5efe172c55ff624b6771c2f02c466e35ba6cc50
Reviewed-on: https://go-review.googlesource.com/45090
Reviewed-by: Rob Pike <r@golang.org>
7 years agodoc: list testing package changes in 1.9 release notes
Alberto Donizetti [Wed, 7 Jun 2017 08:54:52 +0000 (10:54 +0200)]
doc: list testing package changes in 1.9 release notes

Updates #20587

Change-Id: I39f7c43a13c887d9d563c108d3575db7f2dffe0e
Reviewed-on: https://go-review.googlesource.com/45050
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
7 years agonet/http: don't crash in Request.WithContext if Request.URL is nil
Brad Fitzpatrick [Wed, 7 Jun 2017 18:13:38 +0000 (18:13 +0000)]
net/http: don't crash in Request.WithContext if Request.URL is nil

Fixes #20601

Change-Id: I296d50dc5210a735a2a65d64bfef05d14c93057b
Reviewed-on: https://go-review.googlesource.com/45073
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Rhys Hiltner <rhys@justin.tv>
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

7 years agocmd/internal/obj/arm: don't split instructions on NaCl
Cherry Zhang [Wed, 7 Jun 2017 14:00:58 +0000 (10:00 -0400)]
cmd/internal/obj/arm: don't split instructions on NaCl

We insert guard instructions after each "dangerous" instruction
to make NaCl's validator happy. This happens before asmout. If
in asmout an instruction is split to two dangerous instructions,
but only one guard instruction is inserted, the validation fails.
Therefore don't split instructions on NaCl.

Fixes #20595.

Change-Id: Ie34f209bc7d907d6d16ecef6721f88420981ac01
Reviewed-on: https://go-review.googlesource.com/45021
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
7 years agodoc: remove math/bits from 'minor changes' section
Alberto Donizetti [Wed, 7 Jun 2017 09:15:55 +0000 (11:15 +0200)]
doc: remove math/bits from 'minor changes' section

The new math/bits package has a section for itself, and should not be
mentioned in the 'Minor changes to the library' section of the release
notes.

Updates #20587

Change-Id: I13ecd35f5cee4324e50b2d31800e399c00159126
Reviewed-on: https://go-review.googlesource.com/45051
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
7 years agodoc: add type aliases to go1.9.html
Brad Fitzpatrick [Tue, 6 Jun 2017 22:03:45 +0000 (22:03 +0000)]
doc: add type aliases to go1.9.html

Updates #20587

Change-Id: I5df603505ae1d4b65687bec1e973a4ab318b34f1
Reviewed-on: https://go-review.googlesource.com/45014
Reviewed-by: Robert Griesemer <gri@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
7 years agoruntime: mark extra M's G as dead when not in use
Austin Clements [Tue, 6 Jun 2017 22:37:59 +0000 (18:37 -0400)]
runtime: mark extra M's G as dead when not in use

Currently the extra Ms created for cgo callbacks have a corresponding
G that's kept in syscall state with only a call to goexit on its
stack. This leads to confusing output from runtime.NumGoroutines and
in tracebacks:

goroutine 17 [syscall, locked to thread]:
runtime.goexit()
.../src/runtime/asm_amd64.s:2197 +0x1

Fix this by putting this goroutine into state _Gdead when it's not in
use instead of _Gsyscall. To keep the goroutine counts correct, we
also add one to sched.ngsys while the goroutine is in _Gdead. The
effect of this is as if the goroutine simply doesn't exist when it's
not in use.

Fixes #16631.
Fixes #16714.

Change-Id: Ieae08a2febd4b3d00bef5c23fd6ca88fb2bb0087
Reviewed-on: https://go-review.googlesource.com/45030
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
7 years agoruntime: deflake TestPanicRace
Ian Lance Taylor [Wed, 7 Jun 2017 00:31:57 +0000 (17:31 -0700)]
runtime: deflake TestPanicRace

The test is inherently racy, and for me fails about 0.05% of the time.
So only fail the test if it fails ten times in a row.

Fixes #20594

Change-Id: I3b3f7598f2196f7406f1a3937f38f21ff0c0e4b5
Reviewed-on: https://go-review.googlesource.com/45020
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
7 years agobuiltin: use type aliases for rune and byte
Brad Fitzpatrick [Tue, 6 Jun 2017 22:17:50 +0000 (22:17 +0000)]
builtin: use type aliases for rune and byte

As motivated by https://golang.org/design/18130-type-alias which says:

https://github.com/golang/proposal/blob/master/design/18130-type-alias.md#relationship-to-byte-and-rune

> The language specification already defines byte as an alias for
> uint8 and similarly rune as an alias for int32, using the word alias
> as an informal term. It is a goal that the new type declaration
> semantics not introduce a different meaning for alias. That is, it
> should be possible to describe the existing meanings of byte and
> uint8 by saying that they behave as if predefined by:
>
>     type byte = uint8
>     type rune = int32

So, do that. Seems to work.

Updates #18130

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

7 years agocmd/compile: check that phis are always first after scheduling
Keith Randall [Tue, 6 Jun 2017 22:25:29 +0000 (15:25 -0700)]
cmd/compile: check that phis are always first after scheduling

Update #20178

Change-Id: I603f77268ed38afdd84228c775efe006f08f14a7
Reviewed-on: https://go-review.googlesource.com/45018
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
7 years agoruntime: intercept munmap as we do mmap
Ian Lance Taylor [Tue, 6 Jun 2017 22:08:59 +0000 (15:08 -0700)]
runtime: intercept munmap as we do mmap

For cgo programs on linux-amd64 we call the C function mmap.
This supports programs such as the C memory sanitizer that need to
intercept all calls to mmap. It turns out that there are programs that
intercept both mmap and munmap, or that at least expect that if they
intercept mmap, they also intercept munmap. So, if we permit mmap
to be intercepted, also permit munmap to be intercepted.

No test, as it requires two odd things: a C program that intercepts
mmap and munmap, and a Go program that calls munmap.

Change-Id: Iec33f47d59f70dbb7463fd12d30728c24cd4face
Reviewed-on: https://go-review.googlesource.com/45016
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
7 years agodoc: delete go1.8.txt
Brad Fitzpatrick [Tue, 6 Jun 2017 22:05:34 +0000 (22:05 +0000)]
doc: delete go1.8.txt

Fixes #20591

Change-Id: I2a4674a3430c5a4d3c569f3ea654c6ff4d9bf7ee
Reviewed-on: https://go-review.googlesource.com/45015
Reviewed-by: Ian Lance Taylor <iant@golang.org>
7 years agomath: clarify comment about bit-identical results across architectures
Ian Lance Taylor [Tue, 6 Jun 2017 21:21:16 +0000 (14:21 -0700)]
math: clarify comment about bit-identical results across architectures

Updates #18354.

Change-Id: I76bc4a73d8dc99eeda14b395e451d75a65184191
Reviewed-on: https://go-review.googlesource.com/45013
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
7 years agocmd/compile: reject unknown //go: comments in std library
Keith Randall [Tue, 6 Jun 2017 20:23:59 +0000 (13:23 -0700)]
cmd/compile: reject unknown //go: comments in std library

Fixes #18331

Change-Id: Ie5c6685be3002533b84604ff1f13f2f0850f29e2
Reviewed-on: https://go-review.googlesource.com/45010
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
7 years agodoc: start of go1.9.html release notes
Brad Fitzpatrick [Tue, 6 Jun 2017 00:04:12 +0000 (00:04 +0000)]
doc: start of go1.9.html release notes

Many TODOs remain.

Updates #20587

Change-Id: If49854ae4d36346d9e072a386f413cc85c66b62a
Reviewed-on: https://go-review.googlesource.com/45012
Reviewed-by: Ian Lance Taylor <iant@golang.org>
7 years agomath: add doc note about floating point operation
gulyasm [Sat, 7 Jan 2017 22:30:47 +0000 (23:30 +0100)]
math: add doc note about floating point operation

Go doesn't guarantee that the result of floating point operations will
be the same on different architectures. It was not stated in the
documentation, that can lead to confusion.

Fixes #18354

Change-Id: Idb1b4c256fb9a7158a74256136eca3b8ce44476f
Reviewed-on: https://go-review.googlesource.com/34938
Reviewed-by: Ian Lance Taylor <iant@golang.org>
7 years agocmd/compile: use file content, not suffix, to distinguish .a and .o files
Russ Cox [Thu, 1 Jun 2017 18:26:55 +0000 (14:26 -0400)]
cmd/compile: use file content, not suffix, to distinguish .a and .o files

This allows reading from package storage systems that may not
preserve the .a suffix (used with -importcfg).

Fixes #20579 (combined with CLs earlier in stack).

Change-Id: If2fc6a3d01bd0170a757e1f2ba9a22a4d9be7dbf
Reviewed-on: https://go-review.googlesource.com/44853
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
7 years agocmd/link: add -importcfg to specify import resolution
Russ Cox [Wed, 31 May 2017 15:35:29 +0000 (11:35 -0400)]
cmd/link: add -importcfg to specify import resolution

Adds the ability to specify the file location of each imported package,
like in the -importcfg added to cmd/compile in a related CL.
In effect, -importcfg is a generalization of and supersedes -installsuffix
and -L. Of course, those flags will continue to be supported, for
compatibility with other tools.

Having this flag in Go 1.9 will let us try some experiments involving
package management without needing guinea pigs to build a custom
Go toolchain.

This flag also helps with #14271 at some later point.

For #20579.

Change-Id: Ie4c171bcd3aa2faa446ac340e36516f2f9853882
Reviewed-on: https://go-review.googlesource.com/44851
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
7 years agocmd/compile: add -importcfg to specify import resolution
Russ Cox [Wed, 31 May 2017 15:19:54 +0000 (11:19 -0400)]
cmd/compile: add -importcfg to specify import resolution

Allows reading -importmap options from a file instead of putting
them all on the command line, and adds the ability to specify the
file location of specific packages. In effect, -importcfg is a generalization
of and supersedes -importmap, -importsuffix, and -I.
Of course, those flags will continue to be supported,
for compatibility with other tools.

Having this flag in Go 1.9 will let us try some experiments involving
package management without needing guinea pigs to build a
custom Go toolchain.

This flag also helps with #14271 at some later point.

For #20579.

Change-Id: If005dbc2b01d8fd16cbfd3687dfbe82499f4bc56
Reviewed-on: https://go-review.googlesource.com/44850
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
7 years agotime: strip monotonic clock reading in t.UTC, t.Local, t.In
Russ Cox [Mon, 5 Jun 2017 15:00:34 +0000 (11:00 -0400)]
time: strip monotonic clock reading in t.UTC, t.Local, t.In

Fixes #18991.

Change-Id: I46ded007b0c6a6e1173a55f3938007ab3a928dd9
Reviewed-on: https://go-review.googlesource.com/44858
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
7 years agostrings: document Split{,N,After,AfterN} edge cases
Alberto Donizetti [Tue, 6 Jun 2017 09:25:17 +0000 (11:25 +0200)]
strings: document Split{,N,After,AfterN} edge cases

Apparently people get confused by the fact that

  Split("", ",")

returns []{""} instead of []{}.

This is actually just a consequence of the fact that if the separator
sep (2nd argument) is not found the string s (1st argument), then the
Split* functions return a length 1 slice with the string s in it.

Document the general case: if sep is not in s, what you get is a len 1
slice with s in it; unless both s and sep are "", in that case you get
an empty slice of length 0.

Fixes #19726

Change-Id: I64c8220b91acd1e5aa1cc1829199e0cd8c47c404
Reviewed-on: https://go-review.googlesource.com/44950
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
7 years agoruntime: delay exiting while panic is running deferred functions
Ian Lance Taylor [Wed, 19 Apr 2017 14:32:34 +0000 (07:32 -0700)]
runtime: delay exiting while panic is running deferred functions

Try to avoid a race between the main goroutine exiting and a panic
occurring. Don't try too hard, to avoid hanging.

Updates #3934
Fixes #20018

Change-Id: I57a02b6d795d2a61f1cadd137ce097145280ece7
Reviewed-on: https://go-review.googlesource.com/41052
Reviewed-by: Austin Clements <austin@google.com>
7 years agogo/types: don't panic in complex division
Alberto Donizetti [Sat, 13 May 2017 17:11:44 +0000 (19:11 +0200)]
go/types: don't panic in complex division

Make sure that in complex division we reject divisors that would
underflow to zero when using the textbook complex-division method we
currently use.

This change does for go/types what golang.org/cl/42650 did for gc.

Fixes #20227

Change-Id: Iaa784ac5e60141f51c501eb0e3ce0e9c1c2993d0
Reviewed-on: https://go-review.googlesource.com/44590
Run-TryBot: Alberto Donizetti <alb.donizetti@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
7 years agoruntime: save and restore CR for ppc64le
Ian Lance Taylor [Fri, 2 Jun 2017 22:56:35 +0000 (15:56 -0700)]
runtime: save and restore CR for ppc64le

C code expects CR2, CR3, and CR4 to be preserved across function calls.
Preserve the entire CR register across function calls in
_rt0_ppc64le_linux_lib and crosscall2. The standard ppc64le call frame
uses 8(R1) as the place to save CR; emulate that.

It's hard to write a reliable test for this as it requires writing C
code that sets CR2, CR3, or CR4 across a call to a Go function.

Change-Id: If39e771a5b574602b848227312e83598fe74eab7
Reviewed-on: https://go-review.googlesource.com/44733
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Carlos Eduardo Seo <cseo@linux.vnet.ibm.com>
Reviewed-by: Lynn Boger <laboger@linux.vnet.ibm.com>
7 years agocmd/internal/obj/ppc64: fix MOVFL REG, CONST
Ian Lance Taylor [Fri, 2 Jun 2017 22:51:18 +0000 (15:51 -0700)]
cmd/internal/obj/ppc64: fix MOVFL REG, CONST

The MOVFL instruction (which external PPC64 docs call mtcrf) can take
either a CR register or a constant. It doesn't make sense to specify
both, as the CR register implies the constant value. Specifying either
a register or a constant is enforced by the implementation in the
asmout method (case 69).

However, the optab was providing a form that specified both a constant
and a CR register, and was not providing a form that specified only a
constant. This CL fixes the optab table to provide a form that takes
only a constant.

No test because I don't know where to write it. The next CL in this
series will use the new instruction format.

Change-Id: I8bb5d3ed60f483b54c341ce613931e126f7d7be6
Reviewed-on: https://go-review.googlesource.com/44732
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Lynn Boger <laboger@linux.vnet.ibm.com>
7 years agocmd/link: fix accidentally-quadratic library loading
Russ Cox [Wed, 31 May 2017 15:33:04 +0000 (11:33 -0400)]
cmd/link: fix accidentally-quadratic library loading

Programs built from N libraries required O(N²) time to do the
deduplication checks, even if there were never any duplicates.
In most programs N is small enough not to worry, but this may
affect large programs.

Noticed by inspection, not any specific bug report.

Fixes #20578.

Change-Id: Ic4108f1058be39da990a79b1e0b8ce95fde44cef
Reviewed-on: https://go-review.googlesource.com/44852
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
7 years agocmd/go: fix ugly "BUG" in go help message output
Russ Cox [Wed, 31 May 2017 15:47:33 +0000 (11:47 -0400)]
cmd/go: fix ugly "BUG" in go help message output

Change-Id: I4c579d0d02f6c9cbef1dc2bc2c93cff614538dea
Reviewed-on: https://go-review.googlesource.com/44854
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
7 years agocmd/go: include Fortran files in build ID computation
Russ Cox [Mon, 5 Jun 2017 14:23:42 +0000 (10:23 -0400)]
cmd/go: include Fortran files in build ID computation

Otherwise removing a .f file won't trigger a rebuild.
Noticed by inspection while working on the code.
I don't have a good way to write a test for this,
and I expect the code to change significantly in the next
release, but might as well get it right for Go 1.9.

Change-Id: I3f6f9f71b3a7d4f0be49a47419dac59899959e7c
Reviewed-on: https://go-review.googlesource.com/44855
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
7 years agodatabase/sql: ensure Rows is closed when Tx closes
Daniel Theophanes [Mon, 5 Jun 2017 16:04:05 +0000 (09:04 -0700)]
database/sql: ensure Rows is closed when Tx closes

Close any Rows queried within a Tx when the Tx is closed. This prevents
the Tx from blocking on rollback if a Rows query has not been closed yet.

Fixes #20575

Change-Id: I4efe9c4150e951d8a0f1c40d9d5e325964fdd608
Reviewed-on: https://go-review.googlesource.com/44812
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
7 years agonet/http: make Transport retry GetBody requests if nothing written
David Glasser [Fri, 28 Apr 2017 23:40:39 +0000 (16:40 -0700)]
net/http: make Transport retry GetBody requests if nothing written

This is another attempt at the change attempted in
https://golang.org/cl/27117 and rolled back in https://golang.org/cl/34134

The difference between this and the previous attempt is that this version only
retries if the new field GetBody is set on the Request.

Additionally, this allows retries of requests with idempotent methods even if
they have bodies, as long as GetBody is defined.

This also fixes an existing bug where readLoop could make a redundant call to
setReqCanceler for DELETE/POST/PUT/etc requests with no body with zero bytes
written.

This clarifies the existing TestRetryIdempotentRequestsOnError test (and changes
it into a test with 4 subtests).  When that test was written, it was in fact
testing "retry idempotent requests" logic, but the logic had changed since then,
and it was actually testing "retry requests with no body when no bytes have been
written". (You can confirm this by changing the existing test from a GET to a
DELETE; it passes without the changes in this CL.) We now test for the no-Body
and GetBody cases for both idempotent and nothing-written-non-idempotent
requests.

Fixes #18241
Fixes #17844

Change-Id: I69a48691796f6dc08c31f7aa7887b7dfd67e278a
Reviewed-on: https://go-review.googlesource.com/42142
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
7 years agocmd/internal/obj/arm: fix constant decomposition
Ben Shi [Sat, 27 May 2017 10:00:55 +0000 (10:00 +0000)]
cmd/internal/obj/arm:  fix constant decomposition

There are two issues in constant decomposition.

1. A typo in "func immrot2s" blocks "case 107" of []optab be triggered.

2. Though "ADD $0xffff, R0, R0" is decomposed to "ADD $0xff00, R0, R0" and
   "ADD $0x00ff, R0, R0" as expected, "ADD $0xffff, R0" still uses the
   constant pool, which should be the same as "ADD $0xffff, R0, R0".

This patch fixes them and adds more instruction encoding tests.

fix #20516

Change-Id: Icd7bdfa1946b29db15580dcb429111266f1384c6
Reviewed-on: https://go-review.googlesource.com/44335
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
7 years agoencoding/json: clarify unmarshaling behaviour on bad fields
Alberto Donizetti [Sat, 3 Jun 2017 19:36:51 +0000 (21:36 +0200)]
encoding/json: clarify unmarshaling behaviour on bad fields

Fixes #19526

Change-Id: Ifaaf454e0e89fdf4309118c2e2e6ac0d0a43c39d
Reviewed-on: https://go-review.googlesource.com/44711
Reviewed-by: Ian Lance Taylor <iant@golang.org>
7 years agoruntime: avoid division in gc
Ilya Tocar [Mon, 1 May 2017 19:27:36 +0000 (14:27 -0500)]
runtime: avoid division in gc

Replace int division with (cheaper) byte division in heapBitsSetType.
Provides noticeable speed-up:

GrowSlicePtr-6   181ns ± 3%   169ns ± 3%  -6.85%  (p=0.000 n=10+10)

Change-Id: I4064bb72e8e692023783b8f58d19491844c39382
Reviewed-on: https://go-review.googlesource.com/42290
Run-TryBot: Ilya Tocar <ilya.tocar@intel.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
7 years agoruntime: expand acceptable PingPongHog factor from 2 to 5
Austin Clements [Mon, 5 Jun 2017 14:59:57 +0000 (10:59 -0400)]
runtime: expand acceptable PingPongHog factor from 2 to 5

Since TestPingPongHog tests the scheduler, it's ultimately
probabilistic. Currently, it requires the result be at most of factor
of 2 off of the ideal. It turns out this isn't quite enough in
practice, with factors on 1000 iterations on linux/amd64 ranging from
0.48 to 2.5. If the test were failing, we would expect a factor closer
to 1000X, so it's pretty safe to expand the accepted factor from 2 to
5.

Fixes #20494.

Change-Id: If8f2e96194fe66f1fb981a965d1167fe74ff38d7
Reviewed-on: https://go-review.googlesource.com/44859
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

7 years agocmd/go: reject -buildmode=plugin if package is not main
Alexander Menzhinsky [Thu, 13 Apr 2017 21:15:26 +0000 (16:15 -0500)]
cmd/go: reject -buildmode=plugin if package is not main

Fixes #17625

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

7 years agocmd/compile: add valState to ssa sizeof tests
Josh Bleecher Snyder [Sat, 3 Jun 2017 15:25:15 +0000 (08:25 -0700)]
cmd/compile: add valState to ssa sizeof tests

I learned from CL 41770 that valState’s size
matters to compiler performance.
Encode that knowledge in a test.

Change-Id: I7c0fde6a4cf460017619dbcce1c1ddaa7af10239
Reviewed-on: https://go-review.googlesource.com/44737
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
7 years agocmd/cgo: show pos info in undefined name errors
Alberto Donizetti [Thu, 5 Jan 2017 16:27:34 +0000 (17:27 +0100)]
cmd/cgo: show pos info in undefined name errors

For test.go:

package main

import (
   "C"
   "fmt"
)

func main() {
 fmt.Println("Hello, world!")
 C.no_such_f()
}

Before:

could not determine kind of name for C.no_such_f

After:

./test.go:10:2: could not determine kind of name for C.no_such_f

Fixes #18452

Change-Id: I49c136b7fa60fab25d2d5b905d440fe4d106e565
Reviewed-on: https://go-review.googlesource.com/34783
Run-TryBot: Alberto Donizetti <alb.donizetti@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
7 years agoC: add Filippo Valsorda's cloudflare.com email (Cloudflare CLA)
Filippo Valsorda [Fri, 2 Jun 2017 20:01:30 +0000 (13:01 -0700)]
C: add Filippo Valsorda's cloudflare.com email (Cloudflare CLA)

Change-Id: I98d265bfa4f5944360d0258d2cb6bbc78010c708
Reviewed-on: https://go-review.googlesource.com/44731
Reviewed-by: Ian Lance Taylor <iant@golang.org>
7 years agogo/printer: don't emit unnecessary //line directives before empty lines
Robert Griesemer [Fri, 2 Jun 2017 00:51:02 +0000 (17:51 -0700)]
go/printer: don't emit unnecessary //line directives before empty lines

1) Split atLineBegin into its two components: writing of // line directives
and writing of indentation (no functionality changes).

2) Don't call writeLineDirective at the beginning of a line if we're
writing white space - it's not necessary. This is the bug fix.

3) Move testing of the SourcePos mode out of writeLineDirective and
into the (single) caller. Clearer and more efficient.

(Instead of these 3 changes one could also have simply called the
original atLineBegin with position p.out rather than p.pos. This
would have caused atLineBegin to not write a line directive.
Factoring the code seemed like a cleaner and more direct approach.)

Fixes #5945.

Change-Id: Ia8710806b6d3d4e5044116b142c036a4ab5a1764
Reviewed-on: https://go-review.googlesource.com/44651
Reviewed-by: Alan Donovan <adonovan@google.com>
7 years agobytes: note that NewBuffer take ownership of its argument
Alberto Donizetti [Fri, 2 Jun 2017 15:07:33 +0000 (17:07 +0200)]
bytes: note that NewBuffer take ownership of its argument

Fixes #19383

Change-Id: Ic84517053ced7794006f6fc65e6f249e97d6cf35
Reviewed-on: https://go-review.googlesource.com/44691
Reviewed-by: Ian Lance Taylor <iant@golang.org>
7 years agocmd/cover: take default value of total only once.
Dhananjay Nakrani [Sun, 28 May 2017 16:09:07 +0000 (09:09 -0700)]
cmd/cover: take default value of total only once.

Defaulting total to 1 for each function, adds up to the
counting error. testing/cover.go already does this once.

Fixes #20515

Change-Id: I0e3f524c2ccb628eb9a8f0a1f81c22365c24cf9a
Reviewed-on: https://go-review.googlesource.com/44337
Run-TryBot: Dhananjay Nakrani <dhananjayn@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
7 years agocmd/compile: retain source positions of arguments to inlined calls
David Lazar [Sat, 27 May 2017 21:43:37 +0000 (17:43 -0400)]
cmd/compile: retain source positions of arguments to inlined calls

Arguments to inlined calls are hidden from setPos as follows:

    args := as.Rlist
    as.Rlist.Set(nil)
    // setPos...
    as.Rlist.Set(args.Slice())

Previously, this code had no effect since the value of as was
overwritten by the assignment in the retvars loop.

Fixes #19799.

Change-Id: Iaf97259f82fdba8b236136337cc42b2774c7fef5
Reviewed-on: https://go-review.googlesource.com/44351
Run-TryBot: David Lazar <lazard@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
7 years agocmd/go: remove TestCoverageUsesActualSettingToOverrideEvenForRace
Ian Lance Taylor [Fri, 2 Jun 2017 00:49:55 +0000 (17:49 -0700)]
cmd/go: remove TestCoverageUsesActualSettingToOverrideEvenForRace

The test no longer passes as of https://golang.org/cl/43777, which
intentionally disables the feature that this test was checking for.
Nobody noticed since the test is not run in -short mode.

Updates #20435.

Change-Id: I64f37fd94c01f22ead88470b6d9bfe8a151ddb1c
Reviewed-on: https://go-review.googlesource.com/44650
Reviewed-by: Mikio Hara <mikioh.mikioh@gmail.com>
7 years agocompress/gzip: clarify behavior of Writer.Close
Joe Tsai [Fri, 2 Jun 2017 00:31:24 +0000 (17:31 -0700)]
compress/gzip: clarify behavior of Writer.Close

Fixes #20551

Change-Id: Ia47cae14a26fe5f278ad7209218d083cc50a3ff8
Reviewed-on: https://go-review.googlesource.com/44572
Reviewed-by: Ian Lance Taylor <iant@golang.org>
7 years agosort: clarify comment about not-a-number values
Ian Lance Taylor [Wed, 31 May 2017 21:06:25 +0000 (14:06 -0700)]
sort: clarify comment about not-a-number values

Updates #20540

Change-Id: I864008fadd77b0aeb10fe7e7f1ec696516a5add5
Reviewed-on: https://go-review.googlesource.com/44492
Reviewed-by: Robert Griesemer <gri@golang.org>