]> Cypherpunks.ru repositories - gostls13.git/log
gostls13.git
6 years agolib/time: update tzdata to 2017c
Tobias Klauser [Sat, 28 Oct 2017 18:07:51 +0000 (20:07 +0200)]
lib/time: update tzdata to 2017c

Update the tzdata database to version 2017c (released 2017-10-20).

Updates #22487

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

6 years agomisc/cgo/testplugin: unskip test
Russ Cox [Tue, 7 Nov 2017 14:56:11 +0000 (09:56 -0500)]
misc/cgo/testplugin: unskip test

Fixed by CL 76025 yesterday, without realizing it:
the testshared and testplugin builds of separate iface_i
packages were colliding incorrectly in the cache.
Including the build directory fixes that.

Fixes #22571.

Change-Id: Id8193781c67c3150823dc1f48eae781dfe3702fb
Reviewed-on: https://go-review.googlesource.com/76371
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
6 years agocmd/go: implement time-based trimming of build cache
Russ Cox [Tue, 5 Dec 2017 15:29:27 +0000 (10:29 -0500)]
cmd/go: implement time-based trimming of build cache

Fixes #22642.

Change-Id: I2ed6305555a0cf753b9cdce061463b1749d5e53e
Reviewed-on: https://go-review.googlesource.com/81975
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years agodoc/go1.10: preannounce removal of OS X 10.8 support in Go 1.11
Russ Cox [Wed, 6 Dec 2017 18:38:10 +0000 (13:38 -0500)]
doc/go1.10: preannounce removal of OS X 10.8 support in Go 1.11

For #23011.

Change-Id: Ibd934f32e41cb8dddbd3d68a324536cf29a97916
Reviewed-on: https://go-review.googlesource.com/82275
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agodoc: fix two spelling mistakes in contribute.html
Alberto Donizetti [Wed, 6 Dec 2017 09:59:40 +0000 (10:59 +0100)]
doc: fix two spelling mistakes in contribute.html

Change-Id: Ife60468d508f90321733ebdbdb0e6cf443ba1659
Reviewed-on: https://go-review.googlesource.com/82156
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years agodoc: fix dead link in go_faq
Alberto Donizetti [Wed, 6 Dec 2017 10:42:42 +0000 (11:42 +0100)]
doc: fix dead link in go_faq

Change-Id: I8a9e4d00247fe9bda6e19551850bdec0367df2e1
Reviewed-on: https://go-review.googlesource.com/82157
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years agodoc/go1.10: fix many TODOs
Russ Cox [Wed, 6 Dec 2017 05:01:26 +0000 (00:01 -0500)]
doc/go1.10: fix many TODOs

Change-Id: I97a28379b1a9ca3daa875edbcd5213673ca138d0
Reviewed-on: https://go-review.googlesource.com/82115
Reviewed-by: Russ Cox <rsc@golang.org>
6 years agodoc/go1.10: process comments from CL 78131 PS 5
Russ Cox [Wed, 6 Dec 2017 04:36:53 +0000 (23:36 -0500)]
doc/go1.10: process comments from CL 78131 PS 5

Change-Id: Ie246756452cd872961aeb659b35297c229504a3c
Reviewed-on: https://go-review.googlesource.com/81936
Reviewed-by: Russ Cox <rsc@golang.org>
6 years agodoc/go1.10: update release notes for recent commits
Russ Cox [Wed, 6 Dec 2017 03:20:46 +0000 (22:20 -0500)]
doc/go1.10: update release notes for recent commits

Change-Id: Id6ced9a6c76131263041cdaf5ed17479be075fa6
Reviewed-on: https://go-review.googlesource.com/82075
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
6 years agodoc: fix spelling in editor guide
Tobias Klauser [Wed, 6 Dec 2017 15:15:08 +0000 (16:15 +0100)]
doc: fix spelling in editor guide

Change-Id: If16f069f410d043fd11864a4c1a7d54b5b4922d2
Reviewed-on: https://go-review.googlesource.com/82200
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years agohash: add MarshalBinary/UnmarshalBinary round trip + golden test for all implementations
Russ Cox [Wed, 6 Dec 2017 07:17:24 +0000 (02:17 -0500)]
hash: add MarshalBinary/UnmarshalBinary round trip + golden test for all implementations

There are some basic tests in the packages implementing the hashes,
but this one is meant to be comprehensive for the standard library
as a whole.

Most importantly, it locks in the current representations and makes
sure that they do not change from release to release (and also, as a
result, that future releases can parse the representations generated
by older releases).

The crypto/* MarshalBinary implementations are being changed
in this CL to write only d.x[:d.nx] to the encoding, with zeros for
the remainder of the slice d.x[d.nx:]. The old encoding wrote the
whole d.x, but that exposed an internal detail: whether d.x is
cleared after a full buffer is accumulated, and also whether d.x was
used at all for previous blocks (consider 1-byte writes vs 1024-byte writes).
The new encoding writes only what the decoder needs to know,
nothing more.

In fact the old encodings were arguably also a security hole,
because they exposed data written even before the most recent
call to the Reset method, data that clearly has no impact on the
current hash and clearly should not be exposed. The leakage
is clearly visible in the old crypto/sha1 golden test tables also
being modified in this CL.

Change-Id: I4e9193a3ec5f91d27ce7d0aa24c19b3923741416
Reviewed-on: https://go-review.googlesource.com/82136
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
6 years agocrypto/x509/pkix: remove references to fmt.Stringer in String method docs
Russ Cox [Wed, 6 Dec 2017 02:53:30 +0000 (21:53 -0500)]
crypto/x509/pkix: remove references to fmt.Stringer in String method docs

String method comments should explain what they do,
not that they are attempting to implement fmt.Stringer.

Change-Id: If51dd1ff2f0c2f9ef9dca569bfa0c3914be2e8fe
Reviewed-on: https://go-review.googlesource.com/82081
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agodatabase/sql/driver: explain Driver vs DriverContext vs Connector
Russ Cox [Wed, 6 Dec 2017 03:12:52 +0000 (22:12 -0500)]
database/sql/driver: explain Driver vs DriverContext vs Connector

The docs make it seem like they are all things a single object
would implement. That's true of Driver and DriverContext,
but Connector is really something else. Attempt to clarify.

Change-Id: I8fdf1cff855a0fbe37ea22720c082045c719a267
Reviewed-on: https://go-review.googlesource.com/82082
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Daniel Theophanes <kardianos@gmail.com>
6 years agoflag: clarify comment to avoid shell syntax confusion
Ian Lance Taylor [Tue, 5 Dec 2017 21:24:45 +0000 (13:24 -0800)]
flag: clarify comment to avoid shell syntax confusion

Updates #22961

Change-Id: Ib2f41aefb4f6470598d8637611da5491156ea840
Reviewed-on: https://go-review.googlesource.com/82015
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agocrypto/x509: add test for asn1.Marshal of rsa.PublicKey
Russ Cox [Wed, 6 Dec 2017 02:26:07 +0000 (21:26 -0500)]
crypto/x509: add test for asn1.Marshal of rsa.PublicKey

Go 1.10 is adding new API MarshalPKCS1PublicKey and
ParsePKCS1PublicKey for converting rsa.PublicKeys.

Even though we'd prefer that users did not, check that
if users call asn1.Marshal and asn1.Unmarshal directly instead,
they get the same results. We know that code exists in the
wild that depends on this.

Change-Id: Ia385d6954fda2eba7da228dc42f229b6839ef11e
Reviewed-on: https://go-review.googlesource.com/82080
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agoencoding/pem: change Encode, EncodeToMemory not to generate partial PEM blocks
Russ Cox [Tue, 5 Dec 2017 19:38:50 +0000 (14:38 -0500)]
encoding/pem: change Encode, EncodeToMemory not to generate partial PEM blocks

Originally these routines could not fail except by
returning errors from the underlying writer.

Then we realized that header keys containing colons
needed to be rejected, and we started returning an error
from Encode. But that only happens after writing a
partial PEM block to the underlying writer, which is
unfortunate, but at least it was undocumented.

CL 77790 then documented this unfortunate behavior.

Instead of documenting unfortunate behavior, fix it.

Change-Id: Ic7467a576c4cecd16a99138571a1269cc4f96204
Reviewed-on: https://go-review.googlesource.com/82076
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agonet/url: fix PathUnescape, QueryUnescape number grammar
Russ Cox [Wed, 6 Dec 2017 01:40:26 +0000 (20:40 -0500)]
net/url: fix PathUnescape, QueryUnescape number grammar

They do not convert a plural into a singular.
(Introduced recently, in CL 77050.)

Change-Id: I3b6c4d03b1866d4133e90b8ab05e8d4bfbd55125
Reviewed-on: https://go-review.googlesource.com/82078
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agotime: condense, expand Time.Unix example
Russ Cox [Wed, 6 Dec 2017 02:05:52 +0000 (21:05 -0500)]
time: condense, expand Time.Unix example

The new example is shorter but illustrates the
interesting parts of the Unix function and methods.

Change-Id: Ief8ec38909d4ed7829e8d3da58e7b7f712537f99
Reviewed-on: https://go-review.googlesource.com/82079
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agonet/http: keep testing DetectContentType of empty body
Russ Cox [Wed, 6 Dec 2017 01:20:56 +0000 (20:20 -0500)]
net/http: keep testing DetectContentType of empty body

Historically, DetectContentType has returned "text/plain; charset=utf-8"
for an empty body, there was a test for this, and there should continue
to be one.

CL 46631 changed the content-serving handlers to avoid setting any
Content-Type header when serving empty content. Even if that change
in behavior is correct, the CL is explicitly not changing DetectContentType,
so it must also not change DetectContentType's tests.

Change-Id: I7a19c9fabb43be47e349b40e729e49fceb3f2894
Reviewed-on: https://go-review.googlesource.com/82077
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agoencoding/csv: truncate carriage returns at EOF
Joe Tsai [Fri, 1 Dec 2017 19:41:46 +0000 (11:41 -0800)]
encoding/csv: truncate carriage returns at EOF

This fixes a regression where only CRLF was folded into LF at EOF.
Now, we also truncate trailing CR at EOF to preserve the old behavior.

Every one of the test cases added exactly matches the behavior
of Go1.9, even if the results are somewhat unexpected.

Fixes #22937

Change-Id: I1bc6550533163ae489ea77ec1e598163267b7eec
Reviewed-on: https://go-review.googlesource.com/81577
Run-TryBot: Joe Tsai <thebrokentoaster@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agonet: return io.ErrClosedPipe when possible from net.Pipe
Joe Tsai [Mon, 4 Dec 2017 19:16:51 +0000 (11:16 -0800)]
net: return io.ErrClosedPipe when possible from net.Pipe

The previous implementation of net.Pipe was just a thin wrapper around
io.Pipe and did not wrap any of the io.Pipe errors as net.Errors.
As a result of Hyrum's law, users have come to depend on the fact that
net.Pipe returns io.ErrClosedPipe when the pipe is closed.
Thus, we preserve this behavior to avoid regressing such use cases.

Change-Id: I06b387877b944c1c08527601f58983872b7557b4
Reviewed-on: https://go-review.googlesource.com/81777
Run-TryBot: Joe Tsai <thebrokentoaster@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years agocmd/dist: disable test caching during run.bash
Russ Cox [Wed, 29 Nov 2017 19:16:25 +0000 (14:16 -0500)]
cmd/dist: disable test caching during run.bash

Sometimes people use run.bash repeatedly
or run go tool dist test by hand for cgo tests.
Avoid test caching in that case, by request.

Refactor code so that all go test commands
share a common prefix.

If not caching is problematic it will be a one-line
change to turn caching back on.

Fixes #22758.

Change-Id: I17d721b832d97bffe26629d21f85b05dbbf2b3ec
Reviewed-on: https://go-review.googlesource.com/80735
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years agonet/http: fix unclosed Listener leak in ListenAndServeTLS
Tim Heckman [Tue, 5 Dec 2017 17:21:25 +0000 (09:21 -0800)]
net/http: fix unclosed Listener leak in ListenAndServeTLS

Fixes #23002

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

6 years agoencoding/asn1: allow '&' in PrintableString fields
christopher-henderson [Fri, 1 Dec 2017 23:17:16 +0000 (16:17 -0700)]
encoding/asn1: allow '&' in PrintableString fields

There are, unfortunately, intermediate CA ceritificates in circulation
that contain the invalid character '&' in some PrintableString fields,
notably Organization Name. This patch allows for ampersand
to be parsed as though it is valid in an ASN.1 PrintableString.

Fixes #22970

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

6 years agodatabase/sql: fix transaction leak
kirk [Mon, 4 Dec 2017 02:53:53 +0000 (10:53 +0800)]
database/sql: fix transaction leak

When the user context which passed in (*DB)BeginTx is canceled or
timeout, the current implementation could cause db transaction leak
in some extreme scenario.

Goroutine 1:
        Call (*DB) BeginTx begins a transaction with a userContext.
        In (*DB)BeginTx, a new goroutine (*Tx)awaitDone
        which monitor context and rollback tx if needed will be created

Goroutine 2(awaitDone):
        block on tx.ctx.Done()

Goroutine 1:
        Execute some insert or update sqls on the database

Goroutine 1:
        Commit the transaction, (*Tx)Commit set
        the atomic variable tx.done to 1

Goroutine 3(maybe global timer):
        Cancel userContext which be passed in Tx

Goroutine 1:
        (*Tx)Commit checks tx.ctx.Done().
        Due to the context has been canceled, it will return
        context.Canceled or context.DeadlineExceeded error immediately
        and abort the real COMMIT operation of transaction

Goroutine 2:
        Release with tx.ctx.Done() signal, execute (*Tx)rollback.
        However the atomic variable tx.done is 1 currently,
        it will return ErrTxDone error immediately and
        abort the real ROLLBACK operation of transaction

Fixes #22976

Change-Id: I3bc23adf25db823861d91e33d3cca6189fb1171d
Reviewed-on: https://go-review.googlesource.com/81736
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Daniel Theophanes <kardianos@gmail.com>
6 years agocmd/compile: fix map assignment with panicking right-hand side
Keith Randall [Mon, 4 Dec 2017 22:47:32 +0000 (14:47 -0800)]
cmd/compile: fix map assignment with panicking right-hand side

Make sure that when we're assigning to a map, we evaluate the
right-hand side before we attempt to insert into the map.

We used to evaluate the left-hand side to a pointer-to-slot-in-bucket
(which as a side effect does len(m)++), then evaluate the right-hand side,
then do the assignment. That clearly isn't correct when the right-hand side
might panic.

Fixes #22881

Change-Id: I42a62870ff4bf480568c9bdbf0bb18958962bdf0
Reviewed-on: https://go-review.googlesource.com/81817
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
6 years agoruntime: fix NetBSD CPU spin in lwp_park when CPU profiling is active
Christos Zoulas [Mon, 4 Dec 2017 23:50:19 +0000 (23:50 +0000)]
runtime: fix NetBSD CPU spin in lwp_park when CPU profiling is active

Fixes #22981

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

6 years agocmd/compile: fix noopt builder, weird append case
Keith Randall [Mon, 4 Dec 2017 21:30:13 +0000 (13:30 -0800)]
cmd/compile: fix noopt builder, weird append case

Turn off append-to-itself optimization if optimizations are turned off.

This optimization triggered a bug when doing
  s = append(s, s)
where we write to the leftmost s before reading the rightmost s.

Update #17039

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

6 years agocmd/go: disable concurrent compilation under GOEXPERIMENTs
Matthew Dempsky [Mon, 4 Dec 2017 19:09:45 +0000 (11:09 -0800)]
cmd/go: disable concurrent compilation under GOEXPERIMENTs

Duplicate cmd/compile check into cmd/go. Manually tested that
"GOEXPERIMENT=fieldtrack make.bash" passes now.

Updates #22223.

Change-Id: I441970a8a5ad4aadf5bd4fbd4d6cc71847b43308
Reviewed-on: https://go-review.googlesource.com/81776
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agotest: disable broken test for 1.10
Matthew Dempsky [Mon, 4 Dec 2017 18:59:39 +0000 (10:59 -0800)]
test: disable broken test for 1.10

This test was added recently as a regress test for the spec relaxation
in #9060, but doesn't work correctly yet. Disable for now to fix noopt
builders.

Updates #22444.

Change-Id: I45c521ae0da7ffb0c6859d6f7220c59828ac6149
Reviewed-on: https://go-review.googlesource.com/81775
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agocmd/compile: fix bug in DWARF inl handling of unused autos
Than McIntosh [Fri, 1 Dec 2017 20:23:30 +0000 (15:23 -0500)]
cmd/compile: fix bug in DWARF inl handling of unused autos

The DWARF inline info generation hooks weren't properly
handling unused auto vars in certain cases, triggering an assert (now
fixed). Also with this change, introduce a new autom "flavor" to
use for autom entries that are added to insure that a specific
auto type makes it into the linker (this is a follow-on to the fix
for 22941).

Fixes #22962.

Change-Id: I7a2d8caf47f6ca897b12acb6a6de0eb25f5cac8f
Reviewed-on: https://go-review.googlesource.com/81557
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
6 years agomisc/ios: dump logs for failing lldb sessions to stdout
Elias Naur [Tue, 7 Nov 2017 12:04:22 +0000 (13:04 +0100)]
misc/ios: dump logs for failing lldb sessions to stdout

The iOS test harness dumps the output of its lldb session to stdout,
but only if the lldb session was successfully started.
Make sure the log is always dumpede, so that lldb startup failures
such as

lldb setup error: exited (lldb start: exit status 253)

can be diagnosed.

For the iOS builders.

Change-Id: Ie0e3341dd8f84a88d26509c34816668d3ebbfaa0
Reviewed-on: https://go-review.googlesource.com/76195
Run-TryBot: Elias Naur <elias.naur@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
6 years agocmd/go: disable tests when GOOS/GOARCH != GOHOSTARCH/GOHOSTARCH
Russ Cox [Fri, 1 Dec 2017 20:53:06 +0000 (15:53 -0500)]
cmd/go: disable tests when GOOS/GOARCH != GOHOSTARCH/GOHOSTARCH

The whole GOROOT/pkg tree is installed using the GOHOSTOS/GOHOSTARCH
toolchain (installed in GOROOT/pkg/tool/GOHOSTOS_GOHOSTARCH).
The testgo.exe we run during the cmd/go test will be built
for GOOS/GOARCH, which means it will use the GOOS/GOARCH toolchain
(installed in GOROOT/pkg/tool/GOOS_GOARCH).

If these are not the same toolchain, then the entire standard library
will look out of date to testgo.exe (the compilers in those two different
tool directories are built for different architectures and have different
buid IDs), which will cause many tests to do unnecessary rebuilds
and some tests to attempt to overwrite the installed standard library,
which will in turn make it look out of date to whatever runs after the
cmd/go test exits.

Bail out entirely in this case instead of destroying the world.

The changes outside TestMain are checks that might have caught
this a bit earlier and made it much less confusing to debug.

Fixes #22709.
Fixes #22965.

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

6 years agocmd/go: fix -covermode=atomic use of sync/atomic in -coverpkg matches
Russ Cox [Fri, 1 Dec 2017 16:42:48 +0000 (11:42 -0500)]
cmd/go: fix -covermode=atomic use of sync/atomic in -coverpkg matches

If we're using -covermode=atomic with -coverpkg, to add coverage
to more than just the package being tested, then we need to make sure
to make sync/atomic available to the compiler for every package
being recompiled for coverage.

Fixes #22728.

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

6 years agoruntime: make NetBSD lwp_park use monotonic time
Christos Zoulas [Mon, 4 Dec 2017 01:48:45 +0000 (01:48 +0000)]
runtime: make NetBSD lwp_park use monotonic time

This change updates runtime.semasleep to no longer call
runtime.nanotime and instead calls lwp_park with a duration to sleep
relative to the monotonic clock, so the nanotime is never called.
(This requires updating to a newer version of the lwp_park system
call, which is safe, because Go 1.10 will require the unreleased
NetBSD 8+ anyway)

Additionally, this change makes the nanotime function use the
monotonic clock for netbsd/arm, which was forgotten from
https://golang.org/cl/81135 which updated netbsd/amd64 and netbsd/386.

Because semasleep previously depended on nanotime, the past few days
of netbsd have likely been unstable because lwp_park was then mixing
the monotonic and wall clocks. After this CL, lwp_park no longer
depends on nanotime.

Original patch submitted at:
https://www.netbsd.org/~christos/go-lwp-park-clock-monotonic.diff

This commit message (any any mistakes therein) were written by Brad
Fitzpatrick. (Brad migrated the patch to Gerrit and checked CLAs)

Updates #6007
Fixes #22968

Also updates netbsd/arm to use monotonic time for

Change-Id: If77ef7dc610b3025831d84cdfadfbbba2c52acb2
Reviewed-on: https://go-review.googlesource.com/81715
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agoos: clarify docs on Interrupt and Kill
Brad Fitzpatrick [Thu, 30 Nov 2017 16:36:34 +0000 (16:36 +0000)]
os: clarify docs on Interrupt and Kill

Note that Interrupt will compile but not work on Windows.

Fixes #22454

Change-Id: If011c32211f4bb45d458317e113b9794d5b4a4b1
Reviewed-on: https://go-review.googlesource.com/81035
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years agoos: calling Fd disables the SetDeadline methods
Ian Lance Taylor [Sat, 2 Dec 2017 00:55:46 +0000 (16:55 -0800)]
os: calling Fd disables the SetDeadline methods

The full truth seems too complicated to write in this method's doc, so
I'm going with a simple half truth.

The full truth is that Fd returns the descriptor in blocking mode,
because that is historically how it worked, and existing programs
would be surprised if the descriptor is suddenly non-blocking. On Unix
systems whether a file is non-blocking or not is a property of the
underlying file description, not of a particular file descriptor, so
changing the returned descriptor to blocking mode also changes the
existing File to blocking mode. Blocking mode works fine, althoug I/O
operations now take up a thread. SetDeadline and friends rely on the
runtime poller, and the runtime poller only works if the descriptor is
non-blocking. So it's correct that calling Fd disables SetDeadline.
The other half of the truth is that if the program is willing to work
with a non-blocking descriptor, it could call
syscall.SetNonblock(descriptor, true) to change the descriptor, and
the original File, to non-blocking mode. At that point SetDeadline
would start working again. I tried to write that in a way that is
short and comprehensible but failed. Since deadlines mostly work on
pipes, and there isn't much reason to call Fd on a pipe, and few
people use SetDeadline, I decided to punt.

Fixes #22934

Change-Id: I2e49e036f0bcf71f5365193831696f9e4120527c
Reviewed-on: https://go-review.googlesource.com/81636
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agocmd/cgo: for C bitfields use only valid Go integer types
Ian Lance Taylor [Fri, 1 Dec 2017 14:57:37 +0000 (06:57 -0800)]
cmd/cgo: for C bitfields use only valid Go integer types

Fixes #22958

Change-Id: Ib078a5f6e1105a2afca77c6d9a05f65ddf5d9010
Reviewed-on: https://go-review.googlesource.com/81435
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
6 years agonet/url: document Parse more
Brad Fitzpatrick [Fri, 1 Dec 2017 17:00:58 +0000 (17:00 +0000)]
net/url: document Parse more

That Parse doesn't parse ("foo.com/path" or "foo.com:443/path") has
become something of a FAQ.

Updates #19779
Updates #21415
Updates #22955

Change-Id: Ib68efddb67f59b1374e8ed94effd4a326988dee7
Reviewed-on: https://go-review.googlesource.com/81436
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years agogo/types: don't use directory foo which might exist under GOPATH
Robert Griesemer [Fri, 1 Dec 2017 21:24:20 +0000 (13:24 -0800)]
go/types: don't use directory foo which might exist under GOPATH

Simply choose an extremely unlikely path name in the test is fine.

Fixes #21013.

Change-Id: I56c0a1986b5ef5d618c7fe2b14701f584fe81c37
Reviewed-on: https://go-review.googlesource.com/81578
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

6 years agoruntime: use MAP_ANON in sigstack check
Austin Clements [Fri, 1 Dec 2017 21:21:03 +0000 (16:21 -0500)]
runtime: use MAP_ANON in sigstack check

MAP_ANON is the deprecated but more portable spelling of
MAP_ANONYMOUS. Use MAP_ANON to un-break the Darwin 10.10 builder.

Updates #22930.

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

6 years agonet/http: speed up and deflake TestServerKeepAlivesEnabled_h2
Brad Fitzpatrick [Fri, 1 Dec 2017 19:42:55 +0000 (19:42 +0000)]
net/http: speed up and deflake TestServerKeepAlivesEnabled_h2

Fixes #21724

Change-Id: I92571bf228781b17fdf012a2fb52a597c877cefe
Reviewed-on: https://go-review.googlesource.com/81576
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Tom Bergan <tombergan@google.com>
6 years agocmd/go: honor -timeout=0 to mean no timeout
Russ Cox [Fri, 1 Dec 2017 16:57:57 +0000 (11:57 -0500)]
cmd/go: honor -timeout=0 to mean no timeout

The test binaries accept -timeout=0 to mean no timeout,
but then the backup timer in cmd/go kills the test after 1 minute.
Make cmd/go understand this special case and change
behavior accordingly.

Fixes #14780.

Change-Id: I66bf517173a4ad21d53a5ee88d163f04b8929fb6
Reviewed-on: https://go-review.googlesource.com/81499
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agocmd/test2json: add ability to run test binary
Russ Cox [Fri, 1 Dec 2017 18:54:15 +0000 (13:54 -0500)]
cmd/test2json: add ability to run test binary

Also be clear that go test output is not suitable for piping into test2json.

Fixes #22710.
Fixes #22789.

Change-Id: I3d850c8a2288be7f9a27d638bbf847cb8707dcce
Reviewed-on: https://go-review.googlesource.com/81555
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years agocmd/go: fix missing conversions in -json output
Russ Cox [Fri, 1 Dec 2017 18:42:53 +0000 (13:42 -0500)]
cmd/go: fix missing conversions in -json output

1. Apply JSON conversion when -bench is in use.
2. Apply JSON conversion to "no test files" result.
3. Apply JSON conversion to test case-ending SKIP status.

Fixes #22769.
Fixes #22790.

Change-Id: I67ad656fc58bacae8c51d23b1e6d543cad190f08
Reviewed-on: https://go-review.googlesource.com/81535
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years agocmd/go: fix reuse of cached objects during cover
Russ Cox [Fri, 1 Dec 2017 18:19:39 +0000 (13:19 -0500)]
cmd/go: fix reuse of cached objects during cover

The cover variable indices could vary from build to build,
but they were not included in the build ID hash, so that
reusing the previously built package was not safe.
Make the indices no longer vary from build to build,
so that caching is safe.

Fixes #22652.

Change-Id: Ie26d73c648aadd285f97e0bf39619cabc3da54f2
Reviewed-on: https://go-review.googlesource.com/81515
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years agocmd/go: ignore vet typecheck failure during go test
Russ Cox [Fri, 1 Dec 2017 17:17:37 +0000 (12:17 -0500)]
cmd/go: ignore vet typecheck failure during go test

For Go 1.10, works around a go/types bug that can't typecheck
a corner-case type cycle. Once we are confident that bugs like
this are gone from go/types then we can stop ignoring these
failures.

For #22890.

Change-Id: I38da57e01a0636323e1af4484c30871786125df3
Reviewed-on: https://go-review.googlesource.com/81500
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years agocmd/go: accept more spaces in -gcflags arguments
Russ Cox [Fri, 1 Dec 2017 16:47:06 +0000 (11:47 -0500)]
cmd/go: accept more spaces in -gcflags arguments

Earlier versions of Go were not very picky about leading spaces
in the -gcflags values. Make the new pattern-enhanced parser
equally lax.

Fixes #22943.

Change-Id: I5cf4d3e81412e895a4b52af325853ed48d0b73f4
Reviewed-on: https://go-review.googlesource.com/81498
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years agoreflect: audit and explain safety of all unsafe.Pointer additions
Russ Cox [Wed, 29 Nov 2017 20:22:13 +0000 (15:22 -0500)]
reflect: audit and explain safety of all unsafe.Pointer additions

It's not safe to do p+x with unsafe if that would point past the
end of the object. (Valid in C, not safe in Go.)
Pass a "whySafe" reason (compiled away) to explain at each
call site why it's safe.

Fixes #21733.

Change-Id: I5da8c25bde66f5c9beac232f2135dcab8e8bf3b1
Reviewed-on: https://go-review.googlesource.com/80738
Reviewed-by: Austin Clements <austin@google.com>
6 years agocmd/trace: exclude threads in syscall on behalf of runtime
Hana Kim [Thu, 30 Nov 2017 23:51:04 +0000 (18:51 -0500)]
cmd/trace: exclude threads in syscall on behalf of runtime

The number of threads in syscall presented by execution tracer's
trace view includes not only the threads calling system calls on behalf
of user created goroutines, but also those running on behalf of system
goroutines.

When the number of such system goroutines was small, the graph was
useful when examining where a program was saturating the CPU.
But as more and more system goroutines are invloved the graph became
less useful for the purpose - for example, after golang.org/cl/34784,
the timer goroutines dominate in the graph with large P
because the runtime creates per-P timer goroutines.

This change excludes the threads in syscall on behalf of runtime (system
goroutines) from the visualization. Alternatively, I could visualize the
count of such threads in a separate counter but in the same graph.
Given that many other debug endpoints (e.g. /debug/pprof/goroutine) hide
the system goroutines, including them in the same graph can confuse users.

Update #22574

Change-Id: If758cd6b9ed0596fde9a471e846b93246580b9d5
Reviewed-on: https://go-review.googlesource.com/81315
Reviewed-by: Austin Clements <austin@google.com>
Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

6 years agoruntime: skip gdb tests earlier before blocking goroutines in a t.Parallel
Brad Fitzpatrick [Fri, 1 Dec 2017 19:26:33 +0000 (19:26 +0000)]
runtime: skip gdb tests earlier before blocking goroutines in a t.Parallel

Minor.

Makes reading failing runtime test stacktraces easier (by having fewer
goroutines to read) on machines where these gdb tests wouldn't have
ever run anyway.

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

6 years agoruntime: even more TestStackGrowth timeout debugging
Austin Clements [Fri, 1 Dec 2017 20:15:42 +0000 (15:15 -0500)]
runtime: even more TestStackGrowth timeout debugging

This adds logging for the expected duration of a growStack, plus
progress information on the growStack that timed out.

Updates #19381.

Change-Id: Ic358f8350f499ff22dd213b658aece7d1aa62675
Reviewed-on: https://go-review.googlesource.com/81556
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agocmd/compile: permit indices of certain non-constant shifts
Robert Griesemer [Thu, 30 Nov 2017 23:47:46 +0000 (15:47 -0800)]
cmd/compile: permit indices of certain non-constant shifts

Per the decision for #14844, index expressions that are non-constant
shifts where the LHS operand is representable as an int are now valid.

Fixes #21693.

Change-Id: Ifafad2c0c65975e0200ce7e28d1db210e0eacd9d
Reviewed-on: https://go-review.googlesource.com/81277
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
6 years agoruntime: improve sigsend documentation
Austin Clements [Thu, 30 Nov 2017 20:47:04 +0000 (15:47 -0500)]
runtime: improve sigsend documentation

I think of "sending" a signal as calling kill, but sigsend is involved
in handling a signal and, specifically delivering it to the internal
signal queue. The term "delivery" is already used in
signalWaitUntilIdle, so this CL also uses it in the documentation for
sigsend.

Change-Id: I86e171f247f525ece884a680bace616fa9a3c7bd
Reviewed-on: https://go-review.googlesource.com/81235
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years agoruntime: restore the Go-allocated signal stack in unminit
Austin Clements [Fri, 1 Dec 2017 03:09:35 +0000 (22:09 -0500)]
runtime: restore the Go-allocated signal stack in unminit

Currently, when we minit on a thread that already has an alternate
signal stack (e.g., because the M was an extram being used for a cgo
callback, or to handle a signal on a C thread, or because the
platform's libc always allocates a signal stack like on Android), we
simply drop the Go-allocated gsignal stack on the floor.

This is a problem for Ms on the extram list because those Ms may later
be reused for a different thread that may not have its own alternate
signal stack. On tip, this manifests as a crash in sigaltstack because
we clear the gsignal stack bounds in unminit and later try to use
those cleared bounds when we re-minit that M. On 1.9 and earlier, we
didn't clear the bounds, so this manifests as running more than one
signal handler on the same signal stack, which could lead to arbitrary
memory corruption.

This CL fixes this problem by saving the Go-allocated gsignal stack in
a new field in the m struct when overwriting it with a system-provided
signal stack, and then restoring the original gsignal stack in
unminit.

This CL is designed to be easy to back-port to 1.9. It won't quite
cherry-pick cleanly, but it should be sufficient to simply ignore the
change in mexit (which didn't exist in 1.9).

Now that we always have a place to stash the original signal stack in
the m struct, there are some simplifications we can make to the signal
stack handling. We'll do those in a later CL.

Fixes #22930.

Change-Id: I55c5a6dd9d97532f131146afdef0b216e1433054
Reviewed-on: https://go-review.googlesource.com/81476
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years agocmd/go: apply same per-package flags to test and xtest builds
Russ Cox [Fri, 1 Dec 2017 16:26:09 +0000 (11:26 -0500)]
cmd/go: apply same per-package flags to test and xtest builds

If package strings has a particular set of gcflags, then the strings_test
pseudo-package built as part of the test binary should inherit the same flags.

Fixes #22831.

Change-Id: I0e896b6c0f1063454300b7323f577feffbd6650b
Reviewed-on: https://go-review.googlesource.com/81496
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years agocmd/go: fix -x output for test build failure
Russ Cox [Fri, 1 Dec 2017 15:45:49 +0000 (10:45 -0500)]
cmd/go: fix -x output for test build failure

If the build of the test binary failed, the go command correctly
avoided running the binary, but the -x output indicated otherwise.

Fixes #22659.

Change-Id: Ib4d262bf1735f057c994a45fc23c499d4ebe3246
Reviewed-on: https://go-review.googlesource.com/81495
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years agocmd/go: fix -outputdir -coverprofile interaction
Russ Cox [Fri, 1 Dec 2017 15:29:10 +0000 (10:29 -0500)]
cmd/go: fix -outputdir -coverprofile interaction

The CL introducing merged handling of cover profiles
did not correctly account for the fact that the file name argument
to -coverprofile is required to be interpreted relative to
the -outputdir argument.

Fixes #22804.

Change-Id: I804774013c12187313b8fd2044302978bdbb6697
Reviewed-on: https://go-review.googlesource.com/81455
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years agocmd/compile: fix DWARF type symbol buglet
Than McIntosh [Fri, 1 Dec 2017 14:39:59 +0000 (09:39 -0500)]
cmd/compile: fix DWARF type symbol buglet

The code that generates the list of DWARF variables for a function
(params and autos) will emit a "no-location" entry in the DWARF for a
user var that appears in the original pre-optimization version of the
function but is no longer around when optimization is complete. The
intent is that if a GDB user types "print foo" (where foo has been
optimized out), the response will be "<optimized out>" as opposed to
"there is no such variable 'foo'). This change fixes said code to
include vars on the autom list for the function, to insure that the
type symbol for the variable makes it to the linker.

Fixes #22941.

Change-Id: Id29f1f39d68fbb798602dfd6728603040624fc41
Reviewed-on: https://go-review.googlesource.com/81415
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
6 years agosync/atomic: remove noCopy from Value
Russ Cox [Wed, 29 Nov 2017 21:20:50 +0000 (16:20 -0500)]
sync/atomic: remove noCopy from Value

Values must not be copied after the first use.

Using noCopy makes vet complain about copies
even before the first use, which is incorrect
and very frustrating.

Drop it.

Fixes #21504.

Change-Id: Icd3a5ac3fe11e84525b998e848ed18a5d996f45a
Reviewed-on: https://go-review.googlesource.com/80836
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years agoos: drop unused return value in TestLookupEnv
Tobias Klauser [Fri, 1 Dec 2017 13:02:53 +0000 (14:02 +0100)]
os: drop unused return value in TestLookupEnv

Change-Id: Ibf227dcfefa179b1c3378476bcd17100b1b1c01e
Reviewed-on: https://go-review.googlesource.com/81375
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years agoreflect: fix interface to interface conversion in Call
Russ Cox [Wed, 29 Nov 2017 19:44:43 +0000 (14:44 -0500)]
reflect: fix interface to interface conversion in Call

Call is meant to mirror the language semantics, which allow:

var r io.ReadWriter
f := func(io.Reader){}
f(r)

even though the conversion from io.ReadWriter to io.Reader is
being applied to a nil interface. This is different from an explicit
conversion:

_ = r.(io.Reader)
f(r.(io.Reader))

Both of those lines panic, but the implicit conversion does not.

By using E2I, which is the implementation of the explicit conversion,
the reflect.Call equivalent of f(r) was inadvertently panicking.
Avoid the panic.

Fixes #22143.

Change-Id: I6b2f5b808e0cd3b89ae8bc75881e307bf1c25558
Reviewed-on: https://go-review.googlesource.com/80736
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years agocmd/compile: use src.NoXPos for entry-block constants
David Chase [Thu, 30 Nov 2017 20:11:34 +0000 (15:11 -0500)]
cmd/compile: use src.NoXPos for entry-block constants

The ssa backend is aggressive about placing constants and
certain other values in the Entry block.  It's implausible
that the original line numbers for these constants makes
any sort of sense when it appears to a user stepping in a
debugger, and they're also not that useful in dumps since
entry-block instructions tend to be constants (i.e.,
unlikely to be the cause of a crash).

Therefore, use src.NoXPos for any values that are explicitly
inserted into a function's entry block.

Passes all tests, including ssa/debug_test.go with both
gdb and a fairly recent dlv.  Hand-verified that it solves
the reported problem; constructed a test that reproduced
a problem, and fixed it.

Modified test harness to allow injection of slightly more
interesting inputs.

Fixes #22558.

Change-Id: I4476927067846bc4366da7793d2375c111694c55
Reviewed-on: https://go-review.googlesource.com/81215
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
6 years agoos: ignore Chtimes test failure on NetBSD if fs mounted noatime
Brad Fitzpatrick [Fri, 1 Dec 2017 03:25:02 +0000 (03:25 +0000)]
os: ignore Chtimes test failure on NetBSD if fs mounted noatime

Fixes #19293

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

6 years agonet/http: update bundled http2
Brad Fitzpatrick [Thu, 30 Nov 2017 23:08:22 +0000 (23:08 +0000)]
net/http: update bundled http2

Updates http2 to x/net git rev 894f8ed58 for:

    http2: fix flake in net/http's TestCloseIdleConnections_h2
    https://golang.org/cl/80139

    http2: fix leak in activeRes by removing activeRes
    https://golang.org/cl/80137

Fixes #22413
Fixes #21543

Change-Id: Ic8ea20f8ddae2fde17884ed045f9fa7058a4bd23
Reviewed-on: https://go-review.googlesource.com/81276
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Tom Bergan <tombergan@google.com>
6 years agoRevert "go/printer: forbid empty line before first comment in block"
Joe Tsai [Fri, 1 Dec 2017 00:59:45 +0000 (00:59 +0000)]
Revert "go/printer: forbid empty line before first comment in block"

This reverts commit 08f19bbde1b01227fdc2fa2d326e4029bb74dd96.

Reason for revert:
The changed transformation takes effect on a larger set
of code snippets than expected.

For example, this:
    func foo() {

        // Comment
        bar()

    }
becomes:
    func foo() {
        // Comment
        bar()

    }

This is an unintended consequence.

Change-Id: Ifca88d6267dab8a8170791f7205124712bf8ace8
Reviewed-on: https://go-review.googlesource.com/81335
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Joe Tsai <joetsai@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

6 years agoruntime: use monotonic time on NetBSD
Brad Fitzpatrick [Thu, 30 Nov 2017 19:37:16 +0000 (19:37 +0000)]
runtime: use monotonic time on NetBSD

Fixes #6007

Change-Id: I239a1699122e086e907ac1f18b1c86a650e1438a
Reviewed-on: https://go-review.googlesource.com/81135
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
6 years agocmd/compile: fix GOEXPERIMENT checks
Matthew Dempsky [Wed, 29 Nov 2017 20:26:59 +0000 (12:26 -0800)]
cmd/compile: fix GOEXPERIMENT checks

GOEXPERIMENT is only set during make.bash, so checking the environment
variable isn't effectual. Instead, check the values exposed by objabi.

These experiments look potentially safe, but it seems too late in the
release cycle to try to assuage that. The one exception is frame
pointer experiment, which is trivially safe: it just amounts to
incrementing some stack offsets by PtrSize.

Fixes #22223.

Change-Id: I46dc7c54b1347143d02d6b9635038230cda6d164
Reviewed-on: https://go-review.googlesource.com/80760
Reviewed-by: Russ Cox <rsc@golang.org>
6 years agotesting: remove claim that b.Run is safe for concurrent use
Russ Cox [Wed, 29 Nov 2017 21:31:47 +0000 (16:31 -0500)]
testing: remove claim that b.Run is safe for concurrent use

It's not safe (it crashes), and it's also useless: if you run
multiple benchmarks in parallel you will not get reliable
timing results from any of them.

Fixes #18603.

Change-Id: I00e5a72f7c98151543cf7d5573c38383276e391a
Reviewed-on: https://go-review.googlesource.com/80841
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years agoruntime/pprof: read memstats earlier in profile handler
Russ Cox [Wed, 29 Nov 2017 20:38:52 +0000 (15:38 -0500)]
runtime/pprof: read memstats earlier in profile handler

Reading the mem stats before our own allocations
avoids cluttering memory stats with our recent garbage.

Fixes #20565.

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

6 years agoarchive/zip: add test for Modified vs ModTime behavior
Russ Cox [Wed, 29 Nov 2017 16:40:52 +0000 (11:40 -0500)]
archive/zip: add test for Modified vs ModTime behavior

Lock in fix for #22738, submitted in CL 78031.

Fixes #22738.

Change-Id: I6896feb158569e3f12fa7055387cbd7caad29ef4
Reviewed-on: https://go-review.googlesource.com/80635
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
6 years agoos: remove redundant GOOS checks in chown tests
Tobias Klauser [Thu, 30 Nov 2017 23:19:24 +0000 (00:19 +0100)]
os: remove redundant GOOS checks in chown tests

The build tags already prevent the tests from being run on windows or
plan9, so there is no need to check GOOS again.

Change-Id: I74d3c3b7756d9c50f6e5fd4c3e8b0db618fdebbb
Reviewed-on: https://go-review.googlesource.com/81295
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agoruntime: don't block signals that will kill the program
Ian Lance Taylor [Thu, 23 Nov 2017 03:12:12 +0000 (19:12 -0800)]
runtime: don't block signals that will kill the program

Otherwise we may delay the delivery of these signals for an arbitrary
length of time. We are already careful to not block signals that the
program has asked to see.

Also make sure that we don't miss a signal delivery if a thread
decides to stop for a while while executing the signal handler.

Also clean up the TestAtomicStop output a little bit.

Fixes #21433

Change-Id: Ic0c1a4eaf7eba80d1abc1e9537570bf4687c2434
Reviewed-on: https://go-review.googlesource.com/79581
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
6 years agodebug/gosym: update docs for changes in Go 1.3
Hiroshi Ioka [Thu, 23 Nov 2017 01:37:05 +0000 (10:37 +0900)]
debug/gosym: update docs for changes in Go 1.3

Change-Id: I850d961e0444f8d34284e994aee183afba35eaa7
Reviewed-on: https://go-review.googlesource.com/79597
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years agocrypto/elliptic: reduce allocations on amd64
Ilya Tocar [Wed, 29 Nov 2017 19:20:08 +0000 (13:20 -0600)]
crypto/elliptic: reduce allocations on amd64

This is inspired by
https://blog.cloudflare.com/go-dont-collect-my-garbage/
This CL adds allocation tracking and parallelizes p256-related benchmarks.
Amount of allocations can be significantly reduced by marking amd64 asm
functions as noescape. This exposes a bug in p256MovCond:
PANDN with memory argument will fault if memory is not aligned, so they
are replaced with MOVDQU (which is ok with unaligned memory) and
register version of PANDN.

Results on 88-thread machine (2x 22 cores) below:
crypto/elliptic:
name               old time/op    new time/op    delta
BaseMultP256-88      1.50µs ±11%    1.19µs ± 5%  -20.20%  (p=0.000 n=10+10)
ScalarMultP256-88    5.47µs ± 5%    3.63µs ±10%  -33.66%  (p=0.000 n=9+10)

name               old alloc/op   new alloc/op   delta
BaseMultP256-88        800B ± 0%      288B ± 0%  -64.00%  (p=0.000 n=10+10)
ScalarMultP256-88    2.59kB ± 0%    0.26kB ± 0%  -90.12%  (p=0.000 n=10+10)

name               old allocs/op  new allocs/op  delta
BaseMultP256-88        13.0 ± 0%       6.0 ± 0%  -53.85%  (p=0.000 n=10+10)
ScalarMultP256-88      16.0 ± 0%       5.0 ± 0%  -68.75%  (p=0.000 n=10+10)

crypto/ecdsa:
name              old time/op    new time/op    delta
SignP256-88         8.63µs ±37%    7.55µs ±38%     ~     (p=0.393 n=10+10)
VerifyP256-88       13.9µs ± 8%     7.0µs ± 7%  -49.29%  (p=0.000 n=10+9)
KeyGeneration-88    2.77µs ±11%    2.34µs ±11%  -15.57%  (p=0.000 n=10+10)

name              old alloc/op   new alloc/op   delta
SignP256-88         4.14kB ± 1%    2.98kB ± 2%  -27.94%  (p=0.000 n=10+10)
VerifyP256-88       4.47kB ± 0%    0.99kB ± 0%  -77.84%  (p=0.000 n=9+10)
KeyGeneration-88    1.21kB ± 0%    0.69kB ± 0%  -42.78%  (p=0.000 n=10+10)

name              old allocs/op  new allocs/op  delta
SignP256-88           47.0 ± 0%      34.0 ± 0%  -27.66%  (p=0.000 n=10+10)
VerifyP256-88         38.0 ± 0%      17.0 ± 0%  -55.26%  (p=0.000 n=10+10)
KeyGeneration-88      20.0 ± 0%      13.0 ± 0%  -35.00%  (p=0.000 n=10+10)

On machine with only 4 cores, results are much less impressive:
around 2% performance gain.

Change-Id: I8a2f8168f83d27ad9ace1b4b1a1e11cb83edf717
Reviewed-on: https://go-review.googlesource.com/80757
Run-TryBot: Ilya Tocar <ilya.tocar@intel.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years agomath: remove asm version of Dim
Ilya Tocar [Wed, 29 Nov 2017 18:15:31 +0000 (12:15 -0600)]
math: remove asm version of Dim

Dim performance has regressed by 14% vs 1.9 on amd64.
Current pure go version of Dim is faster and,
what is even more important for performance, is inlinable, so
instead of tweaking asm implementation, just remove it.
I had to update BenchmarkDim, because it was simply reloading
constant(answer) in a loop.
Perf data below:

name   old time/op  new time/op  delta
Dim-6  6.79ns ± 0%  1.60ns ± 1%  -76.39%  (p=0.000 n=7+10)

If I modify benchmark to be the same as in this CL results are even better:

name   old time/op  new time/op  delta
Dim-6  10.2ns ± 0%   1.6ns ± 1%  -84.27%  (p=0.000 n=8+10)

Updates #21913

Change-Id: I00e23c8affc293531e1d9f0e0e49f3a525634f53
Reviewed-on: https://go-review.googlesource.com/80695
Run-TryBot: Ilya Tocar <ilya.tocar@intel.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
6 years agoruntime: more specific reason for skipping GDB tests on NetBSD
Austin Clements [Thu, 30 Nov 2017 20:14:51 +0000 (15:14 -0500)]
runtime: more specific reason for skipping GDB tests on NetBSD

Updates #22893.

Change-Id: I2cf5efb4fa6b77aaf82de5d8877c99f9aa5d519a
Reviewed-on: https://go-review.googlesource.com/81195
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agomath/big: protect against aliasing in nat.divLarge
Alberto Donizetti [Tue, 21 Nov 2017 13:16:04 +0000 (14:16 +0100)]
math/big: protect against aliasing in nat.divLarge

In nat.divLarge (having signature (z nat).divLarge(u, uIn, v nat)),
we check whether z aliases uIn or v, but aliasing is currently not
checked for the u parameter.

Unfortunately, z and u aliasing each other can in some cases cause
errors in the computation.

The q return parameter (which will hold the result's quotient), is
unconditionally initialized as

    q = z.make(m + 1)

When cap(z) ≥ m+1, z.make() will reuse z's backing array, causing q
and z to share the same backing array. If then z aliases u, setting q
during the quotient computation will then corrupt u, which at that
point already holds computation state.

To fix this, we add an alias(z, u) check at the beginning of the
function, taking care of aliasing the same way we already do for uIn
and v.

Fixes #22830

Change-Id: I3ab81120d5af6db7772a062bb1dfc011de91f7ad
Reviewed-on: https://go-review.googlesource.com/78995
Run-TryBot: Alberto Donizetti <alb.donizetti@gmail.com>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
6 years agocmd/trace: compute pprof-style output per goroutine type
Hana (Hyang-Ah) Kim [Thu, 2 Nov 2017 23:17:39 +0000 (19:17 -0400)]
cmd/trace: compute pprof-style output per goroutine type

The trace command computes IO, Schedule, Block, and Syscall profiles
by following the unblocking links in the execution trace and summing
up the duration.  This change offers variations of those profiles
that include only selected goroutine types. The id parameter takes the
goroutine type - i.e. pc of the goroutine.

The output is available from the /goroutine view. So, users can see
where the goroutines of interest typically block.

Also, these profiles are available for download so users can use
pprof or other tools to interpret the output. This change adds links
for download of global profile in the main page.

Change-Id: I35699252056d164e60de282b0406caf96d629c85
Reviewed-on: https://go-review.googlesource.com/75710
Reviewed-by: Sameer Ajmani <sameer@golang.org>
6 years agocmd/compile: use soft-float routines for soft-float targets
Vladimir Stefanovic [Fri, 10 Nov 2017 17:08:48 +0000 (18:08 +0100)]
cmd/compile: use soft-float routines for soft-float targets

Updates #18162 (mostly fixes)

Change-Id: I35bcb8a688bdaa432adb0ddbb73a2f7adda47b9e
Reviewed-on: https://go-review.googlesource.com/37958
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
6 years agobuild: add alternate output format for bootstrap.bash, as used by builders
Brad Fitzpatrick [Thu, 30 Nov 2017 02:26:51 +0000 (02:26 +0000)]
build: add alternate output format for bootstrap.bash, as used by builders

I've been doing these tweaks by hand. I was going to write a tool in
Go for it, but it's not much additional shell here.

Fixes #22912
Updates #9797 (already closed)

Change-Id: Ia15bd9b6876e6f6a76aa9ca86b10f113095e96a3
Reviewed-on: https://go-review.googlesource.com/80895
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years agoruntime/cgo, math: don't use FP instructions for soft-float mips{,le}
Vladimir Stefanovic [Mon, 22 May 2017 16:28:06 +0000 (18:28 +0200)]
runtime/cgo, math: don't use FP instructions for soft-float mips{,le}

Updates #18162

Change-Id: I591fcf71a02678a99a56a6487da9689d3c9b1bb6
Reviewed-on: https://go-review.googlesource.com/37955
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
6 years agoruntime: implement some soft-float routines (used by GOMIPS=softfloat)
Vladimir Stefanovic [Mon, 22 May 2017 16:31:38 +0000 (18:31 +0200)]
runtime: implement some soft-float routines (used by GOMIPS=softfloat)

Updates #18162

Change-Id: Iee854f48b2d1432955fdb462f2073ebbe76c34f8
Reviewed-on: https://go-review.googlesource.com/37957
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
6 years agocmd/go, cmd/dist: introduce GOMIPS environment variable
Vladimir Stefanovic [Mon, 22 May 2017 16:23:31 +0000 (18:23 +0200)]
cmd/go, cmd/dist: introduce GOMIPS environment variable

GOMIPS is a GOARCH=mips{,le} specific option, for a choice between
hard-float and soft-float. Valid values are 'hardfloat' (default) and
'softfloat'. It is passed to the assembler as
'GOMIPS_{hardfloat,softfloat}'.

Note: GOMIPS will later also be used for a choice of MIPS instruction
set (mips32/mips32r2).

Updates #18162

Change-Id: I35417db8625695f09d6ccc3042431dd2eaa756a6
Reviewed-on: https://go-review.googlesource.com/37954
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
6 years agocmd/go: fix typo in link action ID hash input string
Tobias Klauser [Thu, 30 Nov 2017 09:03:22 +0000 (10:03 +0100)]
cmd/go: fix typo in link action ID hash input string

Fix a typo of "packageshlib" used for generating the link action ID.

Change-Id: Id6d39830908b03de658a58661030c32c592a1da9
Reviewed-on: https://go-review.googlesource.com/80935
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alberto Donizetti <alb.donizetti@gmail.com>
6 years agocompiler,linker: support for DWARF inlined instances
Than McIntosh [Fri, 6 Oct 2017 15:32:28 +0000 (11:32 -0400)]
compiler,linker: support for DWARF inlined instances

Compiler and linker changes to support DWARF inlined instances,
see https://go.googlesource.com/proposal/+/HEAD/design/22080-dwarf-inlining.md
for design details.

This functionality is gated via the cmd/compile option -gendwarfinl=N,
where N={0,1,2}, where a value of 0 disables dwarf inline generation,
a value of 1 turns on dwarf generation without tracking of formal/local
vars from inlined routines, and a value of 2 enables inlines with
variable tracking.

Updates #22080

Change-Id: I69309b3b815d9fed04aebddc0b8d33d0dbbfad6e
Reviewed-on: https://go-review.googlesource.com/75550
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
6 years agocmd/compile: fix loop depth of range expression in escape analysis
Cherry Zhang [Wed, 29 Nov 2017 20:55:40 +0000 (15:55 -0500)]
cmd/compile: fix loop depth of range expression in escape analysis

ORANGE node's Right node is the expression it is ranging over,
which is evaluated before the loop. In the escape analysis,
we should walk this node without loop depth incremented.

Fixes #21709.

Change-Id: Idc1e4c76e39afb5a344d85f6b497930a488ce5cf
Reviewed-on: https://go-review.googlesource.com/80740
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
6 years agoRevert "os: remove skipped test on netbsd"
Brad Fitzpatrick [Thu, 30 Nov 2017 03:31:18 +0000 (03:31 +0000)]
Revert "os: remove skipped test on netbsd"

This reverts commit a631daba5fe9d91ebdddd4148e8af82e07c1ae3e.

Reason for revert: I was wrong. It still fails on the builders.

I don't know what's different about my VMWare VM, but on GCE it fails.

Change-Id: Ic6bee494b69235768bf08ba0bf59026bca41ad12
Reviewed-on: https://go-review.googlesource.com/80915
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agobytes: mention strings.Builder in Buffer.String docs
Brad Fitzpatrick [Wed, 29 Nov 2017 21:15:31 +0000 (21:15 +0000)]
bytes: mention strings.Builder in Buffer.String docs

Fixes #22778

Change-Id: I37f7a59c15828aa720fe787fff42fb3ef17729c7
Reviewed-on: https://go-review.googlesource.com/80815
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years agoos: remove skipped test on netbsd
Brad Fitzpatrick [Wed, 29 Nov 2017 22:30:23 +0000 (22:30 +0000)]
os: remove skipped test on netbsd

It must've been fixed since NetBSD 7.0. I can no longer reproduce it
with NetBSD 8-BETA (our new minimum NetBSD requirement).

Fixes #19293

Change-Id: I28f970ca41a53a037e1c6cddf1b7f286bda2d725
Reviewed-on: https://go-review.googlesource.com/80875
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years agogo/types: report error when recognizing issue #18395.
Robert Griesemer [Wed, 29 Nov 2017 01:17:33 +0000 (17:17 -0800)]
go/types: report error when recognizing issue #18395.

The fix (CL 79575) for #18395 is too risky at this stage of the Go 1.10
release process.

Since issue #18395 is easily recognized (but not easily fixed), report
an error instead of silently continuing. This avoids inscrutable follow
on errors.

Also, make sure all empty interfaces are "completed", and adjust
printing code to report incomplete interfaces.

For #18395.

Change-Id: I7fa5f97ff31ac9775c9a6d318fce9f526b0350cd
Reviewed-on: https://go-review.googlesource.com/80455
Reviewed-by: Alan Donovan <adonovan@google.com>
6 years agogo/ast: improve documentation for channel directions
Robert Griesemer [Wed, 29 Nov 2017 21:27:50 +0000 (13:27 -0800)]
go/ast: improve documentation for channel directions

Fixes #22815.

Change-Id: Iaa54fa311bf2c0549a6316a0d51cc92425f5ba94
Reviewed-on: https://go-review.googlesource.com/80855
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agocmd/vendor/golang.org/x/arch: revendor at commit dda8112
Cherry Zhang [Wed, 22 Nov 2017 21:25:13 +0000 (16:25 -0500)]
cmd/vendor/golang.org/x/arch: revendor at commit dda8112

Updates #20650 (CL 45099 introduced the feature to x86).

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

6 years agocmd/internal/objfile: make lookupFunc an alias type
Cherry Zhang [Wed, 29 Nov 2017 20:58:43 +0000 (15:58 -0500)]
cmd/internal/objfile: make lookupFunc an alias type

In the x/arch repo, CL 45098 introduced SymLookup type, replacing
the unnamed function type for lookup functions. This affects the
signature of x86asm.GoSyntax. In particular, it cannot convert
one named type, namely lookupFunc, to the other without an
explicit cast. Make lookupFunc unnamed to fix.

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

6 years agocmd/compile: make -asmhdr work with type aliases
Matthew Dempsky [Wed, 29 Nov 2017 19:58:03 +0000 (11:58 -0800)]
cmd/compile: make -asmhdr work with type aliases

For "type T = U" we were accidentally emitting a #define for "U__size"
instead of "T__size".

Fixes #22877.

Change-Id: I5ed6757d697753ed6d944077c16150759f6e1285
Reviewed-on: https://go-review.googlesource.com/80759
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agodoc: move single change workflow note in contribution guide
Leigh McCulloch [Sat, 4 Nov 2017 20:54:30 +0000 (20:54 +0000)]
doc: move single change workflow note in contribution guide

The note about the single change workflow is included in the
git-codereview installation instructions, but it has nothing to do with
installing git-codereview. This note is more relevant for when a change
is actually being made.

Change-Id: Iccb90f3b7da87fab863fa4808438cd69a21a2fce
Reviewed-on: https://go-review.googlesource.com/76317
Reviewed-by: Steve Francia <spf@golang.org>
6 years agovendor: update golang.org/x/net/nettest from upstream
Brad Fitzpatrick [Wed, 29 Nov 2017 19:41:11 +0000 (19:41 +0000)]
vendor: update golang.org/x/net/nettest from upstream

Updates to x/net git rev a8b92947779 for CL 80755

Updates #22927

Change-Id: I84aad75afd954c9a6c57ad9a76328b99f1dc74a1
Reviewed-on: https://go-review.googlesource.com/80758
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Benny Siegert <bsiegert@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

6 years agonet: skip unixpacket tests on netbsd/386
Brad Fitzpatrick [Wed, 29 Nov 2017 19:22:27 +0000 (19:22 +0000)]
net: skip unixpacket tests on netbsd/386

Updates #22927
Updates #20852

Change-Id: I3ac0f8d38375d58a77781ab0e4f78ca57b258de0
Reviewed-on: https://go-review.googlesource.com/80756
Reviewed-by: Benny Siegert <bsiegert@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agoarchive/tar: use placeholder name for global PAX records
Joe Tsai [Thu, 16 Nov 2017 18:15:34 +0000 (10:15 -0800)]
archive/tar: use placeholder name for global PAX records

Several usages of tar (reasonably) just use the Header.FileInfo
to determine the type of the header. However, the os.FileMode type
is not expressive enough to represent "files" that are not files
at all, but some form of metadata.

Thus, Header{Typeflag: TypeXGlobalHeader}.FileInfo().Mode().IsRegular()
reports true, even though the expected result may have been false.

To reduce (not eliminate) the possibility of failure for such usages,
use the placeholder filename from the global PAX headers.
Thus, in the event the user did not handle special "meta" headers
specifically, they will just be written to disk as a regular file.

As an example use case, the "git archive --format=tgz" command produces
an archive where the first "file" is a global PAX header with the
name "global_pax_header". For users that do not explicitly check
the Header.Typeflag field to ignore such headers, they may end up
extracting a file named "global_pax_header". While it is a bogus file,
it at least does not stop the extraction process.

Updates #22748

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

6 years agogo/format: document use of Source better
Robert Griesemer [Wed, 29 Nov 2017 18:48:12 +0000 (10:48 -0800)]
go/format: document use of Source better

For #22695.

Change-Id: Idcda3294070aeaeaf940aaf2014b573732fd60a4
Reviewed-on: https://go-review.googlesource.com/80696
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Dmitri Shuralyov <shurcool@gmail.com>