]> Cypherpunks repositories - gostls13.git/log
gostls13.git
9 years agoencoding/asn1: check bounds when parsing tag and length
Kyle Isom [Thu, 4 Jun 2015 20:23:25 +0000 (13:23 -0700)]
encoding/asn1: check bounds when parsing tag and length

This was found while fuzzing another program, triggering a panic in
x509.ParseECPrivateKey.

Fixes #11154

Change-Id: Ief35ead38adf14caec4d37b9eacf8a92e67cd1e6
Reviewed-on: https://go-review.googlesource.com/10712
Reviewed-by: Adam Langley <agl@golang.org>
Run-TryBot: Adam Langley <agl@golang.org>

9 years agofmt: scanning widths apply after leading spaces
Rob Pike [Fri, 12 Jun 2015 23:17:08 +0000 (16:17 -0700)]
fmt: scanning widths apply after leading spaces

When scanning with a width, as in %5s, C skips leading spaces
brefore counting the 5 characters. We should do the same.

Reword the documentation about widths to make this clear.

Fixes #9444

Change-Id: I443a6441adcf1c834057ef3977f9116a987a79cd
Reviewed-on: https://go-review.googlesource.com/10997
Reviewed-by: Andrew Gerrand <adg@golang.org>
9 years agocmd/vet: extend copylocks to anonymous functions
Josh Bleecher Snyder [Sat, 13 Jun 2015 02:49:45 +0000 (19:49 -0700)]
cmd/vet: extend copylocks to anonymous functions

Running -copylocks over a large corpus generates 1507 warnings.
Of those, only 3 are from the new anonymous function check,
but they are all bugs.

Fixes #10927.

Change-Id: I2672f6871036bed711beec5f88bc39aa8b3b6a94
Reviewed-on: https://go-review.googlesource.com/11051
Reviewed-by: Rob Pike <r@golang.org>
9 years agogo/parser: add ParseExprFrom function
Robert Griesemer [Fri, 12 Jun 2015 23:33:49 +0000 (16:33 -0700)]
go/parser: add ParseExprFrom function

This is needed for code that relies on having the correct file set
when parsing an expression only. There's currently no other way to
get to the file set otherwise or to invoke the parser correctly to
work on an expression only with a given file set.

Change-Id: I325f174cb34b69284e627f59fe8334efa4eaa45c
Reviewed-on: https://go-review.googlesource.com/10998
Reviewed-by: Alan Donovan <adonovan@google.com>
9 years agodoc/go1.5.txt: mention GidMappingsEnableSetgroups in linux SysProcAttr
Ian Lance Taylor [Fri, 12 Jun 2015 23:41:46 +0000 (16:41 -0700)]
doc/go1.5.txt: mention GidMappingsEnableSetgroups in linux SysProcAttr

Change-Id: I412621497902fa36f4939df392b10ca7040fc36e
Reviewed-on: https://go-review.googlesource.com/11003
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agosyscall: add GidMappingsEnableSetgroups to Linux SysProcAttr
Alexander Morozov [Wed, 3 Jun 2015 17:50:39 +0000 (10:50 -0700)]
syscall: add GidMappingsEnableSetgroups to Linux SysProcAttr

Linux 3.19 made a change in the handling of setgroups and the 'gid_map' file to
address a security issue.
The upshot of the 3.19 changes is that in order to update the 'gid_maps' file,
use of the setgroups() system call in this user namespace must first be disabled
by writing "deny" to one of the /proc/PID/setgroups files for this namespace.

Also added tests for remapping uid_map and gid_map inside new user
namespace.

Fixes #10626

Change-Id: I4d2539acbab741a37092d277e10f31fc39a8feb7
Reviewed-on: https://go-review.googlesource.com/10670
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agogo/types: add Example of API usage
Alan Donovan [Thu, 11 Jun 2015 20:44:08 +0000 (16:44 -0400)]
go/types: add Example of API usage

Change-Id: I9d3253b80508d733053789d6cb9645e029bf52e4
Reviewed-on: https://go-review.googlesource.com/10927
Reviewed-by: Robert Griesemer <gri@golang.org>
9 years agoarchive/tar: fix slice bounds out of range
Michael Gehring [Fri, 12 Jun 2015 20:49:42 +0000 (22:49 +0200)]
archive/tar: fix slice bounds out of range

Sanity check the pax-header size field before using it.

Fixes #11167.

Change-Id: I9d5d0210c3990e6fb9434c3fe333be0d507d5962
Reviewed-on: https://go-review.googlesource.com/10954
Reviewed-by: David Symonds <dsymonds@golang.org>
9 years agodoc/effective_go: fix grammatical error
Brandon Gilmore [Fri, 12 Jun 2015 18:32:22 +0000 (11:32 -0700)]
doc/effective_go: fix grammatical error

Change-Id: Ib52854169f3dd18f54d3ae9263c897d3f45ea869
Reviewed-on: https://go-review.googlesource.com/10982
Reviewed-by: Andrew Gerrand <adg@golang.org>
9 years agofmt: require newlines to match when scanning with a format
Rob Pike [Fri, 5 Jun 2015 21:23:54 +0000 (14:23 -0700)]
fmt: require newlines to match when scanning with a format

The documentation says that newlines behave like this:

Scan etc.: newlines are spaces.
Scanln etc.: newlines terminate the scan.
Scanf etc.: newlines must match in input and format.

The code did not implement this behavior in all cases,
especially for Scanf. Make it behave:

- Fix the handling of spaces and newlines in ss.Advance.
The code is longer but now behaves as it should.

- Delete the reuse of the current ss in newScanState.
There is really no need, since it's only used in recursive
calls to Scan etc., and the flags are likely wrong. Simpler
just to allocate a new one every time, and likelier to
be correct.

Fixes #10862.

Change-Id: If060ac021017346723b0d62de4e5a305da898f68
Reviewed-on: https://go-review.googlesource.com/10991
Reviewed-by: Andrew Gerrand <adg@golang.org>
9 years agoencoding/csv: skip blank lines when FieldsPerRecord >= 0
Damien Neil [Wed, 3 Jun 2015 23:04:01 +0000 (16:04 -0700)]
encoding/csv: skip blank lines when FieldsPerRecord >= 0

Fixes #11050.

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

9 years agomime: add mime.types paths for BSDs
Michael Gehring [Thu, 11 Jun 2015 09:51:54 +0000 (11:51 +0200)]
mime: add mime.types paths for BSDs

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

9 years agocmd/go: fix documentation
Alexandre Cesaro [Fri, 12 Jun 2015 10:16:07 +0000 (12:16 +0200)]
cmd/go: fix documentation

The command "go tool pprof help" does not work:

    $ go tool pprof help
    open help: no such file or directory

The right command is "go tool pprof -h".

Change-Id: Icef5d4ab76774905854e46665ac1166d26d35f46
Reviewed-on: https://go-review.googlesource.com/10970
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agocmd/dist: convert testso test into Go
Alex Brainman [Tue, 2 Jun 2015 03:46:28 +0000 (13:46 +1000)]
cmd/dist: convert testso test into Go

I would like to re-apply reverted http://golang.org/cl/8523.
Reverted tests still fail in some environments (see issue #10360).
It is easier to run tests selectively when in Go.
This CL prepares for the changes.

Updates #10360

Change-Id: Iefeb1d71cb3d1cfa653a6ccd9f6e35686c0c5b24
Reviewed-on: https://go-review.googlesource.com/10608
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocmd/go: clean up after 'go build' even on windows
Alex Brainman [Thu, 11 Jun 2015 02:20:42 +0000 (12:20 +1000)]
cmd/go: clean up after 'go build' even on windows

This CL makes CL 10682 work on windows.

Fixes #9645 (again)

Change-Id: Ie9b9af8b041c483a236b46adad4a50aa6e598c92
Reviewed-on: https://go-review.googlesource.com/10930
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agospec: clarify meaning of x op= y
Robert Griesemer [Thu, 11 Jun 2015 20:21:46 +0000 (13:21 -0700)]
spec: clarify meaning of x op= y

Suggested by mdempsky (see also issue #11161).

Change-Id: I1ab28febe19b7a092029499015073ce8749b4d99
Reviewed-on: https://go-review.googlesource.com/10960
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agocmd/go: add some parallelism to the testsuite
Ian Lance Taylor [Wed, 10 Jun 2015 21:40:47 +0000 (14:40 -0700)]
cmd/go: add some parallelism to the testsuite

As these tests were originally in bash, they are not designed to be
particularly hermetic.  This CL adds various protective mechanisms to
try to catch cases where the tests can not run in parallel.

Change-Id: I983bf7b6ffba04eda58b4939eb89b0bdfcda8eff
Reviewed-on: https://go-review.googlesource.com/10911
Reviewed-by: Andrew Gerrand <adg@golang.org>
9 years agocmd/go: in testsuite, sleep for less than one second if possible
Ian Lance Taylor [Thu, 11 Jun 2015 17:40:20 +0000 (10:40 -0700)]
cmd/go: in testsuite, sleep for less than one second if possible

Examine the mtime of an existing file to guess a length of time to
sleep to ensure a different mtime.

Change-Id: I9e8b5c9486f5c3c8bd63125e3ed4763ce1ba767d
Reviewed-on: https://go-review.googlesource.com/10932
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agoruntime: wait to update arena_used until after mapping bitmap
Russ Cox [Mon, 8 Jun 2015 02:59:29 +0000 (22:59 -0400)]
runtime: wait to update arena_used until after mapping bitmap

This avoids a race with gcmarkwb_m that was leading to faults.

Fixes #10212.

Change-Id: I6fcf8d09f2692227063ce29152cb57366ea22487
Reviewed-on: https://go-review.googlesource.com/10816
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
9 years agocmd/vet: skip another test on Android
Brad Fitzpatrick [Thu, 11 Jun 2015 15:22:56 +0000 (08:22 -0700)]
cmd/vet: skip another test on Android

Forgot this one in my previous commit.

Change-Id: Ief089e99bdad24b3bcfb075497dc259d06cc727c
Reviewed-on: https://go-review.googlesource.com/10913
Reviewed-by: David Crawshaw <crawshaw@golang.org>
9 years agocmd/go: reject relative paths that don't start with a dot (.)
Chris Broadfoot [Thu, 4 Jun 2015 23:16:14 +0000 (16:16 -0700)]
cmd/go: reject relative paths that don't start with a dot (.)

Change-Id: Idc4a7fdb561ba5b3b52094d895deaf3fcdf475bf
Reviewed-on: https://go-review.googlesource.com/10716
Reviewed-by: Andrew Gerrand <adg@golang.org>
9 years agocmd/go, cmd/vet: skip tests on Android
Brad Fitzpatrick [Thu, 11 Jun 2015 14:26:44 +0000 (07:26 -0700)]
cmd/go, cmd/vet: skip tests on Android

Might get the Android build passing, or at least going further.

Change-Id: I08f97156a687abe5a3d95203922f4ffd84fbb212
Reviewed-on: https://go-review.googlesource.com/10924
Reviewed-by: David Crawshaw <crawshaw@golang.org>
9 years agoall: fix misprints in comments
Ainar Garipov [Thu, 11 Jun 2015 13:49:38 +0000 (16:49 +0300)]
all: fix misprints in comments

These were found by grepping the comments from the go code and feeding
the output to aspell.

Change-Id: Id734d6c8d1938ec3c36bd94a4dbbad577e3ad395
Reviewed-on: https://go-review.googlesource.com/10941
Reviewed-by: Aamir Khan <syst3m.w0rm@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocmd/go: remove Stat workaround for Plan 9
David du Colombier [Thu, 11 Jun 2015 05:50:59 +0000 (07:50 +0200)]
cmd/go: remove Stat workaround for Plan 9

This issue was fixed in CL 10900.

Change-Id: I88f107cb73c8a515f39e02506ddd2ad1e286b1fb
Reviewed-on: https://go-review.googlesource.com/10940
Run-TryBot: David du Colombier <0intro@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agoos: fix error returned by dirstat on Plan 9
David du Colombier [Wed, 10 Jun 2015 20:32:14 +0000 (22:32 +0200)]
os: fix error returned by dirstat on Plan 9

When the Stat or Fstat system calls return -1,
dirstat incorrectly returns ErrShortStat.

However, the error returned by Stat or Fstat
could be different. For example, when the
file doesn't exist, they return "does not exist".

Dirstat should return the error returned by
the system call.

Fixes #10911.
Fixes #11132.

Change-Id: Icf242d203d256f12366b1e277f99b1458385104a
Reviewed-on: https://go-review.googlesource.com/10900
Run-TryBot: David du Colombier <0intro@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agoos: fix a race between Process.signal() and wait() on Windows
Patrick Mezard [Sun, 10 May 2015 13:35:52 +0000 (15:35 +0200)]
os: fix a race between Process.signal() and wait() on Windows

Process.handle was accessed without synchronization while wait() and
signal() could be called concurrently.

A first solution was to add a Mutex in Process but it was probably too
invasive given Process.handle is only used on Windows.

This version uses atomic operations to read the handle value. There is
still a race between isDone() and the value of the handle, but it only
leads to slightly incorrect error codes. The caller may get a:

  errors.New("os: process already finished")

instead of:

  syscall.EINVAL

which sounds harmless.

Fixes #9382

Change-Id: Iefcc687a1166d5961c8f27154647b9b15a0f748a
Reviewed-on: https://go-review.googlesource.com/9904
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agocmd/go: rewrite testsuite from bash to Go
Ian Lance Taylor [Tue, 9 Jun 2015 17:30:08 +0000 (10:30 -0700)]
cmd/go: rewrite testsuite from bash to Go

Change-Id: I8473e3f7653d5389d5fcd94862f0831049b8266e
Reviewed-on: https://go-review.googlesource.com/10809
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agoarchive/zip: clarify that CreateHeader takes ownership of FileHeader
Brad Fitzpatrick [Wed, 10 Jun 2015 18:19:14 +0000 (11:19 -0700)]
archive/zip: clarify that CreateHeader takes ownership of FileHeader

Fixes #11144

Change-Id: I1da0b72ef00a84c9b5751be0e72ad07d664bc98b
Reviewed-on: https://go-review.googlesource.com/10883
Reviewed-by: Andrew Gerrand <adg@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
9 years agoencoding/csv: fix comment in parseRecord
Ainar Garipov [Wed, 10 Jun 2015 13:28:51 +0000 (16:28 +0300)]
encoding/csv: fix comment in parseRecord

Change-Id: I82edd9364e1b4634006f5e043202a69f383dcdbe
Reviewed-on: https://go-review.googlesource.com/10826
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocmd/link: stop linker crashing with -s flag on windows
Alex Brainman [Tue, 9 Jun 2015 06:16:42 +0000 (16:16 +1000)]
cmd/link: stop linker crashing with -s flag on windows

Update #10254

Change-Id: I3ddd26607813ca629e3ab62abf87dc5ab453e36f
Reviewed-on: https://go-review.googlesource.com/10835
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agoruntime: correct a drifted comment in referencing m->locked.
Yongjian Xu [Wed, 10 Jun 2015 05:51:25 +0000 (22:51 -0700)]
runtime: correct a drifted comment in referencing m->locked.

Change-Id: Ida4b98aa63e57594fa6fa0b8178106bac9b3cd19
Reviewed-on: https://go-review.googlesource.com/10837
Reviewed-by: Minux Ma <minux@golang.org>
9 years ago.gitignore: ignore y.output
Josh Bleecher Snyder [Tue, 9 Jun 2015 21:15:41 +0000 (14:15 -0700)]
.gitignore: ignore y.output

Change-Id: I95b72b6be39fbb923b5f0743d17d7f8bd3ee3814
Reviewed-on: https://go-review.googlesource.com/10860
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agomisc/ios: document the external binary and the required env variables
Burcu Dogan [Mon, 4 May 2015 16:41:41 +0000 (12:41 -0400)]
misc/ios: document the external binary and the required env variables

Change-Id: I1ec2460758b19e5315be061033c1bb5ed9ead4a8
Reviewed-on: https://go-review.googlesource.com/9688
Reviewed-by: Minux Ma <minux@golang.org>
9 years agocmd/compile: fix builtin generation
Josh Bleecher Snyder [Tue, 9 Jun 2015 21:12:39 +0000 (14:12 -0700)]
cmd/compile: fix builtin generation

This was a refactoring bug during
'go tool compile', CL 10289.

Change-Id: Ibfd333be39ec72bba331fdf352df619cc21851a9
Reviewed-on: https://go-review.googlesource.com/10849
Reviewed-by: Minux Ma <minux@golang.org>
9 years agodoc/go1.5.txt: mention that 1.5 supports non-standard GCM lengths.
Adam Langley [Tue, 9 Jun 2015 18:47:45 +0000 (11:47 -0700)]
doc/go1.5.txt: mention that 1.5 supports non-standard GCM lengths.

Change-Id: I7cad3f7af2452e29b3dae3da87cbd24013f6dae6
Reviewed-on: https://go-review.googlesource.com/10850
Reviewed-by: Adam Langley <agl@golang.org>
9 years agocrypto/cipher: Support unusual GCM nonce lengths
Carl Jackson [Fri, 17 Apr 2015 07:52:40 +0000 (00:52 -0700)]
crypto/cipher: Support unusual GCM nonce lengths

GCM is traditionally used with a 96-bit nonce, but the standard allows
for nonces of any size. Non-standard nonce sizes are required in some
protocols, so add support for them in crypto/cipher's GCM
implementation.

Change-Id: I7feca7e903eeba557dcce370412b6ffabf1207ab
Reviewed-on: https://go-review.googlesource.com/8946
Reviewed-by: Adam Langley <agl@golang.org>
Run-TryBot: Adam Langley <agl@golang.org>

9 years agodoc: updated language about the AUTHORS/CONTRIBUTORS update
Dmitry Savintsev [Tue, 9 Jun 2015 10:01:38 +0000 (12:01 +0200)]
doc: updated language about the AUTHORS/CONTRIBUTORS update

Reflect the process changes where AUTHORS and CONTRIBUTORS
files are updated automatically based on commit logs
and Google committers no longer need to do it manually
on the first contributors.

The documentation update will help to avoid requests to be
added from new contributors.

Change-Id: I67daae5bd21246cf79fe3724838889b929bc5e66
Reviewed-on: https://go-review.googlesource.com/10824
Reviewed-by: Rob Pike <r@golang.org>
9 years agocmd/compile: use generated temps in bool codegen
Josh Bleecher Snyder [Mon, 8 Jun 2015 23:21:50 +0000 (16:21 -0700)]
cmd/compile: use generated temps in bool codegen

Bool codegen was generating a temp for function calls
and other complex expressions, but was not using it.

This was a refactoring bug introduced by CL 7853.
The cmp code used to do (in short):

l, r := &n1, &n2

It was changed to:

l, r := nl, nr

But the requisite assignments:

nl, nr = &n1, &n2

were only introduced on one of two code paths.

Fixes #10654.

Change-Id: Ie8de0b3a333842a048d4308e02911bb10c6915ce
Reviewed-on: https://go-review.googlesource.com/10844
Reviewed-by: Minux Ma <minux@golang.org>
Run-TryBot: Minux Ma <minux@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocrypto/tls: don't require an explicit client-auth EKU.
Adam Langley [Mon, 8 Jun 2015 21:24:18 +0000 (14:24 -0700)]
crypto/tls: don't require an explicit client-auth EKU.

Previously we enforced both that the extended key usages of a client
certificate chain allowed for client authentication, and that the
client-auth EKU was in the leaf certificate.

This change removes the latter requirement. It's still the case that the
chain must be compatible with the client-auth EKU (i.e. that a parent
certificate isn't limited to another usage, like S/MIME), but we'll now
accept a leaf certificate with no EKUs for client-auth.

While it would be nice if all client certificates were explicit in their
intended purpose, I no longer feel that this battle is worthwhile.

Fixes #11087.

Change-Id: I777e695101cbeba069b730163533e2977f4dc1fc
Reviewed-on: https://go-review.googlesource.com/10806
Reviewed-by: Andrew Gerrand <adg@golang.org>
Run-TryBot: Adam Langley <agl@golang.org>

9 years agogo/build: add big endian variant of arm and arm64 to goarch list
Shenghou Ma [Fri, 5 Jun 2015 19:13:57 +0000 (15:13 -0400)]
go/build: add big endian variant of arm and arm64 to goarch list

Change-Id: Icda8475a7879d49e3b8b873303eb0bed5dd5a238
Reviewed-on: https://go-review.googlesource.com/10792
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agonet: disable dualstack listener tests on dragonfly
Mikio Hara [Tue, 9 Jun 2015 03:10:10 +0000 (12:10 +0900)]
net: disable dualstack listener tests on dragonfly

Change-Id: Ia7914156e4369113dea7c17b3aa51096e25f1901
Reviewed-on: https://go-review.googlesource.com/10834
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agocmd/dist: move guts of race.bash into dist
Brad Fitzpatrick [Tue, 9 Jun 2015 00:56:27 +0000 (17:56 -0700)]
cmd/dist: move guts of race.bash into dist

After a little build coordinator change, this will get us sharding of
the race builder.

Update #11074

Change-Id: I4c55267563b6f5e213def7dd6707c837ae2106bf
Reviewed-on: https://go-review.googlesource.com/10845
Reviewed-by: Andrew Gerrand <adg@golang.org>
9 years agocmd/link/internal/ld: include table of contents of c-archive output.
Hyang-Ah (Hana) Kim [Mon, 8 Jun 2015 21:22:17 +0000 (14:22 -0700)]
cmd/link/internal/ld: include table of contents of c-archive output.

Change-Id: If11621985c0a5a1f2133cdc974f37fd944b93e5e
Reviewed-on: https://go-review.googlesource.com/10808
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agocmd/compile: early typecheck top level OAS2 nodes
Josh Bleecher Snyder [Fri, 5 Jun 2015 17:39:23 +0000 (10:39 -0700)]
cmd/compile: early typecheck top level OAS2 nodes

Fixes #10977.

Change-Id: I706c953c16daad48595c7fae2d82124614dfc3ad
Reviewed-on: https://go-review.googlesource.com/10780
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>

9 years agodoc/go1.5.txt: mention that testing/quick now generates nil pointers.
Adam Langley [Mon, 8 Jun 2015 21:21:27 +0000 (14:21 -0700)]
doc/go1.5.txt: mention that testing/quick now generates nil pointers.

Change-Id: I358b17304f95fdd8e6c0a64fa29f185c701fe338
Reviewed-on: https://go-review.googlesource.com/10805
Reviewed-by: Andrew Gerrand <adg@golang.org>
9 years agotesting/quick: probabilistically generate nil pointers
Håvard Haugen [Sun, 7 Jun 2015 19:28:58 +0000 (21:28 +0200)]
testing/quick: probabilistically generate nil pointers

The documentation for quick.Value says that it "returns an arbitrary
value of the given type." In spite of this, nil values for pointers were
never generated, which seems more like an oversight than an intentional
choice.

The lack of nil values meant that testing recursive type like

  type Node struct {
   Next *Node
  }

with testing/quick would lead to a stack overflow since the data
structure would never terminate.

This change may break tests that don't check for nil with pointers
returned from quick.Value. Two such instances were found in the standard
library, one of which was in the testing/quick package itself.

Fixes #8818.

Change-Id: Id390dcce649d12fbbaa801ce6f58f5defed77e60
Reviewed-on: https://go-review.googlesource.com/10821
Reviewed-by: Adam Langley <agl@golang.org>
Run-TryBot: Adam Langley <agl@golang.org>

9 years agocmd/vet: remove dependency on types.New
Robert Griesemer [Fri, 5 Jun 2015 20:20:03 +0000 (13:20 -0700)]
cmd/vet: remove dependency on types.New

- remove TODO on non-existing fmt.Formatter type
  (type exists now)
- guard uses of imported types against nil

Change-Id: I9ae8e5a448e73c84dec1606ea9d9ed5ddeee8dc6
Reviewed-on: https://go-review.googlesource.com/10777
Reviewed-by: Alan Donovan <adonovan@google.com>
9 years agoruntime: avoid fault in heapBitsBulkBarrier
Russ Cox [Mon, 8 Jun 2015 20:22:01 +0000 (13:22 -0700)]
runtime: avoid fault in heapBitsBulkBarrier

Change-Id: I0512e461de1f25cb2a1cb7f23e7a77d00700667c
Reviewed-on: https://go-review.googlesource.com/10803
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agocmd/vet: fix tests on windows
Alex Brainman [Fri, 5 Jun 2015 01:37:00 +0000 (11:37 +1000)]
cmd/vet: fix tests on windows

Add .exe to exectable name, so it can be executed on windows.
Use proper windows paths when searching vet output.
Replace Skip with Skipf.

Fixes build

Change-Id: Ife40d8f5ab9d7093ca61c50683a358d4d6a3ba34
Reviewed-on: https://go-review.googlesource.com/10742
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
Reviewed-by: Patrick Mézard <patrick@mezard.eu>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agoruntime: fix write-barrier-enabled phase list in gcmarkwb_m
Austin Clements [Mon, 8 Jun 2015 00:13:21 +0000 (20:13 -0400)]
runtime: fix write-barrier-enabled phase list in gcmarkwb_m

Commit 1303957 was supposed to enable write barriers during the
concurrent scan phase, but it only enabled *calls* to the write
barrier during this phase. It failed to update the redundant list of
write-barrier-enabled phases in gcmarkwb_m, so it still wasn't greying
objects during the scan phase.

This commit fixes this by replacing the redundant list of phases in
gcmarkwb_m with simply checking writeBarrierEnabled. This is almost
certainly redundant with checks already done in callers, but the last
time we tried to remove these redundant checks everything got much
slower, so I'm leaving it alone for now.

Fixes #11105.

Change-Id: I00230a3cb80a008e749553a8ae901b409097e4be
Reviewed-on: https://go-review.googlesource.com/10801
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: Minux Ma <minux@golang.org>
9 years agoruntime: unwind stack barriers when writing above the current frame
Austin Clements [Fri, 5 Jun 2015 18:49:27 +0000 (14:49 -0400)]
runtime: unwind stack barriers when writing above the current frame

Stack barriers assume that writes through pointers to frames above the
current frame will get write barriers, and hence these frames do not
need to be re-scanned to pick up these changes. For normal writes,
this is true. However, there are places in the runtime that use
typedmemmove to potentially write through pointers to higher frames
(such as mapassign1). Currently, typedmemmove does not execute write
barriers if the destination is on the stack. If there's a stack
barrier between the current frame and the frame being modified with
typedmemmove, and the stack barrier is not otherwise hit, it's
possible that the garbage collector will never see the updated pointer
and incorrectly reclaim the object.

Fix this by making heapBitsBulkBarrier (which lies behind typedmemmove
and its variants) detect when the destination is in the stack and
unwind stack barriers up to the point, forcing mark termination to
later rescan the effected frame and collect these pointers.

Fixes #11084. Might be related to #10240, #10541, #10941, #11023,
 #11027 and possibly others.

Change-Id: I323d6cd0f1d29fa01f8fc946f4b90e04ef210efd
Reviewed-on: https://go-review.googlesource.com/10791
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agoruntime: enable write barriers during concurrent scan
Austin Clements [Fri, 5 Jun 2015 21:18:15 +0000 (17:18 -0400)]
runtime: enable write barriers during concurrent scan

Currently, write barriers are only enabled after completion of the
concurrent scan phase, as we enter the concurrent mark phase. However,
stack barriers are installed during the scan phase and assume that
write barriers will track changes to frames above the stack
barriers. Since write barriers aren't enabled until after stack
barriers are installed, we may miss modifications to the stack that
happen after installing the stack barriers and before enabling write
barriers.

Fix this by enabling write barriers during the scan phase.

This commit intentionally makes the minimal change to do this (there's
only one line of code change; the rest are comment changes). At the
very least, we should consider eliminating the ragged barrier that's
intended to synchronize the enabling of write barriers, but now just
wastes time. I've included a large comment about extensions and
alternative designs.

Change-Id: Ib20fede794e4fcb91ddf36f99bd97344d7f96421
Reviewed-on: https://go-review.googlesource.com/10795
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agoruntime: fix checkmarks to rescan stacks
Austin Clements [Fri, 5 Jun 2015 21:36:00 +0000 (17:36 -0400)]
runtime: fix checkmarks to rescan stacks

Currently checkmarks mode fails to rescan stacks because it sees the
leftover state bits indicating that the stacks haven't changed since
the last scan. As a result, it won't detect lost marks caused by
failing to scan stacks correctly during regular garbage collection.

Fix this by marking all stacks dirty before performing the checkmark
phase.

Change-Id: I1f06882bb8b20257120a4b8e7f95bb3ffc263895
Reviewed-on: https://go-review.googlesource.com/10794
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agodoc/go1.5.txt: correct CL for LookupEnv addition
Dominik Honnef [Sun, 7 Jun 2015 02:33:44 +0000 (04:33 +0200)]
doc/go1.5.txt: correct CL for LookupEnv addition

Change-Id: Ib43b21daef5d8291e03c0f0fbf56999e37e21e21
Reviewed-on: https://go-review.googlesource.com/10820
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agotest: fix build on GOARCH=ppc64/ppc64le
Shenghou Ma [Sat, 6 Jun 2015 19:24:18 +0000 (15:24 -0400)]
test: fix build on GOARCH=ppc64/ppc64le

Change-Id: Ibf2879c0034250c5699e21ecea0eb76340597a2a
Reviewed-on: https://go-review.googlesource.com/10810
Reviewed-by: Austin Clements <austin@google.com>
9 years agodatabase/sql: refer correct issue in TestErrBadConnReconnect comment
Alex Brainman [Fri, 5 Jun 2015 07:02:09 +0000 (17:02 +1000)]
database/sql: refer correct issue in TestErrBadConnReconnect comment

Change-Id: I283ab238b60d3a47e86296e1fbfc73ba121bef19
Reviewed-on: https://go-review.googlesource.com/10745
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocmd/asm: drop legacy RETURN mnemonic on ppc64
Austin Clements [Wed, 3 Jun 2015 19:13:10 +0000 (15:13 -0400)]
cmd/asm: drop legacy RETURN mnemonic on ppc64

Change-Id: I999b57ef5535c18e02cc27c9bc9f896d73126b50
Reviewed-on: https://go-review.googlesource.com/10674
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Minux Ma <minux@golang.org>
9 years agocmd/compile: use obj.ARET instead of ppc64.ARETURN
Austin Clements [Wed, 3 Jun 2015 19:10:53 +0000 (15:10 -0400)]
cmd/compile: use obj.ARET instead of ppc64.ARETURN

obj.ARET is the portable return mnemonic. ppc64.ARETURN is a legacy
alias.

This was done with
    sed -i s/ppc64\.ARETURN/obj.ARET/ cmd/compile/**/*.go
    sed -i s/ARETURN/obj.ARET/ cmd/internal/obj/ppc64/obj9.go

Change-Id: I4d8e83ff411cee764774a40ef4c7c34dcbca4e43
Reviewed-on: https://go-review.googlesource.com/10673
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Minux Ma <minux@golang.org>
9 years agoall: use RET instead of RETURN on ppc64
Austin Clements [Wed, 3 Jun 2015 18:59:27 +0000 (14:59 -0400)]
all: use RET instead of RETURN on ppc64

All of the architectures except ppc64 have only "RET" for the return
mnemonic. ppc64 used to have only "RETURN", but commit cf06ea6
introduced RET as a synonym for RETURN to make ppc64 consistent with
the other architectures. However, that commit was never followed up to
make the code itself consistent by eliminating uses of RETURN.

This commit replaces all uses of RETURN in the ppc64 assembly with
RET.

This was done with
    sed -i 's/\<RETURN\>/RET/' **/*_ppc64x.s
plus one manual change to syscall/asm.s.

Change-Id: I3f6c8d2be157df8841d48de988ee43f3e3087995
Reviewed-on: https://go-review.googlesource.com/10672
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Minux Ma <minux@golang.org>
9 years agocmd/go: update documentation: use 'go doc' rather than 'godoc'
Robert Griesemer [Fri, 5 Jun 2015 20:14:06 +0000 (13:14 -0700)]
cmd/go: update documentation: use 'go doc' rather than 'godoc'

Change-Id: I318c1ef75b18d4687f13499ac225dde2d053505e
Reviewed-on: https://go-review.googlesource.com/10776
Reviewed-by: Rob Pike <r@golang.org>
9 years agocmd/go: use new vet location
Robert Griesemer [Thu, 4 Jun 2015 23:09:15 +0000 (16:09 -0700)]
cmd/go: use new vet location

Change-Id: I7d96ebcca5954152edb821bb41b6047a1c622949
Reviewed-on: https://go-review.googlesource.com/10731
Reviewed-by: Andrew Gerrand <adg@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
9 years agogo/types: remove unused return value
Robert Griesemer [Fri, 5 Jun 2015 18:44:31 +0000 (11:44 -0700)]
go/types: remove unused return value

Port of https://go-review.googlesource.com/10773 from x/tools.

Change-Id: I6aba6a63a5448b8fcbcc7f072c627c27965dbe20
Reviewed-on: https://go-review.googlesource.com/10774
Reviewed-by: Alan Donovan <adonovan@google.com>
9 years agoruntime: add blank assignment to defeat "declared but not used" error from go/types
Alan Donovan [Fri, 5 Jun 2015 17:27:49 +0000 (13:27 -0400)]
runtime: add blank assignment to defeat "declared but not used" error from go/types

gc should ideally consider this an error too; see golang/go#8560.

Change-Id: Ieee71c4ecaff493d7f83e15ba8c8a04ee90a4cf1
Reviewed-on: https://go-review.googlesource.com/10757
Reviewed-by: Robert Griesemer <gri@golang.org>
9 years agogo/types: remove MethodSetCache - not needed
Robert Griesemer [Fri, 5 Jun 2015 17:35:29 +0000 (10:35 -0700)]
go/types: remove MethodSetCache - not needed

In x/tools, MethodSetCache was moved from x/tools/go/types to
x/tools/go/types/typeutil. Mirror that change.

Change-Id: Ib838a9518371473c83fa4abc2778d42f33947c98
Reviewed-on: https://go-review.googlesource.com/10771
Reviewed-by: Alan Donovan <adonovan@google.com>
9 years agoruntime: use correct SP when installing stack barriers
Austin Clements [Fri, 5 Jun 2015 15:07:21 +0000 (11:07 -0400)]
runtime: use correct SP when installing stack barriers

Currently the stack barriers are installed at the next frame boundary
after gp.sched.sp + 1024*2^n for n=0,1,2,... However, when a G is in a
system call, we set gp.sched.sp to 0, which causes stack barriers to
be installed at *every* frame. This easily overflows the slice we've
reserved for storing the stack barrier information, and causes a
"slice bounds out of range" panic in gcInstallStackBarrier.

Fix this by using gp.syscallsp instead of gp.sched.sp if it's
non-zero. This is the same logic that gentraceback uses to determine
the current SP.

Fixes #11049.

Change-Id: Ie40eeee5bec59b7c1aa715a7c17aa63b1f1cf4e8
Reviewed-on: https://go-review.googlesource.com/10755
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agocmd/dist: add more logging details when go list std cmd fails
Brad Fitzpatrick [Fri, 5 Jun 2015 15:11:34 +0000 (08:11 -0700)]
cmd/dist: add more logging details when go list std cmd fails

Change-Id: I12e6990b46ea9c733a5718dc5ca67f1fcd2dec66
Reviewed-on: https://go-review.googlesource.com/10754
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agocmd/vet: skip exec tests on systems that can't exec
Russ Cox [Fri, 5 Jun 2015 14:34:17 +0000 (10:34 -0400)]
cmd/vet: skip exec tests on systems that can't exec

Change-Id: I09257b8f5482cba10b5f4d3813c778d6e9e74d40
Reviewed-on: https://go-review.googlesource.com/10752
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agodebug/gosym: avoid calling the shell in test
Alexis Imperial-Legrand [Tue, 2 Jun 2015 15:27:43 +0000 (17:27 +0200)]
debug/gosym: avoid calling the shell in test

Change-Id: I95bf62c0f2d77dd67515921e6aefa511cce8d95d
Reviewed-on: https://go-review.googlesource.com/10633
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agocmd/go: fix detection of ELF binaries
Russ Cox [Fri, 5 Jun 2015 13:58:47 +0000 (09:58 -0400)]
cmd/go: fix detection of ELF binaries

Change-Id: I0e6f1a39b3d6b15d05891c8b25ab6644356bde5f
Reviewed-on: https://go-review.googlesource.com/10751
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agoflag: Describe the ErrorHandling enum values.
Aaron Jacobs [Fri, 5 Jun 2015 00:12:34 +0000 (10:12 +1000)]
flag: Describe the ErrorHandling enum values.

ContinueOnError is particularly confusing, because it causes
FlagSet.Parse to return as soon as it sees an error. I gather that the
intent is "continue the program" rather than "continue parsing",
compared to exiting or panicking.

Change-Id: I27370ce1f321ea4debcee5b03faff3532495c71a
Reviewed-on: https://go-review.googlesource.com/10740
Reviewed-by: Rob Pike <r@golang.org>
9 years agocmd/go: add -tags option to go vet
Rob Pike [Thu, 4 Jun 2015 21:28:14 +0000 (14:28 -0700)]
cmd/go: add -tags option to go vet

Actually add all build flags, so we also get things like -race.

Fixes #10228.

Change-Id: I5f77dda9d1ee3208e1833702f12f68c2731c4b22
Reviewed-on: https://go-review.googlesource.com/10697
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agodoc/go1.5.txt: mention go test -count
Russ Cox [Fri, 5 Jun 2015 05:31:52 +0000 (01:31 -0400)]
doc/go1.5.txt: mention go test -count

Change-Id: I1d7b728bd161da7bd6dd460862d8be072921e8b9
Reviewed-on: https://go-review.googlesource.com/10763
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agocmd/compile: document Node fields used by each Op
Russ Cox [Thu, 4 Jun 2015 03:57:59 +0000 (23:57 -0400)]
cmd/compile: document Node fields used by each Op

Change-Id: If969d7a06c83447ee38da30f1477a6cf4bfa1a03
Reviewed-on: https://go-review.googlesource.com/10691
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocmd/link: delete dead flags
Russ Cox [Thu, 21 May 2015 18:42:14 +0000 (14:42 -0400)]
cmd/link: delete dead flags

Also fix the interaction between -buildmode and -shared.
It's okay for -shared to change the default build mode,
but it's not okay for it to silently override an explicit -buildmode=exe.

Change-Id: Id40f93d140cddf75b19e262b3ba4856ee09a07ba
Reviewed-on: https://go-review.googlesource.com/10315
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
9 years agocmd/link: deprecate -X name value in favor of -X name=value
Russ Cox [Thu, 21 May 2015 18:35:02 +0000 (14:35 -0400)]
cmd/link: deprecate -X name value in favor of -X name=value

People invoking the linker directly already have to change their scripts
to use the new "go tool link", so this is a good time to make the -X flag
behave like all other Go flags and take just a single argument.

The old syntax will continue to be accepted (it is rewritten into the new
syntax before flag parsing). Maybe some day we will be able to retire it.

Even if we never retire the old syntax, having the new syntax at least
makes the rewriting much less of a kludge.

Change-Id: I91e8df94f4c22b2186e81d7f1016b8767d777eac
Reviewed-on: https://go-review.googlesource.com/10310
Reviewed-by: Rob Pike <r@golang.org>
9 years agocmd/compile, cmd/link: add docs
Russ Cox [Thu, 21 May 2015 18:11:33 +0000 (14:11 -0400)]
cmd/compile, cmd/link: add docs

These are the Go 1.4 docs but refreshed for Go 1.5.
The most sigificant change is that all references to the Plan 9 toolchain are gone.
The tools no longer bear any meaningful resemblance.

Change-Id: I44f5cadb832a982323d7fee0b77673e55d761b35
Reviewed-on: https://go-review.googlesource.com/10298
Reviewed-by: Rob Pike <r@golang.org>
9 years agodoc/go1.5.txt: GOMAXPROCS change
Russ Cox [Fri, 5 Jun 2015 04:37:29 +0000 (00:37 -0400)]
doc/go1.5.txt: GOMAXPROCS change

Change-Id: I5c991cad38c9e2c839314a56d3415a2aa09c1561
Reviewed-on: https://go-review.googlesource.com/10762
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agoruntime: default GOMAXPROCS to NumCPU(), not 1
Russ Cox [Thu, 28 May 2015 16:35:35 +0000 (12:35 -0400)]
runtime: default GOMAXPROCS to NumCPU(), not 1

See golang.org/s/go15gomaxprocs for details.

Change-Id: I8de5df34fa01d31d78f0194ec78a2474c281243c
Reviewed-on: https://go-review.googlesource.com/10668
Reviewed-by: Rob Pike <r@golang.org>
9 years agocmd/pprof: use copy of svgpan library instead of link to remote site
Russ Cox [Mon, 27 Apr 2015 18:40:34 +0000 (14:40 -0400)]
cmd/pprof: use copy of svgpan library instead of link to remote site

Fixes #10375.

Change-Id: I78dc3e12035d130c405bdb284b0cceea19f084f6
Reviewed-on: https://go-review.googlesource.com/10690
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agotesting: add -test.count flag to run tests and benchmarks multiple times
Russ Cox [Thu, 4 Jun 2015 02:21:07 +0000 (22:21 -0400)]
testing: add -test.count flag to run tests and benchmarks multiple times

The flag is available from the go test command as -count:

% go test -run XXX -bench . -count 3
PASS
BenchmarkSprintfEmpty       30000000         54.0 ns/op
BenchmarkSprintfEmpty       30000000         51.9 ns/op
BenchmarkSprintfEmpty       30000000         53.8 ns/op
BenchmarkSprintfString      10000000        238 ns/op
BenchmarkSprintfString      10000000        239 ns/op
BenchmarkSprintfString      10000000        234 ns/op
BenchmarkSprintfInt         10000000        232 ns/op
BenchmarkSprintfInt         10000000        226 ns/op
BenchmarkSprintfInt         10000000        225 ns/op
...

If -cpu is set, each test is run n times for each cpu value.

Original by r (CL 10663).

Change-Id: If3dfbdf21698952daac9249b5dbca66f5301e91b
Reviewed-on: https://go-review.googlesource.com/10669
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
9 years agocmd/go: read new non-ELF build ID in binaries
Russ Cox [Thu, 4 Jun 2015 19:20:41 +0000 (15:20 -0400)]
cmd/go: read new non-ELF build ID in binaries

Fixes #11048.
Fixes #11075.

Change-Id: I81f5ef1e1944056ce5494c91aa4a4a63c758f566
Reviewed-on: https://go-review.googlesource.com/10709
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agocmd/link: implement -buildid for non-ELF binaries
Russ Cox [Thu, 4 Jun 2015 19:15:48 +0000 (15:15 -0400)]
cmd/link: implement -buildid for non-ELF binaries

Non-ELF binary formats are much less flexible and typically do not
have a good place to store the build ID.

We store it as raw bytes at the beginning of the text segment.

The only system I know of that will be upset about this is NaCl,
and NaCl is an ELF system and does not use this.

For #11048.

Change-Id: Iaa7ace703c4cf36392e752eea9b55e2ce49e9826
Reviewed-on: https://go-review.googlesource.com/10708
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agocmd/go: use ELF note instead of binary stamp on ELF systems
Russ Cox [Thu, 4 Jun 2015 18:41:02 +0000 (14:41 -0400)]
cmd/go: use ELF note instead of binary stamp on ELF systems

Other binary formats to follow.

For #11048.

Change-Id: Ia2d8b47c99c99d171c014b7cfd23c1c7ada5231c
Reviewed-on: https://go-review.googlesource.com/10707
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agocmd/link: add -buildid flag to write Go build ID to ELF output, same as cmd/compile
Russ Cox [Thu, 4 Jun 2015 18:31:05 +0000 (14:31 -0400)]
cmd/link: add -buildid flag to write Go build ID to ELF output, same as cmd/compile

Other binary formats to follow.

Using our own note instead of the GNU build ID note because
we are not the GNU project, and I can't guarantee that the semantics
of our note and the semantics of the GNU note will match forever.
(Also they don't match today.)

For #11048.

Change-Id: Iec7e5a2e49d52b6d3a51b0aface2de7c77a45491
Reviewed-on: https://go-review.googlesource.com/10706
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agocmd/link: add -h flag, for debugging, same as cmd/compile
Russ Cox [Thu, 4 Jun 2015 18:30:30 +0000 (14:30 -0400)]
cmd/link: add -h flag, for debugging, same as cmd/compile

Change-Id: I3c9b05879fe0b6e94b63e9b65e4411ba2a917134
Reviewed-on: https://go-review.googlesource.com/10705
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agocmd/go, cmd/link: use "Go" not "GO" as ELF note identifier
Russ Cox [Thu, 4 Jun 2015 18:27:39 +0000 (14:27 -0400)]
cmd/go, cmd/link: use "Go" not "GO" as ELF note identifier

Change-Id: I038e892725836ab7718f7638e8ad5712953f2cb5
Reviewed-on: https://go-review.googlesource.com/10704
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agocmd/go: simplify ELF note reading and enable during bootstrap
Russ Cox [Thu, 4 Jun 2015 18:17:51 +0000 (14:17 -0400)]
cmd/go: simplify ELF note reading and enable during bootstrap

The bootstrap restriction is to avoid needing cgo for package net.
There's no problem with building debug/elf and debug/dwarf,
so do that.

An upcoming CL is going to add more note processing code,
and it simplifies things not to have to think about the code being
missing half the time.

Change-Id: I0e2f120ac23f14db6ecfcec7bfe254a69abcf7b6
Reviewed-on: https://go-review.googlesource.com/10703
Reviewed-by: Ian Lance Taylor <iant@golang.org>
9 years agocmd/go: fix fmt.Errorf call sites (latent bug)
Robert Griesemer [Thu, 4 Jun 2015 22:49:43 +0000 (15:49 -0700)]
cmd/go: fix fmt.Errorf call sites (latent bug)

Change-Id: I4ff42113c5dda553d6f3d58f0e4836dce7c84710
Reviewed-on: https://go-review.googlesource.com/10730
Reviewed-by: Rob Pike <r@golang.org>
9 years agocmd/doc: do not show unexported constants
Rob Pike [Tue, 2 Jun 2015 21:43:38 +0000 (14:43 -0700)]
cmd/doc: do not show unexported constants

The go/doc package doesn't remove unexported entries from const
and var blocks, so we must trim them ourselves.

Fixes #11008

Change-Id: Ibd60d87e09333964e2588340a2ca2b8804bbaa28
Reviewed-on: https://go-review.googlesource.com/10643
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agocmd/vet: adjust vet to use go/types and friends from std repo
Robert Griesemer [Thu, 4 Jun 2015 20:07:22 +0000 (13:07 -0700)]
cmd/vet: adjust vet to use go/types and friends from std repo

- s|"golang.org/x/tools/go/exact"|"go/constant"|
- s|"golang.org/x/tools/go/types"|"go/types"|
- removed import of gcimporter
- import "go/importer" instead
- trivial adjustments to make use of go/importer
- adjusted import paths for whitelist.go

Change-Id: I43488ff44c329cd869c92dcc31193fb31bebfd29
Reviewed-on: https://go-review.googlesource.com/10695
Reviewed-by: Rob Pike <r@golang.org>
9 years agocmd/vet: move cmd/vet into std repo
Robert Griesemer [Thu, 4 Jun 2015 19:54:58 +0000 (12:54 -0700)]
cmd/vet: move cmd/vet into std repo

cp -r x/tools/cmd/vet cmd/vet without any changes.
The next change will adjust the source to use std
repo go/types and friends.

This may (temporarily) break the build; the next
commit (immediately following) will fix it. We do
it in two commits so that we can see the manual
changes.

Change-Id: Ic45dab7066f13923e21f8c61200c8c3fd447b171
Reviewed-on: https://go-review.googlesource.com/10694
Reviewed-by: Rob Pike <r@golang.org>
9 years agocmd/dist: use -tags=lldb for iOS tests
David Crawshaw [Thu, 4 Jun 2015 19:03:38 +0000 (15:03 -0400)]
cmd/dist: use -tags=lldb for iOS tests

As of golang.org/cl/9154, running go test will override a previous
go install -a -tags=lldb std with the tag-less version of stdlib. So
we pass -tags=lldb into the relevant go test commands.

Change-Id: I1c718289d7212373a9383eff53a643f06598f5ed
Reviewed-on: https://go-review.googlesource.com/10701
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>

9 years agonet/http: the Set-Cookie Expiration time zone should be GMT, not UTC
Brad Fitzpatrick [Thu, 4 Jun 2015 19:57:53 +0000 (12:57 -0700)]
net/http: the Set-Cookie Expiration time zone should be GMT, not UTC

Per RFC 6265.

Change-Id: I2b6b145f5d057f96509332509d722602ed9e2bbd
Reviewed-on: https://go-review.googlesource.com/10711
Reviewed-by: Brett Slatkin <bslatkin@google.com>
Reviewed-by: Andrew Gerrand <adg@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>

9 years agotest: make test/run.go support sharding
Brad Fitzpatrick [Thu, 4 Jun 2015 06:21:30 +0000 (23:21 -0700)]
test: make test/run.go support sharding

Also modifies 'dist test' to use that sharding, and removes some old
temporary stuff from dist test which are no longer required.

'dist test' now also supports running a list of tests given in
arguments, mutually exclusive with the existing -run=REGEXP flag. The
hacky fast paths for avoiding the 1 second "go list" latency are now
removed and only apply to the case where partial tests are run via
args, instead of regex.  The build coordinator will use both styles
for awhile. (the statically-sharded ARM builders on scaleway will
continue to use regexps, but the dynamically-shared builders on GCE
will use the list of tests)

Updates #10029

Change-Id: I557800a54dfa6f3b5100ef4c26fe397ba5189813
Reviewed-on: https://go-review.googlesource.com/10688
Reviewed-by: Andrew Gerrand <adg@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

9 years agocmd/internal/obj/arm64: make function prologue more predictable
Josh Bleecher Snyder [Fri, 29 May 2015 01:17:58 +0000 (18:17 -0700)]
cmd/internal/obj/arm64: make function prologue more predictable

Static branch prediction guesses that forward branches aren't taken.
Since stacks are rarely grown, make the forward branch mean grow.

While we're here, remove the debug-only instruction
saving the frame size in the temp register.

Sample disassembly for

func f() {
_ = [128]byte{}
}

Before:

0x4008248         ldr        x1, [x28, #0x10]
0x400824c         sub        x2, sp, #0x90
0x4008250         cmp        x2, x1
0x4008254         b.hi       0x4008268
0x4008258         mov        x3, x30
0x400825c         movz       x27, #0x90
0x4008260         bl         runtime.morestack_noctxt
0x4008264         b          main.f
0x4008268         sub        sp, sp, #0x90
0x400826c         add        x16, sp, #0x10
0x4008270         str        xzr, [x16]
0x4008274         str        xzr, [x16, #0x8]
0x4008278         str        xzr, [x16, #0x10]
0x400827c         str        xzr, [x16, #0x18]
0x4008280         str        xzr, [x16, #0x20]
0x4008284         str        xzr, [x16, #0x28]
0x4008288         str        xzr, [x16, #0x30]
0x400828c         str        xzr, [x16, #0x38]
0x4008290         str        xzr, [x16, #0x40]
0x4008294         str        xzr, [x16, #0x48]
0x4008298         str        xzr, [x16, #0x50]
0x400829c         str        xzr, [x16, #0x58]
0x40082a0         str        xzr, [x16, #0x60]
0x40082a4         str        xzr, [x16, #0x68]
0x40082a8         str        xzr, [x16, #0x70]
0x40082ac         str        xzr, [x16, #0x78]
0x40082b0         add        sp, sp, #0x90
0x40082b4         ret

After:

0x4004bc8         ldr        x1, [x28, #0x10]
0x4004bcc         sub        x2, sp, #0x90
0x4004bd0         cmp        x2, x1
0x4004bd4         b.ls       0x4004c28
0x4004bd8         sub        sp, sp, #0x90
0x4004bdc         add        x16, sp, #0x10
0x4004be0         str        xzr, [x16]
0x4004be4         str        xzr, [x16, #0x8]
0x4004be8         str        xzr, [x16, #0x10]
0x4004bec         str        xzr, [x16, #0x18]
0x4004bf0         str        xzr, [x16, #0x20]
0x4004bf4         str        xzr, [x16, #0x28]
0x4004bf8         str        xzr, [x16, #0x30]
0x4004bfc         str        xzr, [x16, #0x38]
0x4004c00         str        xzr, [x16, #0x40]
0x4004c04         str        xzr, [x16, #0x48]
0x4004c08         str        xzr, [x16, #0x50]
0x4004c0c         str        xzr, [x16, #0x58]
0x4004c10         str        xzr, [x16, #0x60]
0x4004c14         str        xzr, [x16, #0x68]
0x4004c18         str        xzr, [x16, #0x70]
0x4004c1c         str        xzr, [x16, #0x78]
0x4004c20         add        sp, sp, #0x90
0x4004c24         ret
0x4004c28         mov        x3, x30
0x4004c2c         bl         runtime.morestack_noctxt
0x4004c30         b          main.f

Updates #10587.

Package sort benchmarks using an iPhone 6:

name            old time/op  new time/op  delta
SearchWrappers   355ns ± 1%   328ns ± 1%  -7.57%  (p=0.000 n=25+19)
SortString1K     580µs ± 1%   577µs ± 1%  -0.48%  (p=0.000 n=25+25)
StableString1K  1.04ms ± 0%  1.04ms ± 0%    ~     (p=0.851 n=24+25)
SortInt1K        251µs ± 1%   247µs ± 1%  -1.52%  (p=0.000 n=23+25)
StableInt1K      267µs ± 2%   261µs ± 2%  -2.02%  (p=0.000 n=25+25)
SortInt64K      23.8ms ± 1%  23.6ms ± 0%  -0.97%  (p=0.000 n=25+23)
StableInt64K    22.8ms ± 0%  22.4ms ± 1%  -1.76%  (p=0.000 n=24+25)
Sort1e2          123µs ± 1%   124µs ± 1%    ~     (p=0.256 n=23+23)
Stable1e2        248µs ± 1%   247µs ± 1%  -0.69%  (p=0.000 n=23+25)
Sort1e4         24.3ms ± 2%  24.6ms ± 5%  +1.36%  (p=0.017 n=22+25)
Stable1e4       77.2ms ± 6%  76.2ms ± 5%  -1.36%  (p=0.020 n=25+25)
Sort1e6          3.95s ± 8%   3.95s ± 8%    ~     (p=0.863 n=25+25)
Stable1e6        15.7s ± 1%   15.5s ± 1%  -1.11%  (p=0.000 n=22+23)

Change-Id: I377b3817af2ed27ddeecf24edef97fad91fc1afc
Reviewed-on: https://go-review.googlesource.com/10500
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Dave Cheney <dave@cheney.net>
9 years agoruntime, cmd/internal/obj/arm: improve arm function prologue
Josh Bleecher Snyder [Thu, 28 May 2015 22:18:35 +0000 (15:18 -0700)]
runtime, cmd/internal/obj/arm: improve arm function prologue

When stack growth is not needed, as it usually is not,
execute only a single conditional branch
rather than three conditional instructions.
This adds 4 bytes to every function,
but might speed up execution in the common case.

Sample disassembly for

func f() {
_ = [128]byte{}
}

Before:

TEXT main.f(SB) x.go
x.go:3 0x2000 e59a1008 MOVW 0x8(R10), R1
x.go:3 0x2004 e59fb028 MOVW 0x28(R15), R11
x.go:3 0x2008 e08d200b ADD R11, R13, R2
x.go:3 0x200c e1520001 CMP R1, R2
x.go:3 0x2010 91a0300e MOVW.LS R14, R3
x.go:3 0x2014 9b0118a9 BL.LS runtime.morestack_noctxt(SB)
x.go:3 0x2018 9afffff8 B.LS main.f(SB)
x.go:3 0x201c e52de084 MOVW.W R14, -0x84(R13)
x.go:4 0x2020 e28d1004 ADD $4, R13, R1
x.go:4 0x2024 e3a00000 MOVW $0, R0
x.go:4 0x2028 eb012255 BL 0x4a984
x.go:5 0x202c e49df084 RET #132
x.go:5 0x2030 eafffffe B 0x2030
x.go:5 0x2034 ffffff7c ?

After:

TEXT main.f(SB) x.go
x.go:3 0x2000 e59a1008 MOVW 0x8(R10), R1
x.go:3 0x2004 e59fb02c MOVW 0x2c(R15), R11
x.go:3 0x2008 e08d200b ADD R11, R13, R2
x.go:3 0x200c e1520001 CMP R1, R2
x.go:3 0x2010 9a000004 B.LS 0x2028
x.go:3 0x2014 e52de084 MOVW.W R14, -0x84(R13)
x.go:4 0x2018 e28d1004 ADD $4, R13, R1
x.go:4 0x201c e3a00000 MOVW $0, R0
x.go:4 0x2020 eb0124dc BL 0x4b398
x.go:5 0x2024 e49df084 RET #132
x.go:5 0x2028 e1a0300e MOVW R14, R3
x.go:5 0x202c eb011b0d BL runtime.morestack_noctxt(SB)
x.go:5 0x2030 eafffff2 B main.f(SB)
x.go:5 0x2034 eafffffe B 0x2034
x.go:5 0x2038 ffffff7c ?

Updates #10587.

package sort benchmarks on an iPhone 6:

name            old time/op  new time/op  delta
SortString1K     569µs ± 0%   565µs ± 1%  -0.75%  (p=0.000 n=23+24)
StableString1K   872µs ± 1%   870µs ± 1%  -0.16%  (p=0.009 n=23+24)
SortInt1K        317µs ± 2%   316µs ± 2%    ~     (p=0.410 n=26+26)
StableInt1K      343µs ± 1%   339µs ± 1%  -1.07%  (p=0.000 n=22+23)
SortInt64K      30.0ms ± 1%  30.0ms ± 1%    ~     (p=0.091 n=25+24)
StableInt64K    30.2ms ± 0%  30.0ms ± 0%  -0.69%  (p=0.000 n=22+22)
Sort1e2          147µs ± 1%   146µs ± 0%  -0.48%  (p=0.000 n=25+24)
Stable1e2        290µs ± 1%   286µs ± 1%  -1.30%  (p=0.000 n=23+24)
Sort1e4         29.5ms ± 2%  29.7ms ± 1%  +0.71%  (p=0.000 n=23+23)
Stable1e4       88.7ms ± 4%  88.6ms ± 8%  -0.07%  (p=0.022 n=26+26)
Sort1e6          4.81s ± 7%   4.83s ± 7%    ~     (p=0.192 n=26+26)
Stable1e6        18.3s ± 1%   18.1s ± 1%  -0.76%  (p=0.000 n=25+23)
SearchWrappers   318ns ± 1%   344ns ± 1%  +8.14%  (p=0.000 n=23+26)

package sort benchmarks on a first generation rpi:

name            old time/op  new time/op  delta
SearchWrappers  4.13µs ± 0%  3.95µs ± 0%   -4.42%  (p=0.000 n=15+13)
SortString1K    5.81ms ± 1%  5.82ms ± 2%     ~     (p=0.400 n=14+15)
StableString1K  9.69ms ± 1%  9.73ms ± 0%     ~     (p=0.121 n=15+11)
SortInt1K       3.30ms ± 2%  3.66ms ±19%  +10.82%  (p=0.000 n=15+14)
StableInt1K     5.97ms ±15%  4.17ms ± 8%  -30.05%  (p=0.000 n=15+15)
SortInt64K       319ms ± 1%   295ms ± 1%   -7.65%  (p=0.000 n=15+15)
StableInt64K     343ms ± 0%   332ms ± 0%   -3.26%  (p=0.000 n=12+13)
Sort1e2         3.36ms ± 2%  3.22ms ± 4%   -4.10%  (p=0.000 n=15+15)
Stable1e2       6.74ms ± 1%  6.43ms ± 2%   -4.67%  (p=0.000 n=15+15)
Sort1e4          247ms ± 1%   247ms ± 1%     ~     (p=0.331 n=15+14)
Stable1e4        864ms ± 0%   820ms ± 0%   -5.15%  (p=0.000 n=14+15)
Sort1e6          41.2s ± 0%   41.2s ± 0%   +0.15%  (p=0.000 n=13+14)
Stable1e6         192s ± 0%    182s ± 0%   -5.07%  (p=0.000 n=14+14)

Change-Id: I8a9db77e1d4ea1956575895893bc9d04bd81204b
Reviewed-on: https://go-review.googlesource.com/10497
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agocmd/internal/obj/x86: make function prologue more predictable
Josh Bleecher Snyder [Fri, 29 May 2015 00:31:24 +0000 (17:31 -0700)]
cmd/internal/obj/x86: make function prologue more predictable

Static branch prediction guesses that forward branches aren't taken.
Since stacks are rarely grown, make the forward branch mean grow.

Sample disassembly for

func f() {
_ = [128]byte{}
}

Before:

TEXT main.f(SB) x.go
x.go:3 0x2000 65488b0c25a0080000 GS MOVQ GS:0x8a0, CX
x.go:3 0x2009 483b6110 CMPQ 0x10(CX), SP
x.go:3 0x200d 7707 JA 0x2016
x.go:3 0x200f e88c410400 CALL runtime.morestack_noctxt(SB)
x.go:3 0x2014 ebea JMP main.f(SB)
x.go:3 0x2016 4881ec80000000 SUBQ $0x80, SP
x.go:4 0x201d 488d3c24 LEAQ 0(SP), DI
x.go:4 0x2021 31c0 XORL AX, AX
x.go:4 0x2023 e8cc640400 CALL 0x484f4
x.go:5 0x2028 4881c480000000 ADDQ $0x80, SP
x.go:5 0x202f c3 RET

After:

TEXT main.f(SB) x.go
x.go:3 0x2000 65488b0c25a0080000 GS MOVQ GS:0x8a0, CX
x.go:3 0x2009 483b6110 CMPQ 0x10(CX), SP
x.go:3 0x200d 761a JBE 0x2029
x.go:3 0x200f 4881ec80000000 SUBQ $0x80, SP
x.go:4 0x2016 488d3c24 LEAQ 0(SP), DI
x.go:4 0x201a 31c0 XORL AX, AX
x.go:4 0x201c e813740400 CALL 0x49434
x.go:5 0x2021 4881c480000000 ADDQ $0x80, SP
x.go:5 0x2028 c3 RET
x.go:3 0x2029 e8224f0400 CALL runtime.morestack_noctxt(SB)
x.go:3 0x202e ebd0 JMP main.f(SB)

Updates #10587.

Sample benchmarks on a 2.8 GHz Intel Core i7:

package sort

name            old mean              new mean              delta
SearchWrappers   134ns × (0.99,1.01)   132ns × (0.99,1.01)  -1.73% (p=0.000 n=15+14)
SortString1K     215µs × (0.99,1.01)   213µs × (0.99,1.01)  -0.61% (p=0.020 n=14+15)
StableString1K   311µs × (0.99,1.02)   309µs × (0.99,1.02)    ~    (p=0.077 n=14+15)
SortInt1K        103µs × (0.99,1.02)   100µs × (0.98,1.01)  -3.34% (p=0.000 n=15+15)
StableInt1K      102µs × (0.99,1.01)    98µs × (0.97,1.04)  -3.53% (p=0.000 n=15+15)
SortInt64K      10.1ms × (0.98,1.02)   9.7ms × (0.99,1.01)  -3.86% (p=0.000 n=14+15)
StableInt64K    8.70ms × (0.99,1.01)  8.44ms × (0.99,1.03)  -2.93% (p=0.000 n=14+15)
Sort1e2         51.2µs × (1.00,1.01)  48.9µs × (0.99,1.02)  -4.48% (p=0.000 n=13+15)
Stable1e2        100µs × (0.99,1.02)    99µs × (0.99,1.01)  -1.15% (p=0.000 n=14+13)
Sort1e4         11.1ms × (0.99,1.02)  10.4ms × (0.99,1.01)  -6.02% (p=0.000 n=15+14)
Stable1e4       30.6ms × (0.99,1.01)  30.3ms × (0.99,1.02)  -1.02% (p=0.001 n=15+14)
Sort1e6          1.75s × (0.99,1.02)   1.66s × (0.98,1.03)  -4.95% (p=0.000 n=14+15)
Stable1e6        6.31s × (0.99,1.01)   6.26s × (0.99,1.01)  -0.79% (p=0.002 n=15+15)

package regexp

name                          old mean              new mean              delta
Literal                        131ns × (0.99,1.01)   130ns × (0.99,1.03)  -1.07% (p=0.004 n=14+15)
NotLiteral                    2.13µs × (0.99,1.01)  2.01µs × (0.99,1.03)  -5.71% (p=0.000 n=14+14)
MatchClass                    3.15µs × (0.99,1.01)  3.04µs × (0.99,1.02)  -3.40% (p=0.000 n=15+15)
MatchClass_InRange            2.92µs × (0.99,1.01)  2.77µs × (0.99,1.02)  -5.05% (p=0.000 n=13+15)
ReplaceAll                    2.17µs × (0.99,1.02)  2.06µs × (0.99,1.01)  -5.19% (p=0.000 n=15+13)
AnchoredLiteralShortNonMatch   116ns × (0.99,1.02)   113ns × (0.99,1.01)  -2.75% (p=0.000 n=15+14)
AnchoredLiteralLongNonMatch    125ns × (0.99,1.01)   127ns × (0.98,1.02)  +1.49% (p=0.000 n=15+15)
AnchoredShortMatch             178ns × (0.99,1.02)   175ns × (0.99,1.01)  -1.62% (p=0.000 n=15+13)
AnchoredLongMatch              328ns × (0.99,1.00)   341ns × (0.99,1.01)  +3.73% (p=0.000 n=12+15)
OnePassShortA                  773ns × (0.99,1.02)   752ns × (0.99,1.01)  -2.78% (p=0.000 n=15+13)
NotOnePassShortA               794ns × (0.99,1.03)   780ns × (0.99,1.02)  -1.75% (p=0.001 n=15+15)
OnePassShortB                  608ns × (0.99,1.01)   591ns × (0.99,1.02)  -2.86% (p=0.000 n=15+14)
NotOnePassShortB               576ns × (0.99,1.01)   571ns × (0.99,1.02)  -0.74% (p=0.035 n=15+15)
OnePassLongPrefix              131ns × (0.99,1.02)   130ns × (0.99,1.02)  -1.32% (p=0.003 n=15+15)
OnePassLongNotPrefix           503ns × (0.99,1.02)   481ns × (0.99,1.01)  -4.34% (p=0.000 n=15+13)
MatchEasy0_32                  102ns × (0.98,1.01)   101ns × (0.99,1.02)    ~    (p=0.907 n=15+14)
MatchEasy0_1K                  617ns × (0.99,1.02)   634ns × (0.98,1.02)  +2.77% (p=0.000 n=15+15)
MatchEasy0_32K                10.9µs × (0.99,1.01)  11.1µs × (0.99,1.01)  +1.59% (p=0.000 n=15+15)
MatchEasy0_1M                  406µs × (0.99,1.02)   410µs × (0.99,1.02)  +1.01% (p=0.000 n=14+15)
MatchEasy0_32M                13.4ms × (0.99,1.01)  13.7ms × (0.99,1.02)  +1.64% (p=0.000 n=12+15)
MatchEasy1_32                 83.7ns × (0.98,1.02)  83.0ns × (0.98,1.02)    ~    (p=0.190 n=15+15)
MatchEasy1_1K                 1.46µs × (0.99,1.02)  1.39µs × (0.99,1.02)  -4.83% (p=0.000 n=15+15)
MatchEasy1_32K                49.4µs × (0.99,1.01)  49.4µs × (0.99,1.01)    ~    (p=0.205 n=15+15)
MatchEasy1_1M                 1.72ms × (0.99,1.02)  1.75ms × (0.99,1.01)  +1.34% (p=0.000 n=15+15)
MatchEasy1_32M                55.5ms × (0.99,1.01)  56.1ms × (0.99,1.02)  +1.10% (p=0.002 n=15+15)
MatchMedium_32                1.37µs × (0.99,1.04)  1.33µs × (0.99,1.01)  -2.87% (p=0.000 n=15+15)
MatchMedium_1K                41.1µs × (0.99,1.02)  40.4µs × (0.99,1.02)  -1.59% (p=0.000 n=15+15)
MatchMedium_32K               1.71ms × (0.99,1.01)  1.75ms × (0.99,1.02)  +2.36% (p=0.000 n=14+15)
MatchMedium_1M                54.5ms × (0.99,1.01)  56.1ms × (0.99,1.01)  +2.94% (p=0.000 n=13+15)
MatchMedium_32M                1.75s × (0.99,1.01)   1.80s × (0.99,1.01)  +2.77% (p=0.000 n=15+15)
MatchHard_32                  2.12µs × (0.99,1.02)  2.06µs × (0.99,1.01)  -2.60% (p=0.000 n=15+14)
MatchHard_1K                  64.4µs × (0.98,1.02)  62.2µs × (0.99,1.01)  -3.33% (p=0.000 n=15+15)
MatchHard_32K                 2.74ms × (0.99,1.01)  2.75ms × (0.99,1.01)    ~    (p=0.310 n=15+14)
MatchHard_1M                  87.1ms × (0.99,1.02)  88.2ms × (0.99,1.01)  +1.36% (p=0.000 n=14+15)
MatchHard_32M                  2.79s × (0.99,1.02)   2.83s × (0.99,1.02)  +1.26% (p=0.004 n=15+14)

go1 benchmarks

name                   old time/op    new time/op    delta
BinaryTree17              3.34s ± 3%     3.28s ± 2%  -1.86%  (p=0.000 n=67+66)
Fannkuch11                2.50s ± 1%     2.51s ± 1%  +0.24%  (p=0.016 n=63+66)
FmtFprintfEmpty          50.3ns ± 1%    50.2ns ± 2%  -0.30%  (p=0.001 n=62+67)
FmtFprintfString          178ns ± 1%     166ns ± 1%  -7.10%  (p=0.000 n=62+59)
FmtFprintfInt             168ns ± 1%     161ns ± 2%  -4.41%  (p=0.000 n=66+64)
FmtFprintfIntInt          292ns ± 1%     282ns ± 2%  -3.55%  (p=0.000 n=62+60)
FmtFprintfPrefixedInt     245ns ± 2%     239ns ± 2%  -2.24%  (p=0.000 n=66+65)
FmtFprintfFloat           338ns ± 2%     326ns ± 1%  -3.42%  (p=0.000 n=64+59)
FmtManyArgs              1.14µs ± 1%    1.10µs ± 2%  -3.55%  (p=0.000 n=62+62)
GobDecode                8.88ms ± 2%    8.74ms ± 1%  -1.55%  (p=0.000 n=66+62)
GobEncode                6.84ms ± 2%    6.61ms ± 2%  -3.32%  (p=0.000 n=61+67)
Gzip                      356ms ± 2%     352ms ± 2%  -1.07%  (p=0.000 n=67+66)
Gunzip                   90.6ms ± 2%    89.8ms ± 1%  -0.83%  (p=0.000 n=65+64)
HTTPClientServer         82.6µs ± 2%    82.5µs ± 2%    ~     (p=0.832 n=65+63)
JSONEncode               17.5ms ± 2%    16.8ms ± 2%  -3.77%  (p=0.000 n=63+63)
JSONDecode               63.3ms ± 2%    59.0ms ± 2%  -6.85%  (p=0.000 n=64+63)
Mandelbrot200            3.85ms ± 1%    3.85ms ± 1%    ~     (p=0.127 n=65+62)
GoParse                  3.75ms ± 2%    3.66ms ± 2%  -2.39%  (p=0.000 n=66+64)
RegexpMatchEasy0_32       100ns ± 2%     100ns ± 1%  -0.65%  (p=0.000 n=62+64)
RegexpMatchEasy0_1K       342ns ± 1%     341ns ± 1%  -0.43%  (p=0.000 n=65+64)
RegexpMatchEasy1_32      82.8ns ± 2%    82.8ns ± 2%    ~     (p=0.977 n=63+64)
RegexpMatchEasy1_1K       511ns ± 2%     506ns ± 2%  -1.01%  (p=0.000 n=63+64)
RegexpMatchMedium_32      139ns ± 1%     134ns ± 3%  -3.27%  (p=0.000 n=59+60)
RegexpMatchMedium_1K     41.8µs ± 2%    40.5µs ± 2%  -3.05%  (p=0.000 n=62+64)
RegexpMatchHard_32       2.13µs ± 1%    2.09µs ± 1%  -2.22%  (p=0.000 n=60+65)
RegexpMatchHard_1K       64.4µs ± 3%    62.8µs ± 2%  -2.58%  (p=0.000 n=65+59)
Revcomp                   531ms ± 2%     529ms ± 1%  -0.28%  (p=0.022 n=61+61)
Template                 73.2ms ± 1%    73.1ms ± 1%    ~     (p=0.794 n=66+63)
TimeParse                 369ns ± 1%     352ns ± 1%  -4.68%  (p=0.000 n=65+66)
TimeFormat                374ns ± 2%     348ns ± 2%  -7.01%  (p=0.000 n=66+64)

Change-Id: Ib190b5bb48a3e9087711d9e3383621d3103dd342
Reviewed-on: https://go-review.googlesource.com/10367
Reviewed-by: Russ Cox <rsc@golang.org>
9 years agoencoding/xml: Reset the parent stack before printing a chardata or comment field...
Hajime Hoshi [Sat, 9 May 2015 19:22:11 +0000 (04:22 +0900)]
encoding/xml: Reset the parent stack before printing a chardata or comment field in a struct

This CL resets the parent stack when printing a character or comment field struct.
In the case of XML elements, the previous parents stack must be considered. However,
charadata or comment fields can't be printed in other fields so it seems required to reset
the parent stack each time a chardata or comment field is printed.

Fixes #5072

Change-Id: I84f61c9bfce94133cd0c076c11211b9be5b4b1ac
Reviewed-on: https://go-review.googlesource.com/9910
Reviewed-by: Nigel Tao <nigeltao@golang.org>
Reviewed-by: roger peppe <rogpeppe@gmail.com>
9 years agocmd/go: clean up after 'go build' during 'go install'
Russ Cox [Mon, 20 Apr 2015 04:37:37 +0000 (00:37 -0400)]
cmd/go: clean up after 'go build' during 'go install'

If 'go install' (with no arguments, meaning the current directory)
succeeds, remove the executable written by 'go build', if present.
This avoids leaving a stale binary behind during a sequence like:

go build
<test, mostly works, make small change>
go install

Before this CL, the current directory still has the stale binary
from 'go build'. If $PATH contains dot, running the name of
the program will find this stale binary instead of the new,
installed one.

Remove the 'go build' target during 'go install', both to clean
up the directory and to avoid accidentally running the stale binary.

Another way to view this CL is that it makes the go command
behave as if 'go install' is implemented by 'go build' followed by
moving the resulting binary to the install location.

See #9645 for discussion and objections.

Fixes #9645.

Change-Id: Ide109572f96bbb5a35be45dda17738317462a7d4
Reviewed-on: https://go-review.googlesource.com/10682
Reviewed-by: Rob Pike <r@golang.org>
9 years agocmd/go: always rebuild GOPATH code that looks out of date
Russ Cox [Mon, 20 Apr 2015 15:07:29 +0000 (11:07 -0400)]
cmd/go: always rebuild GOPATH code that looks out of date

We used to put a rebuilding barrier between GOPATHs, so that if
you had GOPATH=dir1:dir2 and you had "p" in dir1/src/p
and "q" in dir2/src/q, with "p" importing "q", then when you
ran 'go install p', it would see that it was working in dir1
and (since nothing from dir2 was explicitly mentioned)
would assume that everything in dir2 is up-to-date, provided
it is built at all.

This has the confusing behavior that if "q" hasn't been built ever,
then if you update sources in q and run 'go install p', the right
thing happens (q is rebuilt and then p), but after that, if you update
sources in q and run 'go install p', nothing happens: the installed
q is assumed up-to-date.

People using code conventions with multiple GOPATH entries
(for example, with commands in one place and libraries in another,
or vendoring conventions that try to avoid rewriting import paths)
run into this without realizing it and end up with incorrect build
results.

The original motivation here was to avoid rebuild standard packages
since a system-installed GOROOT might be unwritable.
The change introduced to separate GOROOT also separated
individual GOPATH entries. Later changes added a different, more
aggressive earlier shortcut for GOROOT in release settings,
so the code here is now only applying to (and confusing)
multiple GOPATH entries. Remove it.

Fixes #10509.

Change-Id: I687a3baa81eff4073b0d67f9acbc5a3ab192eda5
Reviewed-on: https://go-review.googlesource.com/9155
Reviewed-by: Ian Lance Taylor <iant@golang.org>