]> Cypherpunks repositories - gostls13.git/log
gostls13.git
7 years agonet/rpc: wait for responses to be written before closing Codec
Russ Cox [Wed, 22 Nov 2017 20:25:59 +0000 (15:25 -0500)]
net/rpc: wait for responses to be written before closing Codec

If there are no more requests being made, wait to shut down
the response-writing codec until the pending requests are all
answered.

Fixes #17239.

Change-Id: Ie62c63ada536171df4e70b73c95f98f778069972
Reviewed-on: https://go-review.googlesource.com/79515
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
7 years agoruntime: fix sysctl calling convention on netbsd/386
Brad Fitzpatrick [Wed, 29 Nov 2017 06:36:42 +0000 (06:36 +0000)]
runtime: fix sysctl calling convention on netbsd/386

Thanks to coypoop for noticing at:

  https://github.com/golang/go/issues/22914#issuecomment-347761838

FreeBSD/386 and NetBSD/386 diverged between Go 1.4 and Go 1.5 when
Russ sent https://golang.org/cl/135830043 (git rev 25f6b02ab0db8e)
to change the calling convention of the C compilers to match Go.
But netbsd wasn't updated.

Tested on a NetBSD/386 VM, since the builders aren't back up yet (due
to this bug)

Fixes #22914
Updates #19339
Updates #20852
Updates #16511

Change-Id: Id76ebe8f29bcc85e39b1c11090639d906cd6cf04
Reviewed-on: https://go-review.googlesource.com/80515
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Benny Siegert <bsiegert@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
7 years agotesting: add -failfast to go test
Inanc Gumus [Mon, 30 Oct 2017 19:41:14 +0000 (22:41 +0300)]
testing: add -failfast to go test

When -test.failfast flag is provided to go test,
no new tests get started after the first failure.

Fixes #21700

Change-Id: I0092e72f25847af05e7c8e1b811dcbb65a00cbe7
Reviewed-on: https://go-review.googlesource.com/74450
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
7 years agocmd/cgo: fix for function taking pointer typedef
Jess Frazelle [Tue, 18 Jul 2017 03:41:40 +0000 (23:41 -0400)]
cmd/cgo: fix for function taking pointer typedef

Fixes #19832

Change-Id: I7ce39c2c435d4716d8a42ac6784b4c87874c0e13
Reviewed-on: https://go-review.googlesource.com/49490
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
7 years agoos: correct err check in TestChdirAndGetwd
Tobias Klauser [Wed, 29 Nov 2017 10:46:48 +0000 (11:46 +0100)]
os: correct err check in TestChdirAndGetwd

Due to err being shadowed in the else brach, the actual err return of
fd1.Chdir() is never checked. Fix it by not shadowing err anymore.

Change-Id: I9f1d52e88d8bc9a1c035960aa7af9f5224a63ab0
Reviewed-on: https://go-review.googlesource.com/80556
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
7 years agosyscall: add missing err check in test
Tobias Klauser [Wed, 29 Nov 2017 10:38:03 +0000 (11:38 +0100)]
syscall: add missing err check in test

Follow CL 75810 which did the same for x/sys/unix.

Change-Id: I6314a97989631d589369c7b6001d1523ec2cc242
Reviewed-on: https://go-review.googlesource.com/80555
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
7 years agodoc/faq: tweak the wording in the new section on goroutine IDs
Rob Pike [Wed, 29 Nov 2017 05:05:01 +0000 (16:05 +1100)]
doc/faq: tweak the wording in the new section on goroutine IDs

There were too many changes of direction. Tidy up the intro a little
for better flow, and delete some unnecessary comments.

Change-Id: Ib5d85c0992626bd3152f86a51585884d3e0cab72
Reviewed-on: https://go-review.googlesource.com/80495
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
7 years agodoc/faq: explain why goroutines are anonymous
Rob Pike [Tue, 28 Nov 2017 05:05:59 +0000 (16:05 +1100)]
doc/faq: explain why goroutines are anonymous

Fixes #22770.

Change-Id: Ief62043fb6895e215d2530d2a3bf88f7ea58c875
Reviewed-on: https://go-review.googlesource.com/80195
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
7 years agocmd/compile: adjust lineno during import to get Pos right
David Chase [Mon, 27 Nov 2017 23:06:17 +0000 (18:06 -0500)]
cmd/compile: adjust lineno during import to get Pos right

Binary import sometimes constructs nodes using functions
that use the global lineno for the Position.  This causes
spurious numbers to appear in the assembly and the
debugging output.

Fix (targeted, because late in the cycle): save and restore
lineno around bimport calls known to use lineno-sensitive
functions.

Updates #22600.
(Comment: "This is a weird line to step through")

Change-Id: I9c4094670380609fe4b6696443fb02579521c596
Reviewed-on: https://go-review.googlesource.com/80115
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
7 years agocmd/compile: fix infinite recursion in isdirectiface
Matthew Dempsky [Tue, 28 Nov 2017 21:42:04 +0000 (13:42 -0800)]
cmd/compile: fix infinite recursion in isdirectiface

Fixes #22904.

Change-Id: Id504504eda7275c10d3c665add8b7ccd23f65820
Reviewed-on: https://go-review.googlesource.com/80301
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
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/compile: use NoXPos instead of lineno in typenod
Matthew Dempsky [Tue, 28 Nov 2017 18:04:29 +0000 (10:04 -0800)]
cmd/compile: use NoXPos instead of lineno in typenod

typenod is only used for anonymous types, which don't logically have
position information.

Passes toolstash-check.

Updates #19683.

Change-Id: I505424ae980b88c7deed5f23502c3cecb3dc0702
Reviewed-on: https://go-review.googlesource.com/80298
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
7 years agoall: drop support for FreeBSD 9 or below
Mikio Hara [Sat, 19 Aug 2017 04:46:48 +0000 (13:46 +0900)]
all: drop support for FreeBSD 9 or below

This change drops the support for FreeBSD 9 or below and simplifies
platform-dependent code for the sake of maintenance.

Updates #7187.
Fixes #11412.
Updates #16064.
Updates #18854.
Fixes #19072.

Change-Id: I9129130aafbfc7d0d7e9b674b6fc6cb31b7381be
Reviewed-on: https://go-review.googlesource.com/64910
Reviewed-by: Ian Lance Taylor <iant@golang.org>
7 years agocmd/go/internal/get: consistently have trailing slashes in prefixes
Brad Fitzpatrick [Tue, 28 Nov 2017 05:03:09 +0000 (05:03 +0000)]
cmd/go/internal/get: consistently have trailing slashes in prefixes

Fixes #18122

Change-Id: Ib4067422c0c447ddb2c3068dc6217393abc4eed0
Reviewed-on: https://go-review.googlesource.com/80175
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: document streaming nature of Response.Body
Brad Fitzpatrick [Mon, 27 Nov 2017 21:45:58 +0000 (21:45 +0000)]
net/http: document streaming nature of Response.Body

Fixes #22873

Change-Id: Ib2b7ee42a23b84db21cdfa693b62d5e6fbfdb54e
Reviewed-on: https://go-review.googlesource.com/80075
Reviewed-by: Tom Bergan <tombergan@google.com>
7 years agonet: accept 64 kB lines in /etc/hosts
Russ Cox [Wed, 22 Nov 2017 20:36:54 +0000 (15:36 -0500)]
net: accept 64 kB lines in /etc/hosts

Apparently 4 kB is not enough for some people.

Fixes #21674.

Change-Id: If39eeb225d548b578560939f6ce51e31060f5aff
Reviewed-on: https://go-review.googlesource.com/79516
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
7 years agonet/http: update bundled http2
Brad Fitzpatrick [Mon, 27 Nov 2017 23:51:07 +0000 (23:51 +0000)]
net/http: update bundled http2

Update http2 to x/net git rev db473f6b23.

(And un-skip TestWriteHeader0_h2 added in CL 80077, now fixed.)

Includes:

   http2: remove afterReqBodyWriteError wrapper
   https://golang.org/cl/75252

   http2: fix transport data race on reused *http.Request objects
   https://golang.org/cl/75530

   http2: require either ECDSA or RSA ciphersuite
   https://golang.org/cl/30721

   http2: don't log about timeouts reading client preface on new connections
   https://golang.org/cl/79498

   http2: don't crash in Transport on server's DATA following bogus HEADERS
   https://golang.org/cl/80056

   http2: panic on invalid WriteHeader status code
   https://golang.org/cl/80076

   http2: fix race on ClientConn.maxFrameSize
   https://golang.org/cl/79238

   http2: don't autodetect Content-Type when the response has an empty body
   https://golang.org/cl/80135

Fixes golang/go#18776
Updates golang/go#20784
Fixes golang/go#21316
Fixes golang/go#22721
Fixes golang/go#22880

Change-Id: Ie86e24e0ee2582a5a82afe5de3c7c801528be069
Reviewed-on: https://go-review.googlesource.com/80078
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Tom Bergan <tombergan@google.com>
7 years agoruntime: skip GDB tests on NetBSD
Ian Lance Taylor [Tue, 28 Nov 2017 00:48:48 +0000 (16:48 -0800)]
runtime: skip GDB tests on NetBSD

TestGdbAutotmpTypes times out for unknown reasons on NetBSd. Skip the
gdb tests on NetBSD for now.

Updates #22893

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

7 years agonet/http: panic on invalid WriteHeader status code
Brad Fitzpatrick [Mon, 27 Nov 2017 22:48:11 +0000 (22:48 +0000)]
net/http: panic on invalid WriteHeader status code

Panic if an http Handler does:

    rw.WriteHeader(0)

... or other invalid values. (for a forgiving range of valid)

I previously made it kinda work in https://golang.org/cl/19130 but
there's no good way to fake it in HTTP/2, and we want HTTP/1 and
HTTP/2 behavior to be the same, regardless of what programs do.
Currently HTTP/2 omitted the :status header altogether, which was a
protocol violation. In fixing that, I found CL 19130 added a test
about bogus WriteHeader values with the comment:

  // This might change at some point, but not yet in Go 1.6.

This now changes. Time to be strict.

Updates golang/go#228800

Change-Id: I20eb6c0e514a31f4bba305ac4c24266f39b95fd5
Reviewed-on: https://go-review.googlesource.com/80077
Reviewed-by: Tom Bergan <tombergan@google.com>
7 years agonet/textproto: reject all headers with a leading space
Tom Bergan [Mon, 27 Nov 2017 19:25:14 +0000 (11:25 -0800)]
net/textproto: reject all headers with a leading space

Previously, golang.org/cl/75350 updated ReadMIMEHeader to ignore the
first header line when it begins with a leading space, as in the
following example:

GET / HTTP/1.1
  Host: foo.com
Accept-Encoding: gzip

However, golang.org/cl/75350 changed ReadMIMEHeader's behavior for the
following example: before the CL it returned an error, but after the
CL it ignored the first line.

GET / HTTP/1.1
  Host foo.com
Accept-Encoding: gzip

This change updates ReadMIMEHeader to always fail when the first header
line starts with a space. During the discussion for golang.org/cl/75350,
we realized we had three competing needs:

1. HTTP clients should accept malformed response headers when possible
   (ignoring the malformed lines).

2. HTTP servers should reject all malformed request headers.

3. The net/textproto package is used by multiple protocols (most notably,
   HTTP and SMTP) which have slightly different parsing semantics. This
   complicates changes to net/textproto.

We weren't sure how to best fix net/textproto without an API change, but
it is too late for API changes in Go 1.10. We decided to ignore initial
lines that begin with spaces, thinking that would have the least impact on
existing users -- malformed headers would continue to parse, but the
initial lines would be ignored. Instead, golang.org/cl/75350 actually
changed ReadMIMEHeader to succeed in cases where it previously failed
(as in the above example).

Reconsidering the above two examples, there does not seem to be a good
argument to silently ignore ` Host: foo.com` but fail on ` Host foo.com`.
Hence, this change fails for *all* headers where the initial line begins
with a space.

Updates #22464

Change-Id: I68d3d190489c350b0bc1549735bf6593fe11a94c
Reviewed-on: https://go-review.googlesource.com/80055
Run-TryBot: Tom Bergan <tombergan@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
7 years agoencoding/json: remove the word "text" in "JSON text" from package docs.
rajender [Mon, 27 Nov 2017 18:28:29 +0000 (23:58 +0530)]
encoding/json: remove the word "text" in "JSON text" from package docs.

It was added in CL 79995. It is unnecessarily confusing.

Change-Id: Ib8ff35b9f71b54ff99d2d6e0534c7128e1f4345a
Reviewed-on: https://go-review.googlesource.com/80035
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
7 years agoencoding/json: update RFC number
rajender [Mon, 27 Nov 2017 17:49:12 +0000 (23:19 +0530)]
encoding/json: update RFC number

Existing docs mention obsolete RFC 4627. Update it with current one,
https://tools.ietf.org/html/rfc7159.

Current implementation already adhere to RFC 7159.

Fixes #22888

Change-Id: I705ec1313f6f655b3bc41d2f847b30e479bf9b15
Reviewed-on: https://go-review.googlesource.com/79995
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
7 years agocmd/compile: remove unused code
Keith Randall [Mon, 27 Nov 2017 16:12:50 +0000 (08:12 -0800)]
cmd/compile: remove unused code

Found a few functions in cmd/compile that aren't used.

Change-Id: I53957dae6f1a645feb8b95383f0f050964b4f7d4
Reviewed-on: https://go-review.googlesource.com/79975
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
7 years agogo/types: add debugging code to detect use of incomplete interfaces
Robert Griesemer [Tue, 21 Nov 2017 05:54:41 +0000 (21:54 -0800)]
go/types: add debugging code to detect use of incomplete interfaces

The comment for phase 2 of checker.interfaceType (typexpr.go:517)
requires that embedded interfaces be complete for correctness of
the algorithm.

Yet, the very next comment (typexpr.go:530) states that underlying
embedded interfaces may in fact be incomplete.

This is in fact the case and the underlying bug in issue #18395.

This change makes sure that new interface types are marked complete
when finished (per the implicit definition in Interface.Complete,
type.go:302). It also adds a check, enabled in debug mode only, to
detect the use of incomplete embedded interfaces during construction
of a new interface. In debug mode, this check fails for the testcase
in the issue (and several others).

This change has no noticeable impact with debug mode disabled.

For #18395.

Change-Id: Ibb81e47257651282fb3755a80a36ab5d392e636d
Reviewed-on: https://go-review.googlesource.com/78955
Reviewed-by: Alan Donovan <adonovan@google.com>
7 years agodoc: update URL of the go1.4 source snapshot to use dl.google.com
Andrew Bonventre [Sun, 26 Nov 2017 16:30:39 +0000 (11:30 -0500)]
doc: update URL of the go1.4 source snapshot to use dl.google.com

Updates golang/go#20672

Change-Id: I88a1d8693ef9d1e4758719603ce1f3c3f6b920bc
Reviewed-on: https://go-review.googlesource.com/79936
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
7 years agomath/cmplx: use signed zero to correct branch cuts
Brian Kessler [Fri, 23 Jun 2017 08:50:14 +0000 (01:50 -0700)]
math/cmplx: use signed zero to correct branch cuts

Branch cuts for the elementary complex functions along real or imaginary axes
should be resolved in floating point calculations by one-sided continuity with
signed zero as described in:

"Branch Cuts for Complex Elementary Functions or Much Ado About Nothing's Sign Bit"
W. Kahan

Available at: https://people.freebsd.org/~das/kahan86branch.pdf

And as described in the C99 standard which is claimed as the original cephes source.

Sqrt did not return the correct branch when imag(x) == 0. The branch is now
determined by sign(imag(x)).  This incorrect branch choice was affecting the behavior
of the Trigonometric/Hyperbolic functions that use Sqrt in intermediate calculations.

Asin, Asinh and Atan had spurious domain checks, whereas the functions should be valid
over the whole complex plane with appropriate branch cuts.

Fixes #6888

Change-Id: I9b1278af54f54bfb4208276ae345bbd3ddf3ec83
Reviewed-on: https://go-review.googlesource.com/46492
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
7 years agocrypto/x509: add ParsePKCS1PublicKey and MarshalPKCS1PublicKey
Travis Cline [Sat, 15 Jul 2017 20:32:18 +0000 (14:32 -0600)]
crypto/x509: add ParsePKCS1PublicKey and MarshalPKCS1PublicKey

Fixes #21029

Change-Id: I308e2a2977870d8554a629f8ce38876598dba2a8
Reviewed-on: https://go-review.googlesource.com/48988
Run-TryBot: Adam Langley <agl@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Filippo Valsorda <hi@filippo.io>
Reviewed-by: Adam Langley <agl@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
7 years agointernal/poll: do not use Windows TransmitFile with pipes
Alex Brainman [Thu, 23 Nov 2017 07:21:52 +0000 (18:21 +1100)]
internal/poll: do not use Windows TransmitFile with pipes

It appears that TransmitFile Windows API does not work with Windows
pipes. So just copy data from pipe and into TCP connection manually.

Fixes #22278

Change-Id: I4810caca5345eac5bffb3176956689b8ae993256
Reviewed-on: https://go-review.googlesource.com/79775
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
7 years agocrypto/x509: document specifically that only v3 certificates are created.
Adam Langley [Sat, 25 Nov 2017 18:54:18 +0000 (10:54 -0800)]
crypto/x509: document specifically that only v3 certificates are created.

Fixes #21593

Change-Id: I5d6c644ed1d60ae4610712155bae5cf13ee1f886
Reviewed-on: https://go-review.googlesource.com/79876
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
7 years agoencoding/asn1: support Unmarshaling NumericString
Mansour Rahimi [Sat, 18 Nov 2017 21:00:16 +0000 (22:00 +0100)]
encoding/asn1: support Unmarshaling NumericString

ASN.1 has an specific string type, called NumericString (tag 18). The
value of this type can be numeric characters (0-9) and space.

Fixes #22396

Change-Id: Ia6d81ab7faa311ff22759bf76862626974d3013e
Reviewed-on: https://go-review.googlesource.com/78655
Run-TryBot: Adam Langley <agl@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
7 years agodoc: fix a sentence position.
Ryuji Iwata [Sat, 25 Nov 2017 09:09:54 +0000 (18:09 +0900)]
doc: fix a sentence position.

Only a last sentence of A Tour of Go is shifting to the left.
I fixed a HTML tag order according to other sentences it.

Change-Id: I6a301178d15db893f596b8da80a4d98721160386
Reviewed-on: https://go-review.googlesource.com/79856
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
7 years agoruntime: fix final stack split in exitsyscall
Austin Clements [Fri, 24 Nov 2017 15:12:44 +0000 (10:12 -0500)]
runtime: fix final stack split in exitsyscall

exitsyscall should be recursively nosplit, but we don't have a way to
annotate that right now (see #21314). There's exactly one remaining
place where this is violated right now: exitsyscall -> casgstatus ->
print. The other prints in casgstatus are wrapped in systemstack
calls. This fixes the remaining print.

Updates #21431 (in theory could fix it, but that would just indicate
that we have a different G status-related crash and we've *never* seen
that failure on the dashboard.)

Change-Id: I9a5e8d942adce4a5c78cfc6b306ea5bda90dbd33
Reviewed-on: https://go-review.googlesource.com/79815
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: Rick Hudson <rlh@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

7 years agoruntime: tweak doc for Goexit
Emmanuel Odeke [Thu, 23 Nov 2017 22:31:28 +0000 (15:31 -0700)]
runtime: tweak doc for Goexit

Use singular form of panic and remove the unnecessary
'however', when comparing Goexit's behavior to 'a panic'
as well as what happens for deferred recovers with Goexit.

Change-Id: I3116df3336fa135198f6a39cf93dbb88a0e2f46e
Reviewed-on: https://go-review.googlesource.com/79755
Reviewed-by: Rob Pike <r@golang.org>
7 years agoos/exec: Stdout/Stderr doc cleanup.
Tom Lanyon [Thu, 23 Nov 2017 01:21:25 +0000 (12:21 +1100)]
os/exec: Stdout/Stderr doc cleanup.

Following comments on CL 76320.

Breaks Cmd.Std{out,err} doc into three paragraphs and updates Cmd.Stdin
formatting to match.

Fixes an erroneous reference to Stdin in the output goroutine comment, while
keeping the wording consistent between Stdin and Stdout/Stderr.

Change-Id: I186a0e2d4b85dfb939443a17e62a1eb2ef64b1bf
Reviewed-on: https://go-review.googlesource.com/79595
Reviewed-by: Rob Pike <r@golang.org>
7 years agosyscall: remove dragonfly/386 from mkall.sh
Tobias Klauser [Thu, 23 Nov 2017 10:21:06 +0000 (11:21 +0100)]
syscall: remove dragonfly/386 from mkall.sh

dragonfly/386 isn't a valid GOOS/GOARCH pair and there are no generated
files for this pair in syscall.

Change-Id: Ibea2103c2f5e139139d850df3aac9b5a9c4ac9ab
Reviewed-on: https://go-review.googlesource.com/79675
Reviewed-by: Ian Lance Taylor <iant@golang.org>
7 years agocmd/dist: omit dragonfly/386 GOOS/GOARCH pair
Tobias Klauser [Thu, 23 Nov 2017 09:16:02 +0000 (10:16 +0100)]
cmd/dist: omit dragonfly/386 GOOS/GOARCH pair

dragonfly/386 isn't a valid GOOS/GOARCH pair.

Change-Id: I44374a932b20f0d49b2e509484143970eb5464c2
Reviewed-on: https://go-review.googlesource.com/79656
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
7 years agonet: skip TestLookupLongTXT on Plan 9
David du Colombier [Thu, 23 Nov 2017 11:46:18 +0000 (12:46 +0100)]
net: skip TestLookupLongTXT on Plan 9

CL 79555 added TestLookupLongTXT. However, this test is
failing on Plan 9, because the DNS resolver (ndb/dns)
only returns a single TXT record.

Updates #22857.

Change-Id: I33cdc63a3d3de4d1c7f2684934316c44992fb9e2
Reviewed-on: https://go-review.googlesource.com/79695
Run-TryBot: David du Colombier <0intro@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
7 years agodoc: fix typo in Effective Go: s/ReaderWriter/ReadWriter/
Tom Levy [Thu, 23 Nov 2017 01:32:03 +0000 (14:32 +1300)]
doc: fix typo in Effective Go: s/ReaderWriter/ReadWriter/

Change-Id: I3bfe1b11265f0def4701faf2cfc1ad10a666a473
Reviewed-on: https://go-review.googlesource.com/79596
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
7 years agoruntime: document sigtrampgo better
Austin Clements [Thu, 23 Nov 2017 02:58:57 +0000 (21:58 -0500)]
runtime: document sigtrampgo better

Add an explanation of why sigtrampgo is nosplit.

Updates #21314.

Change-Id: I3f5909d2b2c180f9fa74d53df13e501826fd4316
Reviewed-on: https://go-review.googlesource.com/79615
Reviewed-by: Ian Lance Taylor <iant@golang.org>
7 years agonet: fix LookupTXT of long records on Windows
Russ Cox [Wed, 22 Nov 2017 21:15:11 +0000 (16:15 -0500)]
net: fix LookupTXT of long records on Windows

The response to a TXT lookup is a sequence of RRs,
each of which contains a sequence of string fragments.

The correct handling of the response is to do:

    for each rr {
        list = append(list, strings.Join(rr.fragments, ""))
    }

(like in at dnsRR_TXT.Walk, used on most platforms).

The Windows code incorrectly does:

    for each rr {
        list = append(list, rr.fragments...)
    }

This CL fixes it to concatenate fragments, as it must.

Fixes #21472.

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

7 years agoos/signal: don't run TestTerminalSignal on Android
Ian Lance Taylor [Wed, 22 Nov 2017 23:14:33 +0000 (15:14 -0800)]
os/signal: don't run TestTerminalSignal on Android

At least some versions of the Android libc do not define posix_openpt.

Updates #22845

Change-Id: Id21705f47ef0f9694313a7dc7351a952d48d407b
Reviewed-on: https://go-review.googlesource.com/79399
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: add TestACL
Alex Brainman [Thu, 16 Nov 2017 05:38:19 +0000 (16:38 +1100)]
cmd/go: add TestACL

Add test that verifies that go command produces executable
that have security attributes of the target directory.

Update #22343

Change-Id: Ieab02381927a2b09bee21c49c043b3298bd088e6
Reviewed-on: https://go-review.googlesource.com/78215
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
7 years agoos/exec: update docs for cmd.Std{out,err} and cmd.Wait to clarify how copying is...
Tom Lanyon [Tue, 7 Nov 2017 05:16:24 +0000 (16:16 +1100)]
os/exec: update docs for cmd.Std{out,err} and cmd.Wait to clarify how copying is done

Fixes #22610.

Change-Id: I172fe1d1941a8a2750af7ee75f7af7e81a702c40
Reviewed-on: https://go-review.googlesource.com/76320
Reviewed-by: Ian Lance Taylor <iant@golang.org>
7 years agogo/types: fix type in Interface.Complete method
Robert Griesemer [Wed, 22 Nov 2017 21:12:42 +0000 (13:12 -0800)]
go/types: fix type in Interface.Complete method

This doesn't appear to have caused problems (because we don't depend
on the sort order, it seems) but it's clearly incorrect.

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

7 years agoruntime: print runtime frames in throwsplit trace
Austin Clements [Wed, 22 Nov 2017 20:29:03 +0000 (15:29 -0500)]
runtime: print runtime frames in throwsplit trace

newstack manually prints the stack trace if we try to grow the stack
when throwsplit is set. However, the default behavior is to omit
runtime frames. Since runtime frames can be critical to understanding
this crash, this change fixes this traceback to include them.

Updates #21431.

Change-Id: I5aa43f43aa2f10a8de7d67bcec743427be3a3b5d
Reviewed-on: https://go-review.googlesource.com/79518
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

7 years agoruntime: call throw on systemstack in exitsyscall
Austin Clements [Wed, 22 Nov 2017 20:26:35 +0000 (15:26 -0500)]
runtime: call throw on systemstack in exitsyscall

If exitsyscall tries to grow the stack it will panic, but throw calls
print, which can grow the stack. Move the two bare throws in
exitsyscall to the system stack.

Updates #21431.

Change-Id: I5b29da5d34ade908af648a12075ed327a864476c
Reviewed-on: https://go-review.googlesource.com/79517
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

7 years agoos/signal: fix t.Fatal that should be t.Fatalf
Ian Lance Taylor [Wed, 22 Nov 2017 21:00:42 +0000 (13:00 -0800)]
os/signal: fix t.Fatal that should be t.Fatalf

Change-Id: I2a24b2bde9a7c641b3bc802ff8b2ddebf4990109
Reviewed-on: https://go-review.googlesource.com/79496
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Dave Cheney <dave@cheney.net>
TryBot-Result: Gobot Gobot <gobot@golang.org>

7 years agoos/signal: don't run TestTerminalSignal on Solaris
Ian Lance Taylor [Wed, 22 Nov 2017 19:27:16 +0000 (11:27 -0800)]
os/signal: don't run TestTerminalSignal on Solaris

Fixes #22849

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

7 years agocmd/vet: add missing %v to the verb regex
Daniel Martí [Wed, 22 Nov 2017 18:21:39 +0000 (18:21 +0000)]
cmd/vet: add missing %v to the verb regex

In golang.org/cl/74352, the print rules were overhauled to give better
error messages. This also meant adding a regex to find and extract the
used formatting verbs.

However, %v was missed. Add it to the expression, and add a test too.

Fixes #22847.

Change-Id: If117cc364db0cb91373742239b8a626c137642b0
Reviewed-on: https://go-review.googlesource.com/79455
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
7 years agonet/http: implement sniffing for some fonts
Emmanuel Odeke [Tue, 27 Jun 2017 06:47:17 +0000 (00:47 -0600)]
net/http: implement sniffing for some fonts

Implement sniffing for fonts:
* MS Font object  --> "application/vnd.ms-fontobject"
* ttf   --> "application/font-ttf"

* off   --> "application/font-off"
* otf   --> "application/font-off"

* cff   --> "application/font-cff"
* woff   --> "application/font-woff"

Fixes #20808

Change-Id: Ibe02a87d3c9d610c6a30e1b6c03f4e520404e70f
Reviewed-on: https://go-review.googlesource.com/47553
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
7 years agoos/signal: make TestTerminalSignal more reliable
Ian Lance Taylor [Wed, 22 Nov 2017 15:13:25 +0000 (07:13 -0800)]
os/signal: make TestTerminalSignal more reliable

Look for program output and shell prompt to see when to continue.

Updates #22845

Change-Id: I44ed1908861f3b0dc098aee9a401324b77268921
Reviewed-on: https://go-review.googlesource.com/79395
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Munday <mike.munday@ibm.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
7 years agocmd/compile, go/types: error if main.main is not a function
Matthew Dempsky [Wed, 22 Nov 2017 17:43:52 +0000 (09:43 -0800)]
cmd/compile, go/types: error if main.main is not a function

Fixes #21256.

Change-Id: I3af4c76e734c09d07f15525b793a544a7279b906
Reviewed-on: https://go-review.googlesource.com/79435
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
7 years agocmd/link: fix export data truncation bug
Matthew Dempsky [Tue, 21 Nov 2017 19:27:20 +0000 (11:27 -0800)]
cmd/link: fix export data truncation bug

Similar fix as in CL 60773 for fixing cmd/pack.

Fixes #21703.

Change-Id: I457ed8a3be828fd458abc5c8c1cc766a9f7aab13
Reviewed-on: https://go-review.googlesource.com/79135
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
7 years agoos/user: fix darwin GetGroupIds for n > 256
Kevin Burke [Mon, 31 Jul 2017 04:14:10 +0000 (21:14 -0700)]
os/user: fix darwin GetGroupIds for n > 256

If a Mac user has more than 256 groups, getGroupList returns -1 but
does not correctly set n. We need to retry the syscall with an
ever-increasing group size until we get all of the user's groups.

The easiest way to test this change is to set n to a value lower than
the current user's number of groups, test on a Mac and observe
a failure, then apply the patch and test that it passes.

Fixes #21067.

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

7 years agoruntime/debug: make SetGCPercent(-1) wait for concurrent GC
Austin Clements [Tue, 21 Nov 2017 22:19:43 +0000 (17:19 -0500)]
runtime/debug: make SetGCPercent(-1) wait for concurrent GC

Currently, SetGCPercent(-1) disables GC, but doesn't wait for any
currently running concurrent GC to finish, so GC can still be running
when it returns. This is a change in behavior from Go 1.8, probably
defies user expectations, and can break various runtime tests that
depend on SetGCPercent(-1) to disable garbage collection in order to
prevent preemption deadlocks.

Fix this by making SetGCPercent(-1) block until any concurrently
running GC cycle finishes.

Fixes #22443.

Change-Id: I904133a34acf97a7942ef4531ace0647b13930ef
Reviewed-on: https://go-review.googlesource.com/79195
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 mapassign_fast* routines for pointer keys
Keith Randall [Tue, 21 Nov 2017 15:14:11 +0000 (07:14 -0800)]
cmd/compile: fix mapassign_fast* routines for pointer keys

The signature of the mapassign_fast* routines need to distinguish
the pointerness of their key argument.  If the affected routines
suspend part way through, the object pointed to by the key might
get garbage collected because the key is typed as a uint{32,64}.

This is not a problem for mapaccess or mapdelete because the key
in those situations do not live beyond the call involved.  If the
object referenced by the key is garbage collected prematurely, the
code still works fine.  Even if that object is subsequently reallocated,
it can't be written to the map in time to affect the lookup/delete.

Fixes #22781

Change-Id: I0bbbc5e9883d5ce702faf4e655348be1191ee439
Reviewed-on: https://go-review.googlesource.com/79018
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: Martin Möhrmann <moehrmann@google.com>
7 years agosyscall: add missing fs locking in Link, Rename on nacl
Tim Wright [Wed, 22 Nov 2017 03:11:56 +0000 (19:11 -0800)]
syscall: add missing fs locking in Link, Rename on nacl

Per the comments at the head of fs_nacl.go, unexported methods expect
the fs mutex to have been taken by the caller.
This change brings Link and Rename into line with the other exported
functions wrt fs locking.

Fixes #22690

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

7 years agoencoding/json: reduce allocations by Decoder for \uXXXX
Michael Schurter [Sat, 3 Jun 2017 20:36:54 +0000 (13:36 -0700)]
encoding/json: reduce allocations by Decoder for \uXXXX

Manually convert hex escape sequence to rune instead of calling
strconv.ParseUint.

This inlines the unhex func from docs (and many other packages).

name              old time/op    new time/op    delta
UnicodeDecoder-4     468ns ± 1%     402ns ± 1%  -14.26%  (p=0.000
n=10+10)

name              old speed      new speed      delta
UnicodeDecoder-4  29.9MB/s ± 1%  34.8MB/s ± 1%  +16.59%  (p=0.000
n=10+10)

name              old alloc/op   new alloc/op   delta
UnicodeDecoder-4     44.0B ± 0%     36.0B ± 0%  -18.18%  (p=0.000
n=10+10)

name              old allocs/op  new allocs/op  delta
UnicodeDecoder-4      4.00 ± 0%      2.00 ± 0%  -50.00%  (p=0.000
n=10+10)

Fixes #20567

Change-Id: If350978d5bb98ff517485752184d02249f5d1f3a
Reviewed-on: https://go-review.googlesource.com/44738
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

7 years agodoc: update the URL of the latest go1.4 source snapshot
Brad Fitzpatrick [Wed, 22 Nov 2017 01:38:40 +0000 (01:38 +0000)]
doc: update the URL of the latest go1.4 source snapshot

Updates golang/go#20672

Change-Id: I3c62b1606aec93e188255f1701c0af569d540016
Reviewed-on: https://go-review.googlesource.com/79276
Reviewed-by: Ian Lance Taylor <iant@golang.org>
7 years agointernal/poll: loop on EINTR in Read on Darwin
Ian Lance Taylor [Tue, 21 Nov 2017 23:24:12 +0000 (15:24 -0800)]
internal/poll: loop on EINTR in Read on Darwin

Test is in os/signal package because the problem is signal related.

Fixes #22838.

Change-Id: I223eeebb5fbc972910737eddef8ab9784cb984a6
Reviewed-on: https://go-review.googlesource.com/79215
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
7 years agodoc: rename Gogland to GoLand
Florin Patan [Wed, 22 Nov 2017 01:10:59 +0000 (01:10 +0000)]
doc: rename Gogland to GoLand

This updates the name of the IDE and the capability it has.

Fixes #22784

Change-Id: Ief261324c86bc77a03071629f496f4d4d9df1b44
Reviewed-on: https://go-review.googlesource.com/79255
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
7 years agotest: make inline_callers.go test not inline the runtime
Austin Clements [Tue, 21 Nov 2017 22:55:18 +0000 (17:55 -0500)]
test: make inline_callers.go test not inline the runtime

CL 76551 modified inline_callers.go to build everything, including the
runtime, with -l=4. While that works in most places (and ideally
should work everywhere), it blows out the nosplit stack on
solaris/amd64.

Fix this by only building the test itself with -l=4.

This undoes some of the changes to this test from CL 73212, which
originally changed the go tool to rebuild all packages with the given
flags. This change modified the expected output of this test, so now
that we can go back to building only the test itself with inlining, we
revert these changes to the expected output. (That CL also changed
log.Fatalf to log.Printf, but didn't add "\n" to the end of the lines,
so this CL fixes that, too.)

Fixes #22797.

Change-Id: I6a91963a59ebe98edbe0921d8717af6b2c2191b0
Reviewed-on: https://go-review.googlesource.com/79197
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
7 years agoruntime: fix build on non-Linux platforms
Brad Fitzpatrick [Tue, 21 Nov 2017 20:46:40 +0000 (20:46 +0000)]
runtime: fix build on non-Linux platforms

CL 78538 was updated after running TryBots to depend on
syscall.NanoSleep which isn't available on all non-Linux platforms.

Change-Id: I1fa615232b3920453431861310c108b208628441
Reviewed-on: https://go-review.googlesource.com/79175
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
7 years agotime: rename TestLoadLocationFromTzinfo to TestLoadLocationFromTZData
Dmitri Shuralyov [Tue, 21 Nov 2017 20:53:47 +0000 (15:53 -0500)]
time: rename TestLoadLocationFromTzinfo to TestLoadLocationFromTZData

Tzinfo was replaced with TZData during the review of CL 68890, but this
instance was forgotten. Update it for consistency.

Follows CL 68890.
Updates #20629.

Change-Id: Id6d3c4f5f7572b01065f2db556db605452d1b570
Reviewed-on: https://go-review.googlesource.com/79176
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
7 years agocmd/internal/obj/x86: fix /is4 encoding for VBLEND
isharipo [Mon, 20 Nov 2017 17:56:05 +0000 (20:56 +0300)]
cmd/internal/obj/x86: fix /is4 encoding for VBLEND

Fixes VBLENDVP{D/S}, VPBLENDVB encoding for /is4 imm8[7:4]
encoded register operand.

Explanation:
`reg[r]+regrex[r]+1` will yield correct values for 8..15 reg indexes,
but for 0..7 it gives `index+1` results.
There was no test that used lower 8 register with /is4 encoding,
so the bug passed the tests.
The proper solution is to get 4th bit from regrex with a proper shift:
`reg[r]|(regrex[r]<<1)`.

Instead of inlining `reg[r]|(regrex[r]<<1)` expr,
using new `regIndex(r)` function.

Test that reproduces this issue is added to
amd64enc_extra.s test suite.

Bug came from https://golang.org/cl/70650.

Change-Id: I846a25e88d5e6df88df9d9c3f5fe94ec55416a33
Reviewed-on: https://go-review.googlesource.com/78815
Run-TryBot: Iskander Sharipov <iskander.sharipov@intel.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ilya Tocar <ilya.tocar@intel.com>
7 years agodoc: fix some typos in diagnostics.html
Reilly Watson [Tue, 21 Nov 2017 16:00:58 +0000 (11:00 -0500)]
doc: fix some typos in diagnostics.html

The section about custom pprof paths referenced the wrong path.

This also fixes a couple minor grammatical issues elsewhere in the doc.

Fixes #22832

Change-Id: I890cceb53a13c1958d9cf958c658ccfcbb6863d5
Reviewed-on: https://go-review.googlesource.com/79035
Reviewed-by: Alberto Donizetti <alb.donizetti@gmail.com>
7 years agotime: fix build on Android
Brad Fitzpatrick [Tue, 21 Nov 2017 19:43:08 +0000 (19:43 +0000)]
time: fix build on Android

Some type renames were missing in the android file from CL 79017

Change-Id: I419215575ca7975241afb8d2069560c8b1d142c6
Reviewed-on: https://go-review.googlesource.com/79136
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
7 years agoruntime: skip netpoll check if there are no waiters
Michael Pratt [Mon, 20 Nov 2017 19:01:00 +0000 (11:01 -0800)]
runtime: skip netpoll check if there are no waiters

If there are no netpoll waiters then calling netpoll will never find any
goroutines. The later blocking netpoll in findrunnable already has this
optimization.

With golang.org/cl/78538 also applied, this change has a small impact on
latency:

name                             old time/op  new time/op  delta
WakeupParallelSpinning/0s-12     13.6µs ± 1%  13.7µs ± 1%    ~     (p=0.873 n=19+20)
WakeupParallelSpinning/1µs-12    17.7µs ± 0%  17.6µs ± 0%  -0.31%  (p=0.000 n=20+20)
WakeupParallelSpinning/2µs-12    20.2µs ± 2%  19.9µs ± 1%  -1.59%  (p=0.000 n=20+19)
WakeupParallelSpinning/5µs-12    32.0µs ± 1%  32.1µs ± 1%    ~     (p=0.201 n=20+19)
WakeupParallelSpinning/10µs-12   51.7µs ± 0%  51.4µs ± 1%  -0.60%  (p=0.000 n=20+18)
WakeupParallelSpinning/20µs-12   92.2µs ± 0%  92.2µs ± 0%    ~     (p=0.474 n=19+19)
WakeupParallelSpinning/50µs-12    215µs ± 0%   215µs ± 0%    ~     (p=0.319 n=20+19)
WakeupParallelSpinning/100µs-12   330µs ± 2%   331µs ± 2%    ~     (p=0.296 n=20+19)
WakeupParallelSyscall/0s-12       127µs ± 0%   126µs ± 0%  -0.57%  (p=0.000 n=18+18)
WakeupParallelSyscall/1µs-12      129µs ± 0%   128µs ± 1%  -0.43%  (p=0.000 n=18+19)
WakeupParallelSyscall/2µs-12      131µs ± 1%   130µs ± 1%  -0.78%  (p=0.000 n=20+19)
WakeupParallelSyscall/5µs-12      137µs ± 1%   136µs ± 0%  -0.54%  (p=0.000 n=18+19)
WakeupParallelSyscall/10µs-12     147µs ± 1%   146µs ± 0%  -0.58%  (p=0.000 n=18+19)
WakeupParallelSyscall/20µs-12     168µs ± 0%   167µs ± 0%  -0.52%  (p=0.000 n=19+19)
WakeupParallelSyscall/50µs-12     228µs ± 0%   227µs ± 0%  -0.37%  (p=0.000 n=19+18)
WakeupParallelSyscall/100µs-12    329µs ± 0%   328µs ± 0%  -0.28%  (p=0.000 n=20+18)

There is a bigger improvement in CPU utilization. Before this CL, these
benchmarks spent 12% of cycles in netpoll, which are gone after this CL.

This also fixes the sched.lastpoll load, which should be atomic.

Change-Id: I600961460608bd5ba3eeddc599493d2be62064c6
Reviewed-on: https://go-review.googlesource.com/78915
Run-TryBot: Michael Pratt <mpratt@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
Reviewed-by: Austin Clements <austin@google.com>
7 years agoruntime: only sleep before stealing work from a running P
Jamie Liu [Wed, 15 Nov 2017 20:47:22 +0000 (12:47 -0800)]
runtime: only sleep before stealing work from a running P

The sleep in question does not make sense if the stolen-from P cannot
run the stolen G. The usleep(3) has been observed delaying execution of
woken G's by ~60us; skipping it reduces the wakeup-to-execution latency
to ~7us in these cases, improving CPU utilization.

Benchmarks added by this change:

name                             old time/op  new time/op  delta
WakeupParallelSpinning/0s-12     14.4µs ± 1%  14.3µs ± 1%     ~     (p=0.227 n=19+20)
WakeupParallelSpinning/1µs-12    18.3µs ± 0%  18.3µs ± 1%     ~     (p=0.950 n=20+19)
WakeupParallelSpinning/2µs-12    22.3µs ± 1%  22.3µs ± 1%     ~     (p=0.670 n=20+18)
WakeupParallelSpinning/5µs-12    31.7µs ± 0%  31.7µs ± 0%     ~     (p=0.460 n=20+17)
WakeupParallelSpinning/10µs-12   51.8µs ± 0%  51.8µs ± 0%     ~     (p=0.883 n=20+20)
WakeupParallelSpinning/20µs-12   91.9µs ± 0%  91.9µs ± 0%     ~     (p=0.245 n=20+20)
WakeupParallelSpinning/50µs-12    214µs ± 0%   214µs ± 0%     ~     (p=0.509 n=19+20)
WakeupParallelSpinning/100µs-12   335µs ± 0%   335µs ± 0%   -0.05%  (p=0.006 n=17+15)
WakeupParallelSyscall/0s-12       228µs ± 2%   129µs ± 1%  -43.32%  (p=0.000 n=20+19)
WakeupParallelSyscall/1µs-12      232µs ± 1%   131µs ± 1%  -43.60%  (p=0.000 n=19+20)
WakeupParallelSyscall/2µs-12      236µs ± 1%   133µs ± 1%  -43.44%  (p=0.000 n=18+19)
WakeupParallelSyscall/5µs-12      248µs ± 2%   139µs ± 1%  -43.68%  (p=0.000 n=18+19)
WakeupParallelSyscall/10µs-12     263µs ± 3%   150µs ± 2%  -42.97%  (p=0.000 n=18+20)
WakeupParallelSyscall/20µs-12     281µs ± 2%   170µs ± 1%  -39.43%  (p=0.000 n=19+19)
WakeupParallelSyscall/50µs-12     345µs ± 4%   246µs ± 7%  -28.85%  (p=0.000 n=20+20)
WakeupParallelSyscall/100µs-12    460µs ± 5%   350µs ± 4%  -23.85%  (p=0.000 n=20+20)

Benchmarks associated with the change that originally added this sleep
(see https://golang.org/s/go15gomaxprocs):

name        old time/op  new time/op  delta
Chain       19.4µs ± 2%  19.3µs ± 1%    ~     (p=0.101 n=19+20)
ChainBuf    19.5µs ± 2%  19.4µs ± 2%    ~     (p=0.840 n=19+19)
Chain-2     19.9µs ± 1%  19.9µs ± 2%    ~     (p=0.734 n=19+19)
ChainBuf-2  20.0µs ± 2%  20.0µs ± 2%    ~     (p=0.175 n=19+17)
Chain-4     20.3µs ± 1%  20.1µs ± 1%  -0.62%  (p=0.010 n=19+18)
ChainBuf-4  20.3µs ± 1%  20.2µs ± 1%  -0.52%  (p=0.023 n=19+19)
Powser       2.09s ± 1%   2.10s ± 3%    ~     (p=0.908 n=19+19)
Powser-2     2.21s ± 1%   2.20s ± 1%  -0.35%  (p=0.010 n=19+18)
Powser-4     2.31s ± 2%   2.31s ± 2%    ~     (p=0.578 n=18+19)
Sieve        13.6s ± 1%   13.6s ± 1%    ~     (p=0.909 n=17+18)
Sieve-2      8.02s ±52%   7.28s ±15%    ~     (p=0.336 n=20+16)
Sieve-4      4.00s ±35%   3.98s ±26%    ~     (p=0.654 n=20+18)

Change-Id: I58edd8ce01075859d871e2348fc0833e9c01f70f
Reviewed-on: https://go-review.googlesource.com/78538
Reviewed-by: Austin Clements <austin@google.com>
7 years agotime: enable Location loading from user provided timezone data
Florian Uekermann [Fri, 6 Oct 2017 15:16:43 +0000 (17:16 +0200)]
time: enable Location loading from user provided timezone data

The return values of the LoadLocation are inherently dependent
on the runtime environment. Add LoadLocationFromTZData, whose
results depend only on the timezone data provided as arguments.

Fixes #20629

Change-Id: I43b181f4c05c219be3ec57327540263b7cb3b2aa
Reviewed-on: https://go-review.googlesource.com/68890
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
7 years agobytes: add optimized countByte for arm64
Wei Xiao [Fri, 16 Jun 2017 06:45:14 +0000 (06:45 +0000)]
bytes: add optimized countByte for arm64

Use SIMD instructions when counting a single byte.
Inspired from runtime IndexByte implementation.

Benchmark results of bytes, where 1 byte in every 8 is the one we are looking:

name               old time/op   new time/op    delta
CountSingle/10-8    96.1ns ± 1%    38.8ns ± 0%    -59.64%  (p=0.000 n=9+7)
CountSingle/32-8     172ns ± 2%      36ns ± 1%    -79.27%  (p=0.000 n=10+10)
CountSingle/4K-8    18.2µs ± 1%     0.9µs ± 0%    -95.17%  (p=0.000 n=9+10)
CountSingle/4M-8    18.4ms ± 0%     0.9ms ± 0%    -95.00%  (p=0.000 n=10+9)
CountSingle/64M-8    284ms ± 4%      19ms ± 0%    -93.40%  (p=0.000 n=10+10)

name               old speed     new speed      delta
CountSingle/10-8   104MB/s ± 1%   258MB/s ± 0%   +147.99%  (p=0.000 n=9+10)
CountSingle/32-8   185MB/s ± 1%   897MB/s ± 1%   +385.33%  (p=0.000 n=9+10)
CountSingle/4K-8   225MB/s ± 1%  4658MB/s ± 0%  +1967.40%  (p=0.000 n=9+10)
CountSingle/4M-8   228MB/s ± 0%  4555MB/s ± 0%  +1901.71%  (p=0.000 n=10+9)
CountSingle/64M-8  236MB/s ± 4%  3575MB/s ± 0%  +1414.69%  (p=0.000 n=10+10)

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

7 years agocmd/compile: ignore RegKill ops for non-phi after phi check
Than McIntosh [Tue, 14 Nov 2017 18:56:18 +0000 (13:56 -0500)]
cmd/compile: ignore RegKill ops for non-phi after phi check

Relax the 'phi after non-phi' SSA sanity check to allow
RegKill ops interspersed with phi ops in a block. This fixes
a sanity check failure when -dwarflocationlists is enabled.

Updates #22694.

Change-Id: Iaae604ab6f1a8b150664dd120003727a6fb2f698
Reviewed-on: https://go-review.googlesource.com/77610
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
7 years agocmd/compile: fix comment that -N does not disable escape analysis
Cherry Zhang [Fri, 17 Nov 2017 15:03:55 +0000 (10:03 -0500)]
cmd/compile: fix comment that -N does not disable escape analysis

-N does not disable escape analysis. Remove the outdated comment.

Change-Id: I96978b3afd51324b7b4f8035cf4417fb2eac4ebc
Reviewed-on: https://go-review.googlesource.com/79015
Reviewed-by: David Chase <drchase@google.com>
7 years agotime: rename internal type data to dataIO
Russ Cox [Tue, 21 Nov 2017 15:09:05 +0000 (10:09 -0500)]
time: rename internal type data to dataIO

This allows LoadTimezoneFromTZData to have a parameter named data.

Change-Id: I11c115745c7f697244f806bcd654f697dab73de1
Reviewed-on: https://go-review.googlesource.com/79017
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
7 years agonet: fix typo in parsePort documentation
Tobias Klauser [Tue, 21 Nov 2017 07:21:11 +0000 (08:21 +0100)]
net: fix typo in parsePort documentation

Change-Id: Ia302d9018690cd26890f874c70bd0c429a4b51f0
Reviewed-on: https://go-review.googlesource.com/78975
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
7 years agocmd/compile: improve debugging output for GOSSAFUNC
David Chase [Mon, 20 Nov 2017 21:47:08 +0000 (16:47 -0500)]
cmd/compile: improve debugging output for GOSSAFUNC

This changes the assembly language output to use the
innermost (instead of outermost) position for line
number and file.

The file is printed separately, only when it changes,
to remove redundant and space-consuming noise from the
output.

Unknown positions have line number "?"

The output format was changed slightly to make it
easier to read.

One source of gratuitous variation in debugging output was
removed.

Change-Id: I1fd9c8b0ddd82766488582fb684dce4b04f35723
Reviewed-on: https://go-review.googlesource.com/78895
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
7 years agocmd/link: use . as DW_AT_comp_dir
Heschi Kreinick [Thu, 16 Nov 2017 21:19:19 +0000 (16:19 -0500)]
cmd/link: use . as DW_AT_comp_dir

Go's DWARF usually has absolute paths, in which case DW_AT_comp_dir
doesn't matter. But the -trimpath flag produces relative paths, and
then the spec says that they are relative to _comp_dir.

There's no way to know what the "right" value of _comp_dir is without
more user input, but we can at least leave the paths alone rather than
making them absolute.

After this change, Delve can find sources to a program built with
-gcflags=-trimpath=$(pwd) as long as it's run in the right directory.

Change-Id: I8bc7bed098e352d2c06800bfbbe14e8392e1bbed
Reviewed-on: https://go-review.googlesource.com/78415
Run-TryBot: Heschi Kreinick <heschi@google.com>
Reviewed-by: Russ Cox <rsc@golang.org>
7 years agocmd/internal/obj/arm64: fix assemble msr/mrs bug
fanzha02 [Tue, 13 Jun 2017 11:07:34 +0000 (11:07 +0000)]
cmd/internal/obj/arm64: fix assemble msr/mrs bug

The arguments <pstatefield> is a struct that includes two elements,
element reg is special register, elememt enc is pstate field values.
The current code compares two different type values and get a incorrect
result.

The fix follows pstate field to create a systemreg struct,
each system register has a vaule to use in instruction.

Uncomment the msr/mrs cases.

Fixes #21464

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

7 years agocmd/compile: hint on wrong case-field names in composite literals
Emmanuel Odeke [Sat, 18 Nov 2017 07:21:06 +0000 (00:21 -0700)]
cmd/compile: hint on wrong case-field names in composite literals

Improve the error message for wrong
case-field names in composite literals,
by mentioning the correct field name.

Given the program:
package main

type it struct {
        ID string
}

func main() {
        i1 := &it{id: "Bar"}
}

just like we do for usage of fields, we now
report wrongly cased fields as hints to give:

ts.go:8:14: unknown field 'id' in struct literal of type it (but does have ID)

instead of before:

ts.go:8:14: unknown field 'id' in struct literal of type it

Fixes #22794

Change-Id: I18cd70e75817025cb1df083503cae306e8d659fd
Reviewed-on: https://go-review.googlesource.com/78545
Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
7 years agocmd/internal/obj/arm64: fix assemble hlt/hvc/smc/brk/clrex bug
fanzha02 [Wed, 14 Jun 2017 03:42:36 +0000 (03:42 +0000)]
cmd/internal/obj/arm64: fix assemble hlt/hvc/smc/brk/clrex bug

When instruction has only one argument, Go parser saves the
argument value into prog.From without any special handling.
But assembler gets the argument value from prog.To.

The fix adds special handling for CLREX and puts other instructions
arguments value into prog.From.

Uncomment hlt/hvc/smc/brk/dcps1/dcps2/dcps3/clrex test cases.

Fixes #20765

Change-Id: I1fc0d2faafb19b537cab5a665bd4af56c3a2c925
Reviewed-on: https://go-review.googlesource.com/78275
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
7 years agocmd/doc: don't print a declaration twice
Rob Pike [Mon, 20 Nov 2017 03:12:43 +0000 (14:12 +1100)]
cmd/doc: don't print a declaration twice

That can occur if we have -u set and there is an upper- and lower-case
name of the same spelling in a single declaration.

A rare corner case but easy to fix.

Fix by remembering what we've printed.

Fixes #21797.

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

7 years agocmd/go: fix typo in error message
Laurent Voisin [Sun, 19 Nov 2017 18:25:47 +0000 (19:25 +0100)]
cmd/go: fix typo in error message

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

7 years agocmd/doc: print a symbol error on "bytes Foo"
Daniel Martí [Sun, 19 Nov 2017 17:28:46 +0000 (17:28 +0000)]
cmd/doc: print a symbol error on "bytes Foo"

In golang.org/cl/59413, the two-argument behavior of cmd/doc was changed
to use findPackage instead of build.Import, meaning that the tool was
more consistent and useful.

However, it introduced a regression:

$ go doc bytes Foo
doc: no such package: bytes

This is because the directory list search would not find Foo in bytes,
and reach the end of the directory list - thus resulting in a "no such
package" error, since no directory matched our first argument.

Move the "no such package" error out of parseArgs, so that the "loop
until something is printed" loop can have control over it. In
particular, it is useful to know when we have reached the end of the
list without any exact match, yet we did find one package matching
"bytes":

$ go doc bytes Foo
doc: no symbol Foo in package bytes

While at it, make the "no such package" error not be fatal so that we
may test for it. It is important to have the test, as parseArgs may now
return a nil package instead of exiting the entire program, potentially
meaning a nil pointer dereference panic.

Fixes #22810.

Change-Id: I90cc6fd755e2d1675bea6d49a1c13cc18ac9bfb9
Reviewed-on: https://go-review.googlesource.com/78677
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
7 years agobytes: don't use an iota for the readOp constants
Daniel Martí [Sun, 19 Nov 2017 13:40:05 +0000 (13:40 +0000)]
bytes: don't use an iota for the readOp constants

As per the comments in golang.org/cl/78617. Also leaving a comment here,
to make sure noone else thinks to re-introduce the iota like I did.

Change-Id: I2a2275998b81896eaa0e9d5ee0197661ebe84acf
Reviewed-on: https://go-review.googlesource.com/78676
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
7 years agotesting: fix invalid error message about argument of TestMain
Kunpei Sakai [Mon, 23 Oct 2017 06:27:04 +0000 (15:27 +0900)]
testing: fix invalid error message about argument of TestMain

Also, this commit adds a test for ensuring that TestMain(t *testing.T) is a normal test.

Fixes #22388

Change-Id: Iffcb1db5cdcf34b9c822fcdb58f8926535415177
Reviewed-on: https://go-review.googlesource.com/72591
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
7 years agotime: fix typo in doc
Ross Chater [Sun, 19 Nov 2017 02:45:08 +0000 (02:45 +0000)]
time: fix typo in doc

Change-Id: I44bd5fa14ac6c4367927ae312e03ede06fcc7bb9
Reviewed-on: https://go-review.googlesource.com/78675
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
7 years agoruntime/pprof: fix doc typo
Davor Kapsa [Sat, 18 Nov 2017 19:48:08 +0000 (20:48 +0100)]
runtime/pprof: fix doc typo

Change-Id: I6e814182d89c3e7ff184141af097af0afb844d00
Reviewed-on: https://go-review.googlesource.com/78620
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
7 years agobytes: make all readOp constants actually typed
Daniel Martí [Sat, 18 Nov 2017 15:53:53 +0000 (15:53 +0000)]
bytes: make all readOp constants actually typed

This is a regression introduced in golang.org/cl/28817. That change got
rid of the iota, which meant that the type was no longer applied to all
the constant names.

Re-add the iota starting at -1, simplifying the code and adding the
types once more.

Change-Id: I38bd0e04f8d298196bccd33651e29f5011401a8d
Reviewed-on: https://go-review.googlesource.com/78617
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
7 years agocmd/dist: skip SWIG tests on Android
Elias Naur [Sat, 18 Nov 2017 10:43:43 +0000 (11:43 +0100)]
cmd/dist: skip SWIG tests on Android

They were added in CL 78175 but doesn't run on Android (yet). Skip
them for now.

For the Android builders.

Change-Id: I3b4bfe1f0d820ab98cf50aaab1ee2fad1a44a851
Reviewed-on: https://go-review.googlesource.com/78615
Run-TryBot: Elias Naur <elias.naur@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
7 years agocmd/go: always copy files on Windows
Ian Lance Taylor [Tue, 24 Oct 2017 14:22:26 +0000 (07:22 -0700)]
cmd/go: always copy files on Windows

Copying ensures that we respect the NTFS permissions of the parent folder.
I don't know if there is a way to tell when it is safe to simply rename.

Fixes #22343

Change-Id: I424bfe655b53b0e0fe425ce92bbc15450d52d851
Reviewed-on: https://go-review.googlesource.com/72910
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
7 years agodatabase/sql: check for arg counts after eliminating arguments
Daniel Theophanes [Thu, 9 Nov 2017 22:14:44 +0000 (14:14 -0800)]
database/sql: check for arg counts after eliminating arguments

Check for the expected number of arguments in a SQL statement
after arguments are eliminated in the argument converter.

This situation was already tested for in TestNamedValueChecker.
However the test used Exec which didn't have any check for
NumInput on it at all, thus this issue was never caught.

In addition to moving the NumInput check on the Query
methods after the converter, add the NumInput check
to the Exec methods as well.

Fixes #22630

Change-Id: If45920c6e1cf70dca63822a0cedec2cdc5cc611c
Reviewed-on: https://go-review.googlesource.com/76732
Run-TryBot: Daniel Theophanes <kardianos@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
7 years agobuiltin: improve docs for make slice
Ian Lance Taylor [Thu, 16 Nov 2017 17:35:31 +0000 (09:35 -0800)]
builtin: improve docs for make slice

Fixes #22764

Change-Id: I339d3bbb08983e0d69d69a1d00c4d15d0661762a
Reviewed-on: https://go-review.googlesource.com/78335
Reviewed-by: Rob Pike <r@golang.org>
7 years agocmd/go: tweak support options test for old compilers
Ian Lance Taylor [Sat, 18 Nov 2017 00:51:17 +0000 (16:51 -0800)]
cmd/go: tweak support options test for old compilers

Fixes #22787

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

7 years agocmd/dist: return dropped tests from misc/cgo/test
Lynn Boger [Tue, 14 Nov 2017 20:50:38 +0000 (15:50 -0500)]
cmd/dist: return dropped tests from misc/cgo/test

In a previous change to cmd/dist/test.go to fix some pie
testcases, a few other tests were incorrectly dropped.
This returns the testcases that shouldn't have been removed.

Fixes #22708

Change-Id: I2f735f4fd3a378f0f45d12a99768638aeb4787c7
Reviewed-on: https://go-review.googlesource.com/77650
Run-TryBot: Russ Cox <rsc@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
7 years agocmd/cgo: special case C ptr types to use uintptr
Keith Randall [Tue, 26 Sep 2017 22:14:50 +0000 (15:14 -0700)]
cmd/cgo: special case C ptr types to use uintptr

Some C types are declared as pointers, but C code
stores non-pointers in them.  When the Go garbage
collector sees such a pointer, it gets unhappy.

Instead, for these types represent them on the Go
side with uintptr.

We need this change to handle Apple's CoreFoundation
CF*Ref types. Users of these types might need to
update their code like we do in root_cgo_darwin.go.
The only change that is required under normal
circumstances is converting some nils to 0.
A go fix module is provided to help.

Fixes #21897

RELNOTE=yes

Change-Id: I9716cfb255dc918792625f42952aa171cd31ec1b
Reviewed-on: https://go-review.googlesource.com/66332
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
7 years agocmd/compile: delete temporary files when test finishes
Michael Munday [Fri, 17 Nov 2017 10:01:06 +0000 (10:01 +0000)]
cmd/compile: delete temporary files when test finishes

I noticed some files prefixed with ssa_fg_tmp in the /tmp folder of
the s390x builder. runGenTest (a helper for TestGenFlowGraph) wasn't
deleting its temporary files. The distinct prefix made this easy to
figure out.

Change-Id: If0d608aaad04a414e74e29f027ec9443c626e4eb
Reviewed-on: https://go-review.googlesource.com/78475
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>

7 years agocmd/internal/obj/x86: add AVX2 gather and VSIB
isharipo [Wed, 15 Nov 2017 17:56:10 +0000 (20:56 +0300)]
cmd/internal/obj/x86: add AVX2 gather and VSIB

Enables AVX2 gather instructions and VSIB support,
which makes vm32{x,y} vm64{x,y} operands encodable.

AXXX constants placed with respect to sorting order.
New VEX optabs inserted near non-VEX entries to simplify
potential transition to auto-generated VSIB optabs.

Tests go into new AMD64 encoder test file (amd64enc_extra.s)
to avoid unnecessary interactions with auto-generated "amd64enc.s".

Side note: x86avxgen did not produced these instructions
because x86.v0.2.csv misses them.
This also explains why x86 test suite have no AVX2 gather
instructions tests.

List of new instructions:
  VGATHERPDP
  VGATHERDPS
  VGATHERQPD
  VGATHERQPS
  VPGATHERDD
  VPGATHERDQ
  VPGATHERQD
  VPGATHERQQ

Change-Id: Iac852f3c5016523670bd99de6bec6a48f66fb4f6
Reviewed-on: https://go-review.googlesource.com/77970
Run-TryBot: Iskander Sharipov <iskander.sharipov@intel.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ilya Tocar <ilya.tocar@intel.com>
7 years agocrypto/x509: always emit a critical SAN extension if the Subject is empty.
Adam Langley [Fri, 13 Oct 2017 22:36:01 +0000 (15:36 -0700)]
crypto/x509: always emit a critical SAN extension if the Subject is empty.

The RFC is a little ambiguous here: “the subject field contains an empty
sequence” could mean that it's a non-empty sequence where one of the
sets contains an empty sequence. But, in context, I think it means “the
subject field is an empty sequence”.

Fixes #22249

Change-Id: Idfe1592411573f6e871b5fb997e7d545597a0937
Reviewed-on: https://go-review.googlesource.com/70852
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
7 years agocrypto/x509: relax EKU checking in some cases.
Adam Langley [Mon, 13 Nov 2017 18:38:05 +0000 (10:38 -0800)]
crypto/x509: relax EKU checking in some cases.

CL 71030 enforced EKU nesting at verification time, to go along with the
change in name constraints behaviour. From scanning the Certificate
Transparency logs, it's clear that some CAs are not getting EKU nesting
correct.

This change relaxes the EKU rules in a few ways:
  ∙ EKUs in roots are no longer checked.
  ∙ Any CA certificate may issue OCSP responder certificates.
  ∙ The ServerAuth and SGC EKUs are treated as a single EKU when
    checking nesting.
  ∙ ServerAuth in a CA can now authorise ClientAuth.
  ∙ The generic CodeSigning EKU can now authorise two, Microsoft-specific
    code-signing EKUs.

Change-Id: I7b7ac787709af0dcd177fe419ec2e485b8d85540
Reviewed-on: https://go-review.googlesource.com/77330
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
7 years agocrypto/x509: don't fail to parse addition elements in GeneralSubtree.
Adam Langley [Mon, 13 Nov 2017 18:56:54 +0000 (10:56 -0800)]
crypto/x509: don't fail to parse addition elements in GeneralSubtree.

The GeneralSubtree structure can have additional elements after the name
(minimum and maximum, which are unused). Previously these fields, if
present, would cause a parse error. This change allows trailing data in
the GeneralSubtrees structure.

Change-Id: I6bfb11ec355fa6812810a090c092a5ee0fdeddc3
Reviewed-on: https://go-review.googlesource.com/77333
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
7 years agoRevert "net: Forget lookups for canceled contexts"
Brad Fitzpatrick [Fri, 17 Nov 2017 17:13:49 +0000 (17:13 +0000)]
Revert "net: Forget lookups for canceled contexts"

This reverts commit 6a3d4be3b80054b1d802b73d5a519e252e0f82ed.

Reason for revert: breaks various builds. See comments on CL 77670

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