]> Cypherpunks repositories - gostls13.git/log
gostls13.git
8 years agocmd/compile: reduce element size of arrays in sparse{map,set}
David Chase [Mon, 9 May 2016 18:59:25 +0000 (14:59 -0400)]
cmd/compile: reduce element size of arrays in sparse{map,set}

sparseSet and sparseMap only need 32 bit integers in their
arrays, since a sparseEntry key is also limited to 32 bits.
This appears to reduce the space allocated for at least
one pathological compilation by 1%, perhaps more.

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

Change-Id: Icf1185859e9f5fe1261a206b441e02c34f7d02fd
Reviewed-on: https://go-review.googlesource.com/22972
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
8 years agoruntime: in tests, make sure gdb does not start with a shell
Cuihtlauac ALVARADO [Tue, 17 May 2016 07:27:00 +0000 (09:27 +0200)]
runtime: in tests, make sure gdb does not start with a shell

On some systems, gdb is set to: "startup-with-shell on". This
breaks runtime_test. This just make sure gdb does not start by
spawning a shell.

Fixes #15354

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

8 years agocmd/compile: handle unsafe.Pointer(f()) correctly
Matthew Dempsky [Tue, 19 Apr 2016 22:02:06 +0000 (15:02 -0700)]
cmd/compile: handle unsafe.Pointer(f()) correctly

Previously statements like

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

would be reordered into a sequence of statements like

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

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

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

Fixes #15329.

Change-Id: I2cdbd89d233d0d5c94791513a9fd5fd958d11ed5
Reviewed-on: https://go-review.googlesource.com/22273
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
8 years agodoc/effective_go: clarify backward function reference
Ian Lance Taylor [Wed, 18 May 2016 01:07:07 +0000 (18:07 -0700)]
doc/effective_go: clarify backward function reference

Fixes #14656.

Change-Id: I37a9aa51705ae18bd034f2cc6dbf06a55f969197
Reviewed-on: https://go-review.googlesource.com/23202
Reviewed-by: Rob Pike <r@golang.org>
8 years agonet: don't increase test table rows when using -test.count flag
Mikio Hara [Wed, 18 May 2016 04:02:39 +0000 (13:02 +0900)]
net: don't increase test table rows when using -test.count flag

Change-Id: I7881e3353dc5cd9755a79ea0eab146c6a0a08306
Reviewed-on: https://go-review.googlesource.com/23195
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

8 years agonet: deflake TestLookupPort on Android
Mikio Hara [Wed, 18 May 2016 01:54:20 +0000 (10:54 +0900)]
net: deflake TestLookupPort on Android

Looks like some version of Android still fails with "servname not
supported for ai_socktype". It probably doesn't support
ai_socktype=SOCK_STREAM.

Updates #14576.

Change-Id: I77ecff147d5b759e3281b3798c60f150a4aab811
Reviewed-on: https://go-review.googlesource.com/23194
Reviewed-by: Ian Lance Taylor <iant@golang.org>
8 years agoregexp/syntax: clarify that \Z means Perl's \Z
Brad Fitzpatrick [Wed, 18 May 2016 01:00:32 +0000 (01:00 +0000)]
regexp/syntax: clarify that \Z means Perl's \Z

Fixes #14793

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

8 years agoruntime: deflake TestSignalExitStatus
Ian Lance Taylor [Wed, 18 May 2016 01:16:47 +0000 (18:16 -0700)]
runtime: deflake TestSignalExitStatus

The signal might get delivered to a different thread, and that thread
might not run again before the currently running thread returns and
exits. Sleep to give the other thread time to pick up the signal and
crash.

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

Change-Id: Iff58669ac6185ad91cce85e0e86f17497a3659fd
Reviewed-on: https://go-review.googlesource.com/23203
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Mikio Hara <mikioh.mikioh@gmail.com>
8 years agocrypto/x509: fix typo in docs for CreateCertificateRequest
Emmanuel Odeke [Wed, 18 May 2016 02:22:48 +0000 (20:22 -0600)]
crypto/x509: fix typo in docs for CreateCertificateRequest

Update the doc for CreateCertificateRequest
to state that it creates a
  `new certificate request`
instead of just a
  `new certificate`

Fixes #14649.

Change-Id: Ibbbcf91d74168998990990e78e5272a6cf294d51
Reviewed-on: https://go-review.googlesource.com/23204
Reviewed-by: Russ Cox <rsc@golang.org>
8 years agonet/http: add test confirming a connection reuse case
Brad Fitzpatrick [Wed, 18 May 2016 00:35:43 +0000 (00:35 +0000)]
net/http: add test confirming a connection reuse case

Verify that for a server doing chunked encoding, with the final data
and EOF arriving together, the client will reuse the connection even
if it closes the body without seeing an EOF. The server sends at least
one non-zero chunk and one zero chunk. This verifies that the client's
bufio reading reads ahead and notes the EOF, so even if the JSON
decoder doesn't read the EOF itself, as long as somebody sees it, a
close won't forcible tear down the connection. This was true at least
of https://golang.org/cl/21291

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

Updates #15703

Change-Id: I2140b3eec6b099b6b6e54f153fe271becac5d949
Reviewed-on: https://go-review.googlesource.com/23200
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
8 years agoruntime: prevent racefini from being invoked more than once
James Chacon [Fri, 6 May 2016 18:51:56 +0000 (11:51 -0700)]
runtime: prevent racefini from being invoked more than once

racefini calls __tsan_fini which is C code and at the end of it
invoked the standard C library exit(3) call. This has undefined
behavior if invoked more than once. Specifically in C++ programs
it caused static destructors to run twice. At least on glibc
impls it also means the at_exit handlers list (where those are
stored) also free's a list entry when it completes these. So invoking
twice results in a double free at exit which trips debug memory
allocation tracking.

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

Fixes #15578

Change-Id: I49222aa9b8ded77160931f46434c61a8379570fc
Reviewed-on: https://go-review.googlesource.com/22882
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
Run-TryBot: Dmitry Vyukov <dvyukov@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

8 years agodebug/gosym: parse remote packages correctly
Alessandro Arzilli [Sat, 14 May 2016 05:54:02 +0000 (07:54 +0200)]
debug/gosym: parse remote packages correctly

Fixes #15675

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

8 years agonet: deflake TestLookupPort for embedded, security-hardened platforms
Mikio Hara [Thu, 12 May 2016 20:02:00 +0000 (05:02 +0900)]
net: deflake TestLookupPort for embedded, security-hardened platforms

Fixes #14576.

Change-Id: I760907c67c97cb827cf48ba7eb0bb2f4f8d4d790
Reviewed-on: https://go-review.googlesource.com/23111
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
8 years agoreflect: remove out of date UTF-8 StructOf restriction
Colin Cross [Tue, 17 May 2016 20:09:11 +0000 (13:09 -0700)]
reflect: remove out of date UTF-8 StructOf restriction

The initial implementation of reflect.StructOf in
https://golang.org/cl/9251 had a limitation that field names had to be
ASCII, which was later lifted by https://golang.org/cl/21777.  Remove
the out-of-date documentation disallowing UTF-8 field names.

Updates: #5748
Updates: #15064

Change-Id: I2c5bfea46bfd682449c6e847fc972a1a131f51b7
Reviewed-on: https://go-review.googlesource.com/23170
Reviewed-by: David Crawshaw <crawshaw@golang.org>
8 years agoos/signal: fix wrong constant name in the documentation
Konstantin Shaposhnikov [Tue, 17 May 2016 12:16:41 +0000 (20:16 +0800)]
os/signal: fix wrong constant name in the documentation

os.SIGINT is not defined, os.Interrupt or syscall.SIGINT should be used.

Change-Id: I39867726d28e179d1160a4fd353b7bea676c9dbb
Reviewed-on: https://go-review.googlesource.com/23127
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agonet: use IPv4/IPv6 reserved address blocks for documentation
Mikio Hara [Tue, 17 May 2016 03:20:16 +0000 (12:20 +0900)]
net: use IPv4/IPv6 reserved address blocks for documentation

Also replaces google.com with golang.org in package documentation.

Updates #15228.

Change-Id: I554fa960878fa44557a522635ed412d8d7548d3f
Reviewed-on: https://go-review.googlesource.com/23126
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agonet: simplify interfaceTable for BSD variants
Mikio Hara [Mon, 16 May 2016 22:07:58 +0000 (07:07 +0900)]
net: simplify interfaceTable for BSD variants

This change drops parseInterfaceTable which becomes unnecessary by the
golang.org/x/net/route plumbing.

Change-Id: I05f96e347de950bb1e9292bb3eeff01bb40e292f
Reviewed-on: https://go-review.googlesource.com/23125
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

8 years agocrypto/tls: document certificate chains in LoadX509KeyPair
Scott Bell [Mon, 16 May 2016 19:51:52 +0000 (12:51 -0700)]
crypto/tls: document certificate chains in LoadX509KeyPair

Fixes #15348

Change-Id: I9e0e1e3a26fa4cd697d2c613e6b4952188b7c7e1
Reviewed-on: https://go-review.googlesource.com/23150
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agoio: make chained multiReader Read more efficient
andrew werner [Tue, 15 Dec 2015 22:42:28 +0000 (14:42 -0800)]
io: make chained multiReader Read more efficient

before this change, when io.MultiReader was called many times but contain few
underlying readers, calls to Read were unnecessarily expensive.

Fixes #13558

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

8 years agomime/multipart: sort header keys to ensure reproducible output
Simon Thulbourn [Mon, 7 Dec 2015 16:36:11 +0000 (16:36 +0000)]
mime/multipart: sort header keys to ensure reproducible output

Adds a transparent sort to the mime/multipart package, which is
only used in the CreatePart func. This will ensure the ordering
of the MIMEHeader.

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

Fixes #13522

Change-Id: I9584ef9dbe98ce97d536d897326914653f8d9ddf
Reviewed-on: https://go-review.googlesource.com/17497
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agoA+C: add Andrew Werner (corporate CLA for Upthere, Inc)
Brad Fitzpatrick [Mon, 16 May 2016 22:45:18 +0000 (15:45 -0700)]
A+C: add Andrew Werner (corporate CLA for Upthere, Inc)

Change-Id: I7627e480d5d2366cba223fd81635c4115649f752
Reviewed-on: https://go-review.googlesource.com/23154
Reviewed-by: Ian Lance Taylor <iant@golang.org>
8 years agoruntime: yield after raising signal that should kill process
Ian Lance Taylor [Mon, 16 May 2016 21:11:01 +0000 (14:11 -0700)]
runtime: yield after raising signal that should kill process

Issue #15613 points out that the darwin builders have been getting
regular failures in which a process that should exit with a SIGPIPE
signal is instead exiting with exit status 2. The code calls
runtime.raise. On most systems runtime.raise is the equivalent of
pthread_kill(gettid(), sig); that is, it kills the thread with the
signal, which should ensure that the program does not keep going. On
darwin, however, runtime.raise is actually kill(getpid(), sig); that is,
it sends a signal to the entire process. If the process decides to
deliver the signal to a different thread, then it is possible that in
some cases the thread that calls raise is able to execute the next
system call before the signal is actually delivered. That would cause
the observed error.

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

Fixed #15613.

Change-Id: I60c0a9912aae2f46143ca1388fd85e9c3fa9df1f
Reviewed-on: https://go-review.googlesource.com/23152
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agodoc: fix broken link to the vet command documentation
Scott Bell [Mon, 16 May 2016 20:13:25 +0000 (13:13 -0700)]
doc: fix broken link to the vet command documentation

Fixes #15188

Change-Id: I0ab7791f7db499cef6bc52292d3d93ff4da7caff
Reviewed-on: https://go-review.googlesource.com/23151
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agocmd/compile: use sparse algorithm for phis in large program
David Chase [Thu, 21 Apr 2016 17:24:58 +0000 (13:24 -0400)]
cmd/compile: use sparse algorithm for phis in large program

This adds a sparse method for locating nearest ancestors
in a dominator tree, and checks blocks with more than one
predecessor for differences and inserts phi functions where
there are.

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

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

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

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

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

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

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

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

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

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

Fixes #15537.

Change-Id: Ia0299dda6a291534d8b08e5f9883216ded677a00
Reviewed-on: https://go-review.googlesource.com/22342
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

8 years agoruntime: use GOTRACEBACK=system for TestStackBarrierProfiling
Austin Clements [Mon, 16 May 2016 19:27:48 +0000 (15:27 -0400)]
runtime: use GOTRACEBACK=system for TestStackBarrierProfiling

This should help with debugging failures.

For #15138 and #15477.

Change-Id: I77db2b6375d8b4403d3edf5527899d076291e02c
Reviewed-on: https://go-review.googlesource.com/23134
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rick Hudson <rlh@golang.org>
8 years agoencoding/json: document that object keys are sorted
Scott Bell [Mon, 16 May 2016 19:36:02 +0000 (12:36 -0700)]
encoding/json: document that object keys are sorted

Fixes #15424

Change-Id: Ib9e97509f5ac239ee54fe6fe37152a7f5fc75087
Reviewed-on: https://go-review.googlesource.com/23109
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agoruntime: use conventional shift style for gcBitsChunkBytes
Austin Clements [Mon, 9 May 2016 15:29:34 +0000 (11:29 -0400)]
runtime: use conventional shift style for gcBitsChunkBytes

The convention for writing something like "64 kB" is 64<<10, since
this is easier to read than 1<<16. Update gcBitsChunkBytes to follow
this convention.

Change-Id: I5b5a3f726dcf482051ba5b1814db247ff3b8bb2f
Reviewed-on: https://go-review.googlesource.com/23132
Reviewed-by: Rick Hudson <rlh@golang.org>
8 years agoruntime: remove obsolete comment from scanobject
Austin Clements [Wed, 11 May 2016 20:29:07 +0000 (16:29 -0400)]
runtime: remove obsolete comment from scanobject

Change-Id: I5ebf93b60213c0138754fc20888ae5ce60237b8c
Reviewed-on: https://go-review.googlesource.com/23131
Reviewed-by: Rick Hudson <rlh@golang.org>
8 years agonet/http: mention ALPN in http.Server.TLSNextProto documentation
Dan Peterson [Mon, 16 May 2016 13:11:59 +0000 (10:11 -0300)]
net/http: mention ALPN in http.Server.TLSNextProto documentation

Make clear negotiation can happen via NPN or ALPN, similar to
http.Transport.TLSNextProto and x/net/http2.NextProtoTLS.

Change-Id: Ied00b842bc04e11159d6d2107beda921cefbc6ca
Reviewed-on: https://go-review.googlesource.com/23108
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agonet/http/httputil: don't add User-Agent header by proxy made with NewSingleHostRevers...
Artyom Pervukhin [Mon, 16 May 2016 12:30:28 +0000 (15:30 +0300)]
net/http/httputil: don't add User-Agent header by proxy made with NewSingleHostReverseProxy

If client does not provided User-Agent header, do not set default one
used by net/http package when doing request to backend.

Fixes #15524

Change-Id: I9a46bb3b7ec106bc7c3071e235b872d279994d67
Reviewed-on: https://go-review.googlesource.com/23089
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agosyscall: fix missing use of use function in sysctl
Mikio Hara [Sun, 15 May 2016 08:24:51 +0000 (17:24 +0900)]
syscall: fix missing use of use function in sysctl

Updates #13372.

Change-Id: Id2402a781474e9d0bb0901c5844adbd899f76cbd
Reviewed-on: https://go-review.googlesource.com/23123
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agosyscall: deprecate BPF/LSF
Mikio Hara [Sun, 15 May 2016 08:16:04 +0000 (17:16 +0900)]
syscall: deprecate BPF/LSF

Updates #14982.

Change-Id: Id12b1e61456832d2b2ffbdbe8cf0a1db4444b1e4
Reviewed-on: https://go-review.googlesource.com/23122
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agosyscall: deprecate routing message APIs for BSD variants
Mikio Hara [Sat, 23 Apr 2016 13:36:41 +0000 (22:36 +0900)]
syscall: deprecate routing message APIs for BSD variants

Also removes unnecessary test cases for avoiding unexpected failures on
newer operating systems.

Updates #14724.

Change-Id: I2291585d951fb70383da68293a6ac1ff3524c7f7
Reviewed-on: https://go-review.googlesource.com/22452
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agomime: fix mime type file name on Plan 9
David du Colombier [Sun, 15 May 2016 18:12:34 +0000 (20:12 +0200)]
mime: fix mime type file name on Plan 9

There was a typo introduced in the initial
implementation of the Plan 9 support of
the mime package.

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

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

8 years agonet: golang.org/x/net/route plumbing
Mikio Hara [Sat, 23 Apr 2016 13:36:41 +0000 (22:36 +0900)]
net: golang.org/x/net/route plumbing

This change makes use of new routing message APIs for BSD variants to
support FreeBSD 11 and newer versions of other BSDs.

Fixes #7849.
Fixes #14724.

Change-Id: I56c7886d6622cdeddd7cc29c8a8062dcc06216d5
Reviewed-on: https://go-review.googlesource.com/22451
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

8 years agostrings: fix Contains on amd64
Keith Randall [Sun, 15 May 2016 00:33:23 +0000 (17:33 -0700)]
strings: fix Contains on amd64

The 17-31 byte code is broken.  Disabled it.

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

Fixes #15679

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

8 years agovendor: import golang.org/x/net/route
Mikio Hara [Sat, 23 Apr 2016 13:36:41 +0000 (22:36 +0900)]
vendor: import golang.org/x/net/route

golang.org/x/net/route becomes vendor/golang.org/x/net/route.

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

Updates #14724.

Change-Id: I41cfb5443aeecac4c71e843c09eb8c1d4b7413ea
Reviewed-on: https://go-review.googlesource.com/22450
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agotime: set Local.name on windows
Alex Brainman [Fri, 13 May 2016 04:26:30 +0000 (14:26 +1000)]
time: set Local.name on windows

Local.String() returns "Local" on every OS, but windows.
Change windows code to do like others.

Updates #15568

Change-Id: I7a4d2713d940e2a01cff9d7f5cefc89def07546a
Reviewed-on: https://go-review.googlesource.com/23078
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agoarchive/zip: use HTTPS for documentation link
Kevin Burke [Sat, 14 May 2016 17:23:09 +0000 (10:23 -0700)]
archive/zip: use HTTPS for documentation link

The resource is available over (and redirects to) HTTPS, it seems like a good
idea to save a redirect and ensure an encrypted connection.

Change-Id: I262c7616ae289cdd756b6f67573ba6bd7e3e0ca6
Reviewed-on: https://go-review.googlesource.com/23104
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agocmd/vendor: move cmd/internal/unvendor packages to cmd/vendor
Konstantin Shaposhnikov [Sat, 14 May 2016 02:27:31 +0000 (10:27 +0800)]
cmd/vendor: move cmd/internal/unvendor packages to cmd/vendor

Updates #14047

Change-Id: I4b150533393bfb90e840497095ac32bcca4f04c2
Reviewed-on: https://go-review.googlesource.com/23114
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agoruntime: improve heapBitsSetType documentation
Austin Clements [Thu, 12 May 2016 22:10:03 +0000 (18:10 -0400)]
runtime: improve heapBitsSetType documentation

Currently the heapBitsSetType documentation says that there are no
races on the heap bitmap, but that isn't exactly true. There are no
*write-write* races, but there are read-write races. Expand the
documentation to explain this and why it's okay.

Change-Id: Ibd92b69bcd6524a40a9dd4ec82422b50831071ed
Reviewed-on: https://go-review.googlesource.com/23092
Reviewed-by: Rick Hudson <rlh@golang.org>
8 years agoruntime: perform publication barrier even for noscan objects
Austin Clements [Wed, 11 May 2016 18:57:33 +0000 (14:57 -0400)]
runtime: perform publication barrier even for noscan objects

Currently we only execute a publication barrier for scan objects (and
skip it for noscan objects). This used to be okay because GC would
never consult the object itself (so it wouldn't observe uninitialized
memory even if it found a pointer to a noscan object), and the heap
bitmap was pre-initialized to noscan.

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

Change-Id: Ie4133c638db0d9055b4f7a8061a634d970627153
Reviewed-on: https://go-review.googlesource.com/23043
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rick Hudson <rlh@golang.org>
8 years agonet: deflake TestPointToPointInterface and TestInterfaceArrivalAndDeparture
Mikio Hara [Thu, 12 May 2016 20:02:00 +0000 (05:02 +0900)]
net: deflake TestPointToPointInterface and TestInterfaceArrivalAndDeparture

Fixes #6879.

Change-Id: I9ed2460cf14cb9322d9521e7af910efa48abdaf0
Reviewed-on: https://go-review.googlesource.com/23112
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
8 years agonet, net/http: don't trace DNS dials
Tom Bergan [Fri, 13 May 2016 05:03:46 +0000 (22:03 -0700)]
net, net/http: don't trace DNS dials

This fixes change https://go-review.googlesource.com/#/c/23069/, which
assumes all DNS requests are UDP. This is not true -- DNS requests can
be TCP in some cases. See:
https://tip.golang.org/src/net/dnsclient_unix.go#L154
https://en.wikipedia.org/wiki/Domain_Name_System#Protocol_transport

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

Updates #12580

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

8 years agoreflect: fix method type string
David Crawshaw [Fri, 13 May 2016 16:33:27 +0000 (12:33 -0400)]
reflect: fix method type string

By picking up a spurious tFlagExtraStar, the method type was printing
as unc instead of func.

Updates #15673

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

8 years agoRevert "cmd/build: reject non-existant directories in ImportDir"
Mikio Hara [Fri, 13 May 2016 02:10:29 +0000 (11:10 +0900)]
Revert "cmd/build: reject non-existant directories in ImportDir"

This reverts commit 7af2ce3f159760033c903b3730bfb5995b4edd40.

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

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

Change-Id: I362a862a4ded8592dec7488a28e7a256adee148f
Reviewed-on: https://go-review.googlesource.com/23076
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
Reviewed-by: Andrew Gerrand <adg@golang.org>
8 years agodoc/go1.7.txt: add cmd/trace changes
Dmitry Vyukov [Fri, 13 May 2016 07:25:25 +0000 (09:25 +0200)]
doc/go1.7.txt: add cmd/trace changes

Change-Id: Iaf455d1a2863ff752e0c398e1c364373b4d36614
Reviewed-on: https://go-review.googlesource.com/23084
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
8 years agonet, net/http: don't trace UDP dials
Brad Fitzpatrick [Thu, 12 May 2016 22:12:11 +0000 (22:12 +0000)]
net, net/http: don't trace UDP dials

The httptrace.ConnectStart and ConnectDone hooks are just about the
post-DNS connection to the host. We were accidentally also firing on
the UDP dials to DNS. Exclude those for now. We can add them back
later as separate hooks if desired. (but they'd only work for pure Go
DNS)

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

Updates #12580

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

8 years agosyscall: separate stdlib imports from others in mksyscall_windows.go
Alex Brainman [Thu, 12 May 2016 05:04:05 +0000 (15:04 +1000)]
syscall: separate stdlib imports from others in mksyscall_windows.go

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

8 years agotext/template: detect pathologically recursive template invocations
Andrew Gerrand [Thu, 12 May 2016 20:55:46 +0000 (13:55 -0700)]
text/template: detect pathologically recursive template invocations

Return an error message instead of eating memory and eventually
triggering a stack overflow.

Fixes #15618

Change-Id: I3dcf1d669104690a17847a20fbfeb6d7e39e8751
Reviewed-on: https://go-review.googlesource.com/23091
Reviewed-by: Rob Pike <r@golang.org>
8 years agofmt: remove extra space in too few arguments example
Mohit Agarwal [Thu, 12 May 2016 20:35:48 +0000 (02:05 +0530)]
fmt: remove extra space in too few arguments example

Change-Id: Iae4855c52c4da9755277251d22121226507ea26a
Reviewed-on: https://go-review.googlesource.com/23074
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agocmd/build: reject non-existant directories in ImportDir
Emmanuel Odeke [Wed, 11 May 2016 04:28:30 +0000 (21:28 -0700)]
cmd/build: reject non-existant directories in ImportDir

Re-apply @adg's CL https://golang.org/cl/7129048 that was
previously disabled in https://golang.org/cl/7235052 because
it broke `godoc net/http` for go1.1.

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

Fixes #3428.

Change-Id: I7df06df02fd62dededac6ec60bea62561be59cf1
Reviewed-on: https://go-review.googlesource.com/23013
Run-TryBot: Andrew Gerrand <adg@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
8 years agocmd/trace: split large traces into parts
Dmitry Vyukov [Tue, 3 May 2016 14:44:25 +0000 (16:44 +0200)]
cmd/trace: split large traces into parts

Trace viewer cannot handle traces larger than 256MB (limit on js string size):
https://github.com/catapult-project/catapult/issues/627
And even that is problematic (chrome hangs and crashes).
Split large traces into 100MB parts. Somewhat clumsy, but I don't see any other
solution (other than rewriting trace viewer). At least it works reliably now.

Fixes #15482

Change-Id: I993b5f43d22072c6f5bd041ab5888ce176f272b2
Reviewed-on: https://go-review.googlesource.com/22731
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
8 years agogo/types: fix certain vet warnings
Aliaksandr Valialkin [Thu, 12 May 2016 12:27:30 +0000 (15:27 +0300)]
go/types: fix certain vet warnings

Updates #11041

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

8 years agocmd/compile/internal/gc: minor cleanup of init.go comments
Michael Munday [Thu, 12 May 2016 16:09:18 +0000 (12:09 -0400)]
cmd/compile/internal/gc: minor cleanup of init.go comments

Step 5 was deleted in f3575a9 however the numbering of the other
steps wasn't adjusted accordingly.

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

Change-Id: I4e77b2d3ee8460abe4bfb993674f83e35be8ff17
Reviewed-on: https://go-review.googlesource.com/23066
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agotesting: fix vet warning
Aliaksandr Valialkin [Thu, 12 May 2016 12:03:22 +0000 (15:03 +0300)]
testing: fix vet warning

Updates #11041

Change-Id: I32a381854e6a4fd791db380150efab57e6dfc38c
Reviewed-on: https://go-review.googlesource.com/23081
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agocmd: fixed certain vet warnings
Aliaksandr Valialkin [Thu, 12 May 2016 12:13:22 +0000 (15:13 +0300)]
cmd: fixed certain vet warnings

Updates #11041

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

8 years agoreflect: fix vet warnings
Aliaksandr Valialkin [Thu, 12 May 2016 12:00:10 +0000 (15:00 +0300)]
reflect: fix vet warnings

Updated #11041

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

8 years agoruntime: stop using sigreturn on openbsd/386
Joel Sing [Sun, 8 May 2016 16:13:03 +0000 (02:13 +1000)]
runtime: stop using sigreturn on openbsd/386

In future releases of OpenBSD, the sigreturn syscall will no longer
exist. As such, stop using sigreturn on openbsd/386 and just return
from the signal trampoline (as we already do for openbsd/amd64 and
openbsd/arm).

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

8 years agosyscall: make mksyscall_windows.go -systemdll flag true by default
Alex Brainman [Wed, 11 May 2016 06:16:37 +0000 (16:16 +1000)]
syscall: make mksyscall_windows.go -systemdll flag true by default

Updates #15167

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

8 years agocmd/compile: use one format for exporting calls of builtin functions
Robert Griesemer [Wed, 11 May 2016 20:39:36 +0000 (13:39 -0700)]
cmd/compile: use one format for exporting calls of builtin functions

Minor cleanup. Each of these cases appears both during export and
import when running all.bash and thus is tested by all.bash.

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

8 years agonet/http: keep HTTP/1.0 keep-alive conns open if response can't have a body
Brad Fitzpatrick [Wed, 11 May 2016 22:01:28 +0000 (15:01 -0700)]
net/http: keep HTTP/1.0 keep-alive conns open if response can't have a body

Fixes #15647

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

8 years agotext/template: fix typo in documentation
Johan Sageryd [Sun, 8 May 2016 16:06:03 +0000 (18:06 +0200)]
text/template: fix typo in documentation

Change-Id: I4ccfaa16e153aad001d670891b3848264e63cf6f
Reviewed-on: https://go-review.googlesource.com/23031
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agocmd/compile: use ONAME instead of OPACK in binary export format
Robert Griesemer [Wed, 11 May 2016 19:40:17 +0000 (12:40 -0700)]
cmd/compile: use ONAME instead of OPACK in binary export format

This is addressing feedback given on golang.org/cl/23052;
we do it in a separate CL to separate the functional from
the rename change.

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

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

Change-Id: I78b01a1badbf60e9283eaadeca2578a65d28cbd2
Reviewed-on: https://go-review.googlesource.com/23053
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
8 years agocmd/compile: clean up encoding of method expressions and add test
Robert Griesemer [Wed, 11 May 2016 18:28:36 +0000 (11:28 -0700)]
cmd/compile: clean up encoding of method expressions and add test

Fixes #15646.

Change-Id: Ic13d1adc0a358149209195cdb03811eeee506fb8
Reviewed-on: https://go-review.googlesource.com/23052
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
8 years agocmd/pprof: remove tempDir when no longer needed
Joe Tsai [Wed, 11 May 2016 17:23:37 +0000 (10:23 -0700)]
cmd/pprof: remove tempDir when no longer needed

The pprof tools properly cleans up all files it creates, but forgets
to clean up the temporary directory itself. This CL fixes that.

Fixes #13863

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

8 years agoos: fix Remove for file with read only attribute on Windows
Marc-Antoine Ruel [Thu, 7 Apr 2016 18:24:24 +0000 (14:24 -0400)]
os: fix Remove for file with read only attribute on Windows

Include integration test. Confirmed that without the fix, the test case
TestDeleteReadOnly fails.

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

Fixes #9606

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

8 years agonet/http: make the MaxBytesReader.Read error sticky
Brad Fitzpatrick [Tue, 10 May 2016 22:09:23 +0000 (15:09 -0700)]
net/http: make the MaxBytesReader.Read error sticky

Fixes #14981

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

8 years agocmd/cgo: remove //extern for check functions in gccgo Go prologue
Ian Lance Taylor [Wed, 11 May 2016 16:37:46 +0000 (09:37 -0700)]
cmd/cgo: remove //extern for check functions in gccgo Go prologue

The //extern comments are incorrect and cause undefined symbol
errorswhen building cgo code with -compiler=gccgo. The code is already
designed to use weak references, and that support relies on the cgo
check functions being treated as local functions.

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

8 years agonet/http: document ResponseWriter read-vs-write concurrency rules
Brad Fitzpatrick [Tue, 10 May 2016 23:09:16 +0000 (16:09 -0700)]
net/http: document ResponseWriter read-vs-write concurrency rules

Summary: Go's HTTP/1.x server closes the request body once writes are
flushed. Go's HTTP/2 server supports concurrent read & write.

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

Updates #15527

Change-Id: I81f7354923d37bfc1632629679c75c06a62bb584
Reviewed-on: https://go-review.googlesource.com/23011
Reviewed-by: Andrew Gerrand <adg@golang.org>
8 years agoos/exec: cleanup and remove duplicated code
Hiroshi Ioka [Sat, 26 Dec 2015 07:50:01 +0000 (16:50 +0900)]
os/exec: cleanup and remove duplicated code

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

8 years agonet: fix nits found by vet
Mikio Hara [Wed, 11 May 2016 04:04:22 +0000 (13:04 +0900)]
net: fix nits found by vet

Change-Id: I323231f31c4e1e7415661ebd943a90b2f1e9da1c
Reviewed-on: https://go-review.googlesource.com/23020
Reviewed-by: Ian Lance Taylor <iant@golang.org>
8 years agonet: reorganize interface tests to avoid vague flakiness
Mikio Hara [Mon, 9 May 2016 19:29:32 +0000 (04:29 +0900)]
net: reorganize interface tests to avoid vague flakiness

This change reorganizes test cases for surveying network interfaces and
address prefixes to make sure which part of the functionality is broken.

Updates #7849.

Change-Id: If6918075802eef69a7f1ee040010b3c46f4f4b97
Reviewed-on: https://go-review.googlesource.com/22990
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agoRevert "os: enable TestGetppid on Plan 9"
David du Colombier [Tue, 10 May 2016 07:43:17 +0000 (07:43 +0000)]
Revert "os: enable TestGetppid on Plan 9"

This reverts commit a677724edfc465193d2f79ee48d2c06defbc916b.

Change-Id: I6a54ac26a6deca5b2a39ec9f899469a88b543d3d
Reviewed-on: https://go-review.googlesource.com/22980
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agosyscall: remove mksyscall_windows.go -xsys flag
Alex Brainman [Wed, 11 May 2016 05:19:32 +0000 (15:19 +1000)]
syscall: remove mksyscall_windows.go -xsys flag

Also run "go generate" in
internal/syscall/windows and internal/syscall/windows/registry

Updates #15167

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

8 years agogo/importer: use correct path when checking if package was already imported
Robert Griesemer [Wed, 11 May 2016 00:06:19 +0000 (17:06 -0700)]
go/importer: use correct path when checking if package was already imported

The importer uses a global (shared) package map across multiple imports
to determine if a package was imported before. That package map is usually
indexed by package (import) path ('id' in this code). However, the binary
importer was using the incoming (possibly unclean) path.

Fixes #15517.

Change-Id: I0c32a708dfccf345e0353fbda20ad882121e437c
Reviewed-on: https://go-review.googlesource.com/23012
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
8 years agoruntime: make mksyscall_windows.go flags do what they say they do
Alex Brainman [Thu, 7 Apr 2016 05:12:32 +0000 (15:12 +1000)]
runtime: make mksyscall_windows.go flags do what they say they do

The -systemdll and -xsys flags generate broken code in some situations
(see issue for details). Fix all that.

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

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

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

Fixes #15167

Change-Id: I516369507867358ba1b66aabe00a17a7b477016e
Reviewed-on: https://go-review.googlesource.com/21645
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agoruntime/testdata/testprogcgo: fix Windows C compiler warning
Brad Fitzpatrick [Tue, 10 May 2016 22:32:00 +0000 (15:32 -0700)]
runtime/testdata/testprogcgo: fix Windows C compiler warning

Noticed and fix by Alex Brainman.

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

Fixes #15623

Change-Id: Ic19999fce8bb8640d963965cc328574efadd7855
Reviewed-on: https://go-review.googlesource.com/23010
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
8 years agoos/user: don't create C function mygetgrouplist
Ian Lance Taylor [Tue, 10 May 2016 21:27:32 +0000 (14:27 -0700)]
os/user: don't create C function mygetgrouplist

Instead of exporting the C function mygetgrouplist as a global symbol to
conflict with other symbols of the same name, use trivial Go code and a
static C function.

Change-Id: I98dd667814d0a0ed8f7b1d4cfc6483d5a6965b26
Reviewed-on: https://go-review.googlesource.com/23008
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agodoc: remove mention of %HOME% from installation instructions
Andrew Gerrand [Tue, 10 May 2016 18:48:48 +0000 (11:48 -0700)]
doc: remove mention of %HOME% from installation instructions

Fixes #15598

Change-Id: I4cfb8799dab0e9e34cae2e61839911fd65e4cfa3
Reviewed-on: https://go-review.googlesource.com/23004
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agonet/http: update bundled x/net/http2
Brad Fitzpatrick [Tue, 10 May 2016 16:46:39 +0000 (09:46 -0700)]
net/http: update bundled x/net/http2

Updates x/net/http2 to git rev 96dbb961 for golang.org/cl/23002

Fixes #15366
Updates #15134 (server part remains)

Change-Id: I29336e624706f906b754da66381a620ae3293c6c
Reviewed-on: https://go-review.googlesource.com/23003
Reviewed-by: Andrew Gerrand <adg@golang.org>
Run-TryBot: Andrew Gerrand <adg@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

8 years agocrypto/sha1: disable crashing AVX2 optimizations for now
Brad Fitzpatrick [Tue, 10 May 2016 16:24:57 +0000 (09:24 -0700)]
crypto/sha1: disable crashing AVX2 optimizations for now

Updates #15617

Change-Id: I2104776f8e789d987b4f2f7f08f2ebe979b747a1
Reviewed-on: https://go-review.googlesource.com/23001
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
Reviewed-by: Minux Ma <minux@golang.org>
8 years agotest: add test for unlowered ITab
Keith Randall [Tue, 10 May 2016 16:10:43 +0000 (09:10 -0700)]
test: add test for unlowered ITab

See #15604.  This was a bug in a CL that has since been
rolled back.  Adding a test to challenge the next attempter.

Change-Id: Ic43be254ea6eaab0071018cdc61d9b1c21f19cbf
Reviewed-on: https://go-review.googlesource.com/23000
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
8 years agonet: use contexts for cgo-based DNS resolution
Scott Bell [Mon, 9 May 2016 01:17:59 +0000 (18:17 -0700)]
net: use contexts for cgo-based DNS resolution

Although calls to getaddrinfo can't be portably interrupted,
we still benefit from more granular resource management by
pushing the context downwards.

Fixes #15321

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

8 years agoreflect: make Field panic when out of bounds, as documented
Emmanuel Odeke [Tue, 10 May 2016 14:06:47 +0000 (07:06 -0700)]
reflect: make Field panic when out of bounds, as documented

Fixes #15046.

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

8 years agogo/internal/gccgoimporter: remove workaround on Plan 9
David du Colombier [Tue, 10 May 2016 05:50:09 +0000 (07:50 +0200)]
go/internal/gccgoimporter: remove workaround on Plan 9

We fixed the implementation of the pread syscall in
the Plan 9 kernel, so calling pread doesn't update the
channel offset when reading a file.

Fixes #11194.

Change-Id: Ie4019e445542a73479728af861a50bb54caea3f6
Reviewed-on: https://go-review.googlesource.com/22245
Reviewed-by: Minux Ma <minux@golang.org>
Run-TryBot: David du Colombier <0intro@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

8 years agoos: enable TestGetppid on Plan 9
David du Colombier [Mon, 18 Apr 2016 01:18:13 +0000 (03:18 +0200)]
os: enable TestGetppid on Plan 9

Fixes #8206.

Change-Id: Iec1026ecc586495f5c9562cc84b3240c71d53da5
Reviewed-on: https://go-review.googlesource.com/22164
Run-TryBot: David du Colombier <0intro@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agoos: add TestReadAtOffset
David du Colombier [Tue, 19 Apr 2016 18:59:03 +0000 (20:59 +0200)]
os: add TestReadAtOffset

In the Plan 9 kernel, there used to be a bug in the implementation of
the pread syscall, where the channel offset was erroneously updated after
calling pread on a file.

This test verifies that ReadAt is behaving as expected.

Fixes #14534.

Change-Id: Ifc9fd40a1f94879ee7eb09b2ffc369aa2bec2926
Reviewed-on: https://go-review.googlesource.com/22244
Run-TryBot: David du Colombier <0intro@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

8 years agoencoding/json: support maps with integer keys
Caleb Spare [Wed, 13 Apr 2016 23:51:25 +0000 (16:51 -0700)]
encoding/json: support maps with integer keys

This change makes encoding and decoding support integer types in map
keys, converting to/from JSON string keys.

JSON object keys are still sorted lexically, even though the keys may be
integer strings.

For backwards-compatibility, the existing Text(Un)Marshaler support for
map keys (added in CL 20356) does not take precedence over the default
encoding for string types. There is no such concern for integer types,
so integer map key encoding is only used as a fallback if the map key
type is not a Text(Un)Marshaler.

Fixes #12529.

Change-Id: I7e68c34f9cd19704b1d233a9862da15fabf0908a
Reviewed-on: https://go-review.googlesource.com/22060
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agocrypto/cipher: execute AES-GCM decryption example
Tilman Dilo [Mon, 9 May 2016 21:37:07 +0000 (23:37 +0200)]
crypto/cipher: execute AES-GCM decryption example

The decryption example for AES-GCM was not executed, hiding the fact
that the provided ciphertext could not be authenticated.

This commit adds the required output comment, replaces the ciphertext
with a working example, and removes an unnecessary string conversion
along the way.

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

8 years agotime: don't depend on the io package
Brad Fitzpatrick [Mon, 9 May 2016 17:21:11 +0000 (17:21 +0000)]
time: don't depend on the io package

The time package has never depended on the io package until
a recent change during Go 1.7 to use the io.Seek* constants.

The go/build dependency check didn't catch this because "time" was
allowed to depend on meta package group "L0", which included "io".

Adding the "io" package broke one of Dmitry's tools. The tool is
fixable, but it's also not necessary for us to depend on "io" at all
for some constants. Mirror the constants instead, and change
deps_test.go to prevent an io dependency in the future.

Change-Id: I74325228565279a74fa4a2f419643f5710e3e09f
Reviewed-on: https://go-review.googlesource.com/22960
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
8 years agoos: skip Lchown test on Android if symlink doesn't work
Hana Kim [Mon, 9 May 2016 19:14:07 +0000 (15:14 -0400)]
os: skip Lchown test on Android if symlink doesn't work

After upgrading builder device (android/arm) to android 5.0.2,
the test started failing. Running 'ln -s' from shell fails with
permission error.

Change-Id: I5b9e312806d58532b41ea3560ff079dabbc6424e
Reviewed-on: https://go-review.googlesource.com/22962
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agoruntime: fix some out of date comments in bitmap code
Austin Clements [Mon, 9 May 2016 19:03:15 +0000 (15:03 -0400)]
runtime: fix some out of date comments in bitmap code

Change-Id: I4613aa6d62baba01686bbab10738a7de23daae30
Reviewed-on: https://go-review.googlesource.com/22971
Reviewed-by: Rick Hudson <rlh@golang.org>
8 years agocompress: update documentation regarding footer verification
Joe Tsai [Mon, 28 Mar 2016 09:29:18 +0000 (02:29 -0700)]
compress: update documentation regarding footer verification

Address two documentation issues:
1) Document that the GZIP and ZLIB footer is only verified when the
reader has been fully consumed.
2) The zlib reader is guaranteed to not read past the EOF if the
input io.Reader is also a io.ByteReader. This functionality was
documented in the flate and gzip packages but not on zlib.

Fixes #14867

Change-Id: I43d46b93e38f98a04901dc7d4f18ed2f9e09f6fb
Reviewed-on: https://go-review.googlesource.com/21218
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agocmd/compile: document -l in godoc
Shenghou Ma [Mon, 9 May 2016 02:31:09 +0000 (22:31 -0400)]
cmd/compile: document -l in godoc

Fixes #15607.

Change-Id: I3e68ad00ebe72027d064238d4e77f1ad6a52f533
Reviewed-on: https://go-review.googlesource.com/22940
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agocmd/compile: correct sparseSet probes in regalloc to avoid index error
David Chase [Sat, 7 May 2016 00:05:02 +0000 (17:05 -0700)]
cmd/compile: correct sparseSet probes in regalloc to avoid index error

In regalloc, a sparse map is preallocated for later use by
spill-in-loop sinking.  However, variables (spills) are added
during register allocation before spill sinking, and a map
query involving any of these new variables will index out of
bounds in the map.

To fix:
1) fix the queries to use s.orig[v.ID].ID instead, to ensure
proper indexing.  Note that s.orig will be nil for values
that are not eligible for spilling (like memory and flags).

2) add a test.

Fixes #15585.

Change-Id: I8f2caa93b132a0f2a9161d2178320d5550583075
Reviewed-on: https://go-review.googlesource.com/22911
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

8 years agodoc: update number of supported instruction sets
Mikhail Gusarov [Mon, 9 May 2016 17:28:28 +0000 (19:28 +0200)]
doc: update number of supported instruction sets

Current  number was out-of-date since adding MIPS.

Change-Id: I565342a92de3893b75cdfb76fa39f7fdf15672da
Reviewed-on: https://go-review.googlesource.com/22952
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
8 years agocmd/compile: add -linkobj flag to allow writing object file in two parts
Russ Cox [Wed, 27 Apr 2016 01:50:59 +0000 (21:50 -0400)]
cmd/compile: add -linkobj flag to allow writing object file in two parts

This flag is experimental and the semantics may change
even after Go 1.7 is released. There are no changes to code
not using the flag.

The first part is for reading by future compiles.
The second part is for reading by the final link step.
Splitting the file this way allows distributed build systems
to ship the compile-input part only to compile steps and
the linker-input part only to linker steps.

The first part is basically just the export data,
and the second part is basically everything else.
The overall files still have the same broad structure,
so that existing tools will work with both halves.
It's just that various pieces are empty in the two halves.

This also copies the two bits of data the linker needed from
export data into the object header proper, so that the linker
doesn't need any export data at all. That eliminates a TODO
that was left for switching to the binary export data.
(Now the linker doesn't need to know about the switch.)

The default is still to write out a combined output file.
Nothing changes unless you pass -linkobj to the compiler.
There is no support in the go command for -linkobj,
since the go command doesn't copy objects around.
The expectation is that other build systems (like bazel, say)
might take advantage of this.

The header adjustment and the option for the split output
was intended as part of the zip archives, but the zip archives
have been cut from Go 1.7. Doing this to the current archives
both unblocks one step in the switch to binary export data
and enables alternate build systems to experiment with the
new flag using the Go 1.7 release.

Change-Id: I8b6eab25b8a22b0a266ba0ac6d31e594f3d117f3
Reviewed-on: https://go-review.googlesource.com/22500
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
9 years agoruntime/race: deflake test
Dmitry Vyukov [Mon, 9 May 2016 13:11:24 +0000 (15:11 +0200)]
runtime/race: deflake test

The test sometimes fails on builders.
The test uses sleeps to establish the necessary goroutine
execution order. If sleeps undersleep/oversleep
the race is still reported, but it can be reported when the
main test goroutine returns. In such case test driver
can't match the race with the test and reports failure.

Wait for both test goroutines to ensure that the race
is reported in the test scope.

Fixes #15579

Change-Id: I0b9bec0ebfb0c127d83eb5325a7fe19ef9545050
Reviewed-on: https://go-review.googlesource.com/22951
Run-TryBot: Dmitry Vyukov <dvyukov@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
9 years agocmd/compile: fix binary export of composite literals with implicit types
Robert Griesemer [Mon, 9 May 2016 03:59:53 +0000 (20:59 -0700)]
cmd/compile: fix binary export of composite literals with implicit types

Also:
- replaced remaining panics with Fatal calls
- more comments

Fixes #15572.

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