]> Cypherpunks repositories - gostls13.git/log
gostls13.git
6 years agodatabase/sql: fix comment grammar
Andrei Matei [Mon, 4 Mar 2019 00:44:58 +0000 (00:44 +0000)]
database/sql: fix comment grammar

Change-Id: I92d8c93967c5ec57f07151affd0041f00e405057
GitHub-Last-Rev: 2dea977d938a504604aed6a9ae87986001f96acd
GitHub-Pull-Request: golang/go#30551
Reviewed-on: https://go-review.googlesource.com/c/go/+/164970
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agodoc: add missing paragraph break in Effective Go
Rob Pike [Thu, 7 Mar 2019 04:05:43 +0000 (15:05 +1100)]
doc: add missing paragraph break in Effective Go

A recent edit broke the flow; add a paragraph break when the subject
switches from maps to structs.

No changes in wording.

Change-Id: I5df88ec36b9d81931cfdbc684424440d01ac06d1
Reviewed-on: https://go-review.googlesource.com/c/go/+/165917
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agocmd/go: add notary simulation and GONOVERIFY support
Russ Cox [Tue, 26 Feb 2019 05:16:07 +0000 (00:16 -0500)]
cmd/go: add notary simulation and GONOVERIFY support

As an experiment to better understand the impact of
having an authoritative source of truth for module hashes
before the real notary is available, this CL adds the basic
notary authorization checks using a partial whitelist of
known go.sum values for popular modules.

In addition to the temporary whitelist, this CL adds code
implementing $GONOVERIFY, a new 'go help modules-auth',
and clearer error messages for verification mismatches.

See #25530 for notary proposal.
Filed #30601 to remove whitelist when notary lands.

Change-Id: Ibcb6ac39c5e60455edf003d8c20af6932aeb7e88
Reviewed-on: https://go-review.googlesource.com/c/go/+/165380
Reviewed-by: Bryan C. Mills <bcmills@google.com>
6 years agocmd/cgo: use explicit type for arg with bad pointer typedef
Ian Lance Taylor [Thu, 7 Mar 2019 01:31:04 +0000 (17:31 -0800)]
cmd/cgo: use explicit type for arg with bad pointer typedef

Fixes #30646

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

6 years agoreflect: fix more issues with StructOf GC programs
Keith Randall [Wed, 6 Mar 2019 22:45:47 +0000 (14:45 -0800)]
reflect: fix more issues with StructOf GC programs

First the insidious bug:

  var n uintptr
  for n := elemPtrs; n > 120; n -= 120 {
    prog = append(prog, 120)
    prog = append(prog, mask[:15]...)
    mask = mask[15:]
  }
  prog = append(prog, byte(n))
  prog = append(prog, mask[:(n+7)/8]...)

The := breaks this code, because the n after the loop is always 0!

We also do need to handle field padding correctly. In particular
the old padding code doesn't correctly handle fields that are not
a multiple of a pointer in size.

Fixes #30606.

Change-Id: Ifcab9494dc25c20116753c5d7e0145d6c2053ed8
Reviewed-on: https://go-review.googlesource.com/c/go/+/165860
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agogo/constant: add Val accessor and Make constructor to handle varied types
Rebecca Stambler [Wed, 27 Feb 2019 19:10:07 +0000 (14:10 -0500)]
go/constant: add Val accessor and Make constructor to handle varied types

This change adds a Val accessor that returns the underlying type for a
given constant.Value. This change also adds a Make constructor that builds a
constant.Value given a value of a specific type.

Fixes #29820

Change-Id: I4fc3f5221408e24af42ffecd21ce4099ee75b47a
Reviewed-on: https://go-review.googlesource.com/c/go/+/164538
Reviewed-by: Robert Griesemer <gri@golang.org>
6 years agocmd/link: fix contents of debug_pubnames/debug_pubtypes
Alessandro Arzilli [Tue, 5 Mar 2019 08:58:58 +0000 (09:58 +0100)]
cmd/link: fix contents of debug_pubnames/debug_pubtypes

The contents of debug_pubnames and debug_pubtypes have been wrong since
Go 1.12.
CL golang.org/cl/137235 moved global variables DIE to their respective
compilation unit, unfortunately writepub can't emit correct sections
for anything but the first compilation unit.

This commit moves the code generating debug_pubnames and debug_pubtypes
inside writeinfo and fixes it.
Gets rid of a number of unnecessary relocations as well as a hack that
writeinfo used to communicate to writepub the size of each compilation
unit.

Fixes #30573

Change-Id: Ibdaa80c02746ae81661c2cfe1d218092c5ae9236
Reviewed-on: https://go-review.googlesource.com/c/go/+/165337
Run-TryBot: Alessandro Arzilli <alessandro.arzilli@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
6 years agocmd/go: document GoVersion field in Module struct
Dmitri Shuralyov [Mon, 4 Mar 2019 14:07:29 +0000 (09:07 -0500)]
cmd/go: document GoVersion field in Module struct

The 'go version' statement was added during Go 1.11 development in
CL 125940. That CL added the GoVersion field to modinfo.ModulePublic
struct, but did not document it in cmd/go documentation. This was
consistent with the CL description, which stated "We aren't planning
to use this or advertise it much yet".

CL 147281, applied during Go 1.12 development, was a change to start
adding the 'go version' statement when initializing go.mod. The 'go
version' statement is now being used, and it has been documented in
the Go 1.12 release notes at https://golang.org/doc/go1.12#modules.
It's now due time to documement the GoVersion field in cmd/go as well.

Keep the Error field bottom-most, both because it makes sense not to
place it in the middle of other fields, and for consistency with the
field order in struct Package, where the Error information is located
at the very bottom.

Regenerate alldocs.go by running mkalldocs.sh.

Updates #28221
Updates #23969

Change-Id: Iaf43a0da4f6a2489d861092a1d4e002a532952cb
Reviewed-on: https://go-review.googlesource.com/c/go/+/164878
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
6 years agoruntime: align first persistentalloc chunk as requested
Ian Lance Taylor [Tue, 26 Feb 2019 23:52:23 +0000 (15:52 -0800)]
runtime: align first persistentalloc chunk as requested

Change-Id: Ib391e019b1a7513d234fb1c8ff802efe8fa7c950
Reviewed-on: https://go-review.googlesource.com/c/go/+/163859
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
6 years agocmd/cgo: simplify and fix handling of untyped constants
Rémy Oudompheng [Fri, 1 Mar 2019 22:12:19 +0000 (23:12 +0100)]
cmd/cgo: simplify and fix handling of untyped constants

Instead of trying to guess type of constants in the AST,
which is hard, use the "var cgo%d Type = Constant"
so that typechecking is left to the Go compiler.

The previous code could still fail in some cases
for constants imported from other modules
or defined in other, non-cgo files.

Fixes #30527

Change-Id: I2120cd90e90a74b9d765eeec53f6a3d2cfc1b642
Reviewed-on: https://go-review.googlesource.com/c/go/+/164897
Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years agocmd/go: run the 'go build' command in TestACL in the temp directory
Bryan C. Mills [Wed, 6 Mar 2019 18:34:47 +0000 (13:34 -0500)]
cmd/go: run the 'go build' command in TestACL in the temp directory

Otherwise, when the 'cmd' module is added the test will run as if in module 'cmd'.

While we're here, remove an unnecessary os.Chdir in TestAbsolutePath:
we can instead set the Dir on the 'go build' command instead. Then we
can run the tests in this file in parallel with everything else.

Updates #30228

Change-Id: I13ecd7ec93bc1041010daec14d76bac10e0c89be
Reviewed-on: https://go-review.googlesource.com/c/go/+/165744
Run-TryBot: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Jay Conrod <jayconrod@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

6 years agogo/internal/gccgoimporter: test case for issue 30628
Than McIntosh [Wed, 6 Mar 2019 14:56:03 +0000 (09:56 -0500)]
go/internal/gccgoimporter: test case for issue 30628

Test case for a panic/crash in gccgoimporter caused by incorrect gccgo
export data emission. Note that the *.gox file checked in contains the
correct export data; the main intent of the test is to make sure that
gccgo produces the right export data when run on the Go source.

Updates #30628

Change-Id: I29c0c17b81a43f92ff64fbfcdc58fdb46a5be370
Reviewed-on: https://go-review.googlesource.com/c/go/+/165739
Run-TryBot: Than McIntosh <thanm@google.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

6 years agoreflect: fix StructOf GC programs
Keith Randall [Wed, 6 Mar 2019 18:39:08 +0000 (10:39 -0800)]
reflect: fix StructOf GC programs

They are missing a stop byte at the end.

Normally this doesn't matter, but when including a GC program
in another GC program, we strip the last byte. If that last byte
wasn't a stop byte, then we've thrown away part of the program
we actually need.

Fixes #30606

Change-Id: Ie9604beeb84f7f9442e77d31fe64c374ca132cce
Reviewed-on: https://go-review.googlesource.com/c/go/+/165857
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agocmd/go: drop support for binary-only packages
Jay Conrod [Wed, 6 Mar 2019 19:24:29 +0000 (14:24 -0500)]
cmd/go: drop support for binary-only packages

Fixes #28152

Change-Id: I98db923bdf8de7acf2df452313427bfea43b63c9
Reviewed-on: https://go-review.googlesource.com/c/go/+/165746
Run-TryBot: Jay Conrod <jayconrod@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

6 years agocmd/vet/all: build the vet tool within the golang.org/x/tools repository
Bryan C. Mills [Wed, 6 Mar 2019 16:06:14 +0000 (11:06 -0500)]
cmd/vet/all: build the vet tool within the golang.org/x/tools repository

When running cmd/vet/all on multiple builders, the coordinator places
a copy of golang.org/x/tools at a consistent revision in the builders'
GOPATHs. Keep using the consistent revision in module mode by
executing the build from a working directory within that repository.

When not running on a builder, use 'go vet' directly instead of
building an arbitrarily stale vet tool from the user's GOPATH.

Updates #30228

Change-Id: I19bc809247378da98f3e6ac8572f61bda4518143
Reviewed-on: https://go-review.googlesource.com/c/go/+/165740
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agocmd/compile: fix ordering for short-circuiting ops
Keith Randall [Wed, 6 Mar 2019 01:42:48 +0000 (17:42 -0800)]
cmd/compile: fix ordering for short-circuiting ops

Make sure the side effects inside short-circuited operations (&& and ||)
happen correctly.

Before this CL, we attached the side effects to the node itself using
exprInPlace. That caused other side effects in sibling expressions
to get reordered with respect to the short circuit side effect.

Instead, rewrite a && b like:

r := a
if r {
  r = b
}

That code we can keep correctly ordered with respect to other
side-effects extracted from part of a big expression.

exprInPlace seems generally unsafe. But this was the only case where
exprInPlace is called not at the top level of an expression, so I
don't think the other uses can actually trigger an issue (there can't
be a sibling expression). TODO: maybe those cases don't need "in
place", and we can retire that function generally.

This CL needed a small tweak to the SSA generation of OIF so that the
short circuit optimization still triggers. The short circuit optimization
looks for triangle but not diamonds, so don't bother allocating a block
if it will be empty.

Go 1 benchmarks are in the noise.

Fixes #30566

Change-Id: I19c04296bea63cbd6ad05f87a63b005029123610
Reviewed-on: https://go-review.googlesource.com/c/go/+/165617
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
6 years agocmd/go: clear GOPROXY in TestGoGetInsecure
Bryan C. Mills [Tue, 5 Mar 2019 22:01:19 +0000 (17:01 -0500)]
cmd/go: clear GOPROXY in TestGoGetInsecure

TestGoGetInsecure verifies that 'go get -insecure' can fetch a
particular package. However, the GOPROXY protocol does not provide a
means for proxies to indicate packages as insecure; thus, proxies
cannot safely serve those packages.

Updates #30571

Change-Id: I447776dff98bd8ee6eb5055b897b9c7d293e3423
Reviewed-on: https://go-review.googlesource.com/c/go/+/165745
Run-TryBot: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

6 years agoruntime: do not use a relative import in testdata
Bryan C. Mills [Tue, 5 Mar 2019 22:45:39 +0000 (17:45 -0500)]
runtime: do not use a relative import in testdata

Relative imports do not work in module mode. Use a fully-qualified
import path instead.

Updates #30228

Change-Id: I0a42ffa521a7b513395e7e1788022d24cbb1f31a
Reviewed-on: https://go-review.googlesource.com/c/go/+/165817
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
6 years agotest/bench/go1: add go.mod file
Bryan C. Mills [Tue, 5 Mar 2019 17:01:18 +0000 (12:01 -0500)]
test/bench/go1: add go.mod file

cmd/dist executes 'go test' within this directory, so it needs a
go.mod file to tell the compiler what package path to use in
diagnostic and debug information.

Updates #30228

Change-Id: Ia313ac06bc0ec4631d415faa20c56cce2ac8dbc5
Reviewed-on: https://go-review.googlesource.com/c/go/+/165498
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agocmd/asm: add arm64 v8.1 atomic instructions
erifan01 [Wed, 12 Dec 2018 08:29:51 +0000 (08:29 +0000)]
cmd/asm: add arm64 v8.1 atomic instructions

This change adds several arm64 v8.1 atomic instructions and test cases.
They are LDADDAx, LDADDLx, LDANDAx, LDANDALx, LDANDLx, LDEORAx, LDEORALx,
LDEORLx, LDORAx, LDORALx, LDORLx, SWPAx and SWPLx. Their form is consistent
with the form of the existing atomic instructions.

For instructions STXRx, STLXRx, STXPx and STLXPx, the second destination
register can't be RSP. This CL also adds a check for this.

LDADDx Rs, (Rb), Rt: *Rb -> Rt, Rs + *Rb -> *Rb
LDANDx Rs, (Rb), Rt: *Rb -> Rt, Rs AND NOT(*Rb) -> *Rb
LDEORx Rs, (Rb), Rt: *Rb -> Rt, Rs EOR *Rb -> *Rb
LDORx  Rs, (Rb), Rt: *Rb -> Rt, Rs OR *Rb -> *Rb

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

6 years agointernal/poll: fix deadlock in Write if len(buf) > maxRW
Wèi Cōngruì [Wed, 6 Mar 2019 03:23:46 +0000 (03:23 +0000)]
internal/poll: fix deadlock in Write if len(buf) > maxRW

fd.l.Lock shouldn't be called in a loop.

Change-Id: I3afbc184aa06a60175c9a39319985b5810ecb144
Reviewed-on: https://go-review.googlesource.com/c/go/+/165598
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years agointernal/poll: make FD.isFile mean whether it isn't socket on Windows
Wèi Cōngruì [Wed, 6 Mar 2019 08:43:27 +0000 (08:43 +0000)]
internal/poll: make FD.isFile mean whether it isn't socket on Windows

Before this change, if a directory was closed twice on Windows,
the returning error would be "use of closed network connection".

Some code assumes FD.isFile means whether the fd isn't a network
socket, which is true on Unix. But isFile reports whether
the fd is a normal file rather than directory or console on Windows.

With this change, isFile will have the same meaning on different
platforms. And the change adds a new field kind to replace isConsole
and isDir.

Change-Id: Ib12265f1e12fa3d0239ae925291128a84be59cc2
GitHub-Last-Rev: 3f031756de6ce0b96c1f102ad280950f4adbf6c2
GitHub-Pull-Request: golang/go#30589
Reviewed-on: https://go-review.googlesource.com/c/go/+/165257
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years agointernal/bytealg: use word-wise comparison for Compare on arm
Tobias Klauser [Tue, 5 Mar 2019 11:09:12 +0000 (12:09 +0100)]
internal/bytealg: use word-wise comparison for Compare on arm

Use word-wise comparison for aligned buffers, otherwise fall back to the
current byte-wise comparison.

name                           old time/op    new time/op    delta
BytesCompare/1-4                 41.3ns ± 0%    36.4ns ± 1%   -11.73%  (p=0.008 n=5+5)
BytesCompare/2-4                 39.5ns ± 0%    39.5ns ± 1%      ~     (p=0.960 n=5+5)
BytesCompare/4-4                 45.3ns ± 0%    41.0ns ± 1%    -9.40%  (p=0.008 n=5+5)
BytesCompare/8-4                 64.8ns ± 1%    44.7ns ± 0%   -31.12%  (p=0.008 n=5+5)
BytesCompare/16-4                86.3ns ± 0%    55.1ns ± 0%   -36.21%  (p=0.008 n=5+5)
BytesCompare/32-4                 135ns ± 0%      70ns ± 1%   -47.73%  (p=0.008 n=5+5)
BytesCompare/64-4                 231ns ± 1%      99ns ± 0%   -57.27%  (p=0.016 n=5+4)
BytesCompare/128-4                424ns ± 0%     147ns ± 0%   -65.31%  (p=0.000 n=4+5)
BytesCompare/256-4                810ns ± 0%     243ns ± 0%   -69.96%  (p=0.008 n=5+5)
BytesCompare/512-4               1.59µs ± 0%    0.44µs ± 0%   -72.43%  (p=0.008 n=5+5)
BytesCompare/1024-4              3.14µs ± 1%    0.83µs ± 1%   -73.56%  (p=0.008 n=5+5)
BytesCompare/2048-4              6.23µs ± 0%    1.61µs ± 1%   -74.21%  (p=0.008 n=5+5)
CompareBytesEqual-4              79.4ns ± 0%    52.2ns ± 0%   -34.23%  (p=0.008 n=5+5)
CompareBytesToNil-4              31.0ns ± 0%    30.3ns ± 0%    -2.32%  (p=0.008 n=5+5)
CompareBytesEmpty-4              25.7ns ± 0%    25.7ns ± 0%      ~     (p=0.556 n=4+5)
CompareBytesIdentical-4          25.7ns ± 0%    25.7ns ± 0%      ~     (p=1.000 n=5+5)
CompareBytesSameLength-4         49.1ns ± 0%    48.5ns ± 0%    -1.26%  (p=0.008 n=5+5)
CompareBytesDifferentLength-4    49.8ns ± 1%    49.3ns ± 0%    -1.08%  (p=0.008 n=5+5)
CompareBytesBigUnaligned-4       5.71ms ± 1%    5.68ms ± 1%      ~     (p=0.222 n=5+5)
CompareBytesBig-4                4.95ms ± 0%    2.28ms ± 1%   -53.81%  (p=0.008 n=5+5)
CompareBytesBigIdentical-4       27.2ns ± 1%    27.3ns ± 1%      ~     (p=0.310 n=5+5)

name                           old speed      new speed      delta
CompareBytesBigUnaligned-4      184MB/s ± 1%   185MB/s ± 1%      ~     (p=0.222 n=5+5)
CompareBytesBig-4               212MB/s ± 0%   459MB/s ± 1%  +116.51%  (p=0.008 n=5+5)
CompareBytesBigIdentical-4     38.5TB/s ± 0%  38.4TB/s ± 1%      ~     (p=0.421 n=5+5)

Also, this reduces time for TestCompareBytes by about 20 sec on a
linux-arm builder via gomote.

Updates #29001

Change-Id: I25f148739b9ccb7cb1fc97b3d8763549b0a66c16
Reviewed-on: https://go-review.googlesource.com/c/go/+/165338
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
6 years agocmd/link: fix moduledata symbols for aix/ppc64 and external linking
Clément Chigot [Wed, 20 Feb 2019 15:20:56 +0000 (16:20 +0100)]
cmd/link: fix moduledata symbols for aix/ppc64 and external linking

Moduledata symbols like runtime.data or runtime.text must have the
same position in the final executable (as some symbol accesses are made
by offset from them).
ld on AIX might move them randomly if there are nil size symbols.

ld will also remove unreachable symbols like runtime.epclntab or
runtime.rodata. In order to keep them, R_REF relocations are created
between firstmoduledata and these symbols. This relocation tells ld to
keep these symbols even if there aren't reachable.

Change-Id: Ie5a28cf406977131cec6442f7f5b6fd89fb775a3
Reviewed-on: https://go-review.googlesource.com/c/go/+/164004
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years agocmd/link, runtime: allow external linking for aix/ppc64
Clément Chigot [Wed, 20 Feb 2019 15:16:38 +0000 (16:16 +0100)]
cmd/link, runtime: allow external linking for aix/ppc64

This commit adds external linking in cmd/link for aix/ppc64.
As relocations on .text data aren't possible on AIX, Segrelrodata is
used to move all these datas to .data section.

Change-Id: I4d1361c1fc9290e11e6f5560864460c76551dbeb
Reviewed-on: https://go-review.googlesource.com/c/go/+/164003
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 agofmt: rewrite if-else-if-else chain to switch statement
Motkov.Kirill [Wed, 6 Mar 2019 11:16:14 +0000 (11:16 +0000)]
fmt: rewrite if-else-if-else chain to switch statement

This commit rewrites if-else-if-else chain in scanBasePrefix function as a switch.

Based on Go style guide https://golang.org/doc/effective_go.html#switch

Change-Id: I6392bfd4ad0384f3dc8896de4763bb2164c3eead
GitHub-Last-Rev: 9bd8dfdac03c466bf8cacf3119f6245dfb61c009
GitHub-Pull-Request: golang/go#30621
Reviewed-on: https://go-review.googlesource.com/c/go/+/165619
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years agosyscall: fix hang when using Unshareflags: CLONE_NEWUSER with uid/gid mapping (linux)
Michael Stapelberg [Thu, 17 Jan 2019 15:20:51 +0000 (16:20 +0100)]
syscall: fix hang when using Unshareflags: CLONE_NEWUSER with uid/gid mapping (linux)

Note that this particular combination of properties still fails (EPERM), but it
no longer hangs.

Updates #29789

Change-Id: I29b15b85a25a7acd7ae89ffc5fed074bcdfe0a12
Reviewed-on: https://go-review.googlesource.com/c/go/+/158297
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years agonet/mail: better error in ParseAddress when missing "@domain"
Daniel Martí [Tue, 5 Mar 2019 22:31:37 +0000 (22:31 +0000)]
net/mail: better error in ParseAddress when missing "@domain"

If the input was "John Doe", we're definitely missing "<email>", as
"John Doe@domain" isn't a valid email address.

However, if the input was "john.doe", it's possible that the user meant
"john.doe@domain", and not just "john.doe <email>". Make it clear in the
error that either could be the source of the problem.

Fixes #27064.

Change-Id: I1b8f1342775d711823dffc3db974898ee62d3a34
Reviewed-on: https://go-review.googlesource.com/c/go/+/165517
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agonet/http: remove discrepancies between the MIME Sniffing Spec and its implementation
Kshitij Saraogi [Mon, 4 Mar 2019 10:59:25 +0000 (16:29 +0530)]
net/http: remove discrepancies between the MIME Sniffing Spec and its implementation

The change fixes the following deviations between the existing implementation and the Spec:
1. Using pattern instead of "mask" for assertion and iteration in the Pattern Matching Algorithm.
2. Rename "image/vnd.microsoft.icon" to "image/x-icon" and add another signature for the same.
3. Using named strings instead of hexadecimal representation in "application/zip" and "application/x-rar-compressed".
4. Reordering "sniffSignatures" in accordance with the Spec section "Identifying a resource with an unknown MIME type".

In addition to the above fixes, unit tests for Image MIME type group are added.

Fixes #30570

Change-Id: I97d2ae22b426c3c57bf8efd2ed9396c0be983688
Reviewed-on: https://go-review.googlesource.com/c/go/+/165277
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

6 years agogo/parser: include more comments in a struct or interface
Agniva De Sarker [Mon, 4 Feb 2019 07:31:11 +0000 (13:01 +0530)]
go/parser: include more comments in a struct or interface

While parsing inside a struct or an interface, skipping over empty lines
too to collect the next group of comments. We do not need to skip
over more than 1 empty line since gofmt already removes multiple
empty consecutive lines.

Fixes #10858

Change-Id: I0c97b65b5fc44e225e5dc7871ace24f43419ce08
Reviewed-on: https://go-review.googlesource.com/c/go/+/161177
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
6 years agoruntime: disable TestGdbAutotmpTypes in short mode on aix/ppc64
Clément Chigot [Thu, 28 Feb 2019 08:13:56 +0000 (09:13 +0100)]
runtime: disable TestGdbAutotmpTypes in short mode on aix/ppc64

TestGdbAutotmpTypes takes more than one minute due to gdb performances.
Therefore, it must be skipped in short mode.

Change-Id: I253ebce62264cc7367c9b0f6ce9c5088a9994641
Reviewed-on: https://go-review.googlesource.com/c/go/+/164339
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

6 years agocmd/link: support dwarf64 when writing .debug_frame
Clément Chigot [Mon, 7 Jan 2019 09:22:42 +0000 (10:22 +0100)]
cmd/link: support dwarf64 when writing .debug_frame

Fixes #28558

Change-Id: I0ecd9c47fb017cf4bd44725a83a0016c7bb94633
Reviewed-on: https://go-review.googlesource.com/c/go/+/156478
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years agoruntime/cgo: add port for aix/ppc64
Clément Chigot [Wed, 20 Feb 2019 15:05:23 +0000 (16:05 +0100)]
runtime/cgo: add port for aix/ppc64

This commit add port of runtime/cgo for aix/ppc64.
AIX assembly is different from Linux assembly, therefore gcc_ppc64.S
must be redone for AIX.

Change-Id: I780ebab4ef9c4ce912f4c4d521d8c135b1eebf6e
Reviewed-on: https://go-review.googlesource.com/c/go/+/164002
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years agonet/http: add request file upload benchmarks
Chris Marchesi [Wed, 6 Mar 2019 03:44:48 +0000 (03:44 +0000)]
net/http: add request file upload benchmarks

This adds benchmarks to test file uploads using PUT requests.

It's designed to complement changes https://golang.org/cl/163599 and
https://golang.org/cl/163737, allowing an easy comparison of
performance before and after these changes are applied.

Updates #30377.

Co-authored-by: Emmanuel Odeke <emm.odeke@gmail.com>
Change-Id: Ib8e692c61e1f7957d88c7101669d4f7fb8110c65
GitHub-Last-Rev: 242622b4fca9f289defa2f268efc31208743e5dd
GitHub-Pull-Request: golang/go#30424
Reviewed-on: https://go-review.googlesource.com/c/go/+/163862
Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
6 years agodoc: sort map output in Effective Go
Rob Pike [Wed, 6 Mar 2019 00:56:06 +0000 (11:56 +1100)]
doc: sort map output in Effective Go

And explain that it does this. A minor change probably worth mentioning,
although (#28782) I'd still like to freeze this document against any substantial
changes.

Fix #30568.

Change-Id: I74c56744871cfaf00dc52a9b480ca61d3ed19a6b
Reviewed-on: https://go-review.googlesource.com/c/go/+/165597
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agogo/doc: add // while wrapping a line comment in ToText
Agniva De Sarker [Wed, 20 Feb 2019 08:03:30 +0000 (13:33 +0530)]
go/doc: add // while wrapping a line comment in ToText

Currently, lineWrapper does not detect if it is printing a line comment or not.
Hence, while wrapping a comment, the new line does not get prefixed with a //.

We add logic to lineWrapper to detect this case and add // accordingly. Block
comments do not need any such handling.

Added tests for both cases.

Fixes #20929

Change-Id: I656037c2d865f31dd853cf9195f43ab7c6e6fc53
Reviewed-on: https://go-review.googlesource.com/c/go/+/163578
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
6 years agoruntime: introduce effective GOGC, eliminate heap_marked hacks
Austin Clements [Mon, 25 Sep 2017 19:29:08 +0000 (15:29 -0400)]
runtime: introduce effective GOGC, eliminate heap_marked hacks

Currently, the pacer assumes the goal growth ratio is always exactly
GOGC/100. But sometimes this isn't the case, like when the heap is
very small (limited by heapminimum). So to placate the pacer, we lie
about the value of heap_marked in such situations.

Right now, these two lies make a truth, but GOGC is about to get more
complicated with the introduction of heap limits.

Rather than introduce more lies into the system to handle this,
introduce the concept of an "effective GOGC", which is the GOGC we're
actually using for pacing (we'll need this concept anyway with heap
limits). This commit changes the pacer to use the effective GOGC
rather than the user-set GOGC. This way, we no longer need to lie
about heap_marked because its true value is incorporated into the
effective GOGC.

Change-Id: I5b005258f937ab184ffcb5e76053abd798d542bd
Reviewed-on: https://go-review.googlesource.com/c/go/+/66092
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Rick Hudson <rlh@golang.org>
6 years agoruntime: don't use GOGC in minimum sweep distance
Austin Clements [Mon, 25 Sep 2017 19:17:28 +0000 (15:17 -0400)]
runtime: don't use GOGC in minimum sweep distance

Currently, the minimum sweep distance is 1MB * GOGC/100. It's been
this way since it was introduced in CL 13043 with no justification.

Since there seems to be no good reason to scale the minimum sweep
distance by GOGC, make the minimum sweep distance just 1MB.

Change-Id: I5320574a23c0eec641e346282aab08a3bbb057da
Reviewed-on: https://go-review.googlesource.com/c/go/+/66091
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Rick Hudson <rlh@golang.org>
6 years agoruntime: compute goal first in gcSetTriggerRatio
Austin Clements [Wed, 21 Jun 2017 16:11:52 +0000 (12:11 -0400)]
runtime: compute goal first in gcSetTriggerRatio

This slightly rearranges gcSetTriggerRatio to compute the goal before
computing the other controls. This will simplify implementing the heap
limit, which needs to control the absolute goal and flow the rest of
the control parameters from this.

For #16843.

Change-Id: I46b7c1f8b6e4edbee78930fb093b60bd1a03d75e
Reviewed-on: https://go-review.googlesource.com/c/go/+/46750
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Rick Hudson <rlh@golang.org>
6 years agoruntime: remove unused gcTriggerAlways
Austin Clements [Mon, 25 Sep 2017 19:01:29 +0000 (15:01 -0400)]
runtime: remove unused gcTriggerAlways

This was used during the implementation of concurrent runtime.GC() but
now there's nothing that triggers GC unconditionally. Remove this
trigger type and simplify (gcTrigger).test() accordingly.

Change-Id: I17a893c2ed1f661b8146d7783d529f71735c9105
Reviewed-on: https://go-review.googlesource.com/c/go/+/66090
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Rick Hudson <rlh@golang.org>
6 years agonet/http: add corner cases for readCookiesTests
sergey [Sun, 3 Mar 2019 13:38:04 +0000 (16:38 +0300)]
net/http: add corner cases for readCookiesTests

The following corner cases for readCookiesTests are tested now:
 - An extra cookie delimiter ";" at the end of a Cookie header
 - An empty Cookie header

Change-Id: Id8028b448e4182613fb261bf0903efc98cbf4997
Reviewed-on: https://go-review.googlesource.com/c/go/+/164702
Reviewed-by: Volker Dobler <dr.volker.dobler@gmail.com>
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

6 years agocmd/compile: regenerate op_string
Keith Randall [Tue, 5 Mar 2019 20:37:25 +0000 (12:37 -0800)]
cmd/compile: regenerate op_string

I missed regenerating op_string.go in CL 152537 (adding OINLMARK op).

Change-Id: I929540087b817b6a1b0256c1e65341615e61ef40
Reviewed-on: https://go-review.googlesource.com/c/go/+/165359
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
6 years agoruntime: handle syscalls without g or m for aix/ppc64
Clément Chigot [Wed, 20 Feb 2019 15:01:22 +0000 (16:01 +0100)]
runtime: handle syscalls without g or m for aix/ppc64

With cgo, some syscalls will be called with g == nil or m == nil.
SyscallX functions cannot handle them so they call an equivalent
function in sys_aix_ppc64.s which will directly call this syscall.

Change-Id: I6508ec772b304111330e6833e7db729200af547c
Reviewed-on: https://go-review.googlesource.com/c/go/+/164001
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years agoall: join a few chained ifs
Daniel Martí [Tue, 5 Mar 2019 20:21:17 +0000 (20:21 +0000)]
all: join a few chained ifs

I had been finding these over a year or so, but none were big enough
changes to warrant CLs. They're a handful now, so clean them all up in a
single commit.

The smaller bodies get a bit simpler, but most importantly, the larger
bodies get unindented.

Change-Id: I5707a6fee27d4c9ff9efd3d363af575d7a4bf2aa
Reviewed-on: https://go-review.googlesource.com/c/go/+/165340
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

6 years agoencoding/base64: do not slice past output unnecessarily
Russ Cox [Fri, 1 Mar 2019 17:03:41 +0000 (12:03 -0500)]
encoding/base64: do not slice past output unnecessarily

Base64-encoding 32 bytes results in a 44-byte string.
While in general a 44-byte string might decode to 33 bytes,
if you take a 44-byte string that actually only encodes 32 bytes,
and you try to decode it into 32 bytes, that should succeed.
Instead it fails trying to do a useless dst[33:] slice operation.
Delete that slice operation.

Noticed while preparing CL 156322.

Change-Id: I8024bf28a65e2638675b980732b2ff91c66c62cf
Reviewed-on: https://go-review.googlesource.com/c/go/+/164628
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years agotest: skip mutex Unlock inlining tests on a few builders
Alberto Donizetti [Tue, 5 Mar 2019 17:21:08 +0000 (18:21 +0100)]
test: skip mutex Unlock inlining tests on a few builders

Fix builder breakage from CL 148958.

This is an inlining test that should be skipped on -N -l.

The inlining also doesn't happen on arm and wasm, so skip the test
there too.

Fixes the noopt builder, the linux-arm builder, and the wasm builder.

Updates #30605

Change-Id: I06b90d595be7185df61db039dd225dc90d6f678f
Reviewed-on: https://go-review.googlesource.com/c/go/+/165339
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agoall: add -mod=vendor to GOFLAGS in tests that execute 'go' commands within std or cmd
Bryan C. Mills [Tue, 5 Mar 2019 13:51:44 +0000 (08:51 -0500)]
all: add -mod=vendor to GOFLAGS in tests that execute 'go' commands within std or cmd

Updates #30228
Updates #30240
Updates #30241

Change-Id: Idc311ba77e99909318b5b86f8ef82d4878f73e47
Reviewed-on: https://go-review.googlesource.com/c/go/+/165378
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
6 years agocmd/go/internal/modload: do not fetch modules in searchPackages if -mod=vendor is set
Bryan C. Mills [Tue, 5 Mar 2019 14:28:50 +0000 (09:28 -0500)]
cmd/go/internal/modload: do not fetch modules in searchPackages if -mod=vendor is set

Updates #30228
Updates #30241

Change-Id: I6b5f842d00ba273ed241abe55a1ea71c105ec284
Reviewed-on: https://go-review.googlesource.com/c/go/+/165377
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
6 years agoencoding/hex: simplify encoder arithmetic
Daniel Martí [Sun, 25 Nov 2018 23:02:28 +0000 (23:02 +0000)]
encoding/hex: simplify encoder arithmetic

Two additions are faster than two multiplications and one addition. The
code seems simpler to me too, as it's more obvious that we advance two
destination bytes for each source byte.

name            old time/op  new time/op  delta
Encode/256-8     374ns ± 0%   331ns ± 0%  -11.44%  (p=0.008 n=5+5)
Encode/1024-8   1.47µs ± 0%  1.29µs ± 0%  -11.89%  (p=0.004 n=6+5)
Encode/4096-8   5.85µs ± 1%  5.15µs ± 0%  -11.89%  (p=0.004 n=6+5)
Encode/16384-8  23.3µs ± 0%  20.6µs ± 0%  -11.68%  (p=0.004 n=6+5)

Change-Id: Iabc63616c1d9fded55fa668ff41dd49efeaa2ea4
Reviewed-on: https://go-review.googlesource.com/c/go/+/151198
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: roger peppe <rogpeppe@gmail.com>
6 years agoos: add UserConfigDir
Daniel Martí [Sat, 2 Feb 2019 11:40:55 +0000 (11:40 +0000)]
os: add UserConfigDir

After UserCacheDir and UserHomeDir, the only remaining piece which is
commonly needed and portable is a per-user directory to store persistent
files.

For that purpose, UserCacheDir is wrong, as it's meant only for
temporary files. UserHomeDir is also far from ideal, as that clutters
the user's home directory.

Add UserConfigDir, which is implemented in a similar manner to
UserConfigDir.

Fixes #29960.

Change-Id: I7d7a56615103cf76e2b5e2bab2029a6b09d19f0b
Reviewed-on: https://go-review.googlesource.com/c/go/+/160877
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agonet: fix fd leak with interfaces on aix/ppc64
Clément Chigot [Tue, 5 Mar 2019 15:05:07 +0000 (16:05 +0100)]
net: fix fd leak with interfaces on aix/ppc64

To retrieve MTU on aix/ppc64, a socket must be created. Previously, this
socket was recreated for each interface and not close at all, causing a
fd leak on software using interface API.

Change-Id: Ib573e234bfce58964935831b68d007bfbd923476
Reviewed-on: https://go-review.googlesource.com/c/go/+/165397
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agosync: allow inlining the Mutex.Unlock fast path
Carlo Alberto Ferraris [Fri, 9 Nov 2018 23:28:44 +0000 (08:28 +0900)]
sync: allow inlining the Mutex.Unlock fast path

Make use of the newly-enabled limited midstack inlining.
Similar changes will be done in followup CLs.

name                    old time/op  new time/op  delta
MutexUncontended        19.3ns ± 1%  18.9ns ± 0%   -1.92%  (p=0.000 n=20+19)
MutexUncontended-4      5.24ns ± 0%  4.75ns ± 1%   -9.25%  (p=0.000 n=20+20)
MutexUncontended-16     2.10ns ± 0%  2.05ns ± 0%   -2.38%  (p=0.000 n=15+19)
Mutex                   19.6ns ± 0%  19.3ns ± 1%   -1.92%  (p=0.000 n=20+17)
Mutex-4                 54.6ns ± 5%  52.4ns ± 4%   -4.09%  (p=0.000 n=20+20)
Mutex-16                 133ns ± 5%   139ns ± 2%   +4.23%  (p=0.000 n=20+16)
MutexSlack              33.4ns ± 2%  18.9ns ± 1%  -43.56%  (p=0.000 n=19+20)
MutexSlack-4             206ns ± 5%   225ns ± 8%   +9.12%  (p=0.000 n=20+18)
MutexSlack-16           89.4ns ± 1%  98.4ns ± 1%  +10.10%  (p=0.000 n=18+17)
MutexWork               60.5ns ± 0%  58.2ns ± 3%   -3.75%  (p=0.000 n=12+20)
MutexWork-4              105ns ± 5%   103ns ± 7%   -1.68%  (p=0.007 n=20+20)
MutexWork-16             157ns ± 1%   163ns ± 2%   +3.90%  (p=0.000 n=18+18)
MutexWorkSlack          70.2ns ± 5%  57.7ns ± 1%  -17.81%  (p=0.000 n=19+20)
MutexWorkSlack-4         277ns ±13%   276ns ±13%     ~     (p=0.682 n=20+19)
MutexWorkSlack-16        156ns ± 0%   147ns ± 0%   -5.62%  (p=0.000 n=16+14)
MutexNoSpin              966ns ± 0%   968ns ± 0%   +0.11%  (p=0.029 n=15+20)
MutexNoSpin-4            269ns ± 4%   270ns ± 2%     ~     (p=0.807 n=20+19)
MutexNoSpin-16           122ns ± 0%   120ns ± 4%   -1.63%  (p=0.000 n=19+19)
MutexSpin               3.13µs ± 0%  3.13µs ± 1%   +0.16%  (p=0.004 n=18+20)
MutexSpin-4              826ns ± 1%   832ns ± 2%   +0.74%  (p=0.000 n=19+16)
MutexSpin-16             397ns ± 1%   395ns ± 0%   -0.50%  (p=0.000 n=19+17)
RWMutexUncontended      71.4ns ± 0%  69.5ns ± 0%   -2.72%  (p=0.000 n=16+20)
RWMutexUncontended-4    18.4ns ± 4%  17.5ns ± 0%   -4.92%  (p=0.000 n=20+18)
RWMutexUncontended-16   8.01ns ± 0%  7.92ns ± 0%   -1.15%  (p=0.000 n=18+18)
RWMutexWrite100         24.9ns ± 0%  24.9ns ± 1%     ~     (p=0.099 n=19+20)
RWMutexWrite100-4       46.5ns ± 3%  46.2ns ± 4%     ~     (p=0.253 n=17+19)
RWMutexWrite100-16      68.9ns ± 3%  69.9ns ± 5%   +1.46%  (p=0.012 n=18+20)
RWMutexWrite10          27.1ns ± 0%  27.0ns ± 2%     ~     (p=0.128 n=17+20)
RWMutexWrite10-4        34.8ns ± 1%  34.7ns ± 2%     ~     (p=0.180 n=20+18)
RWMutexWrite10-16       37.5ns ± 2%  37.2ns ± 4%   -0.89%  (p=0.023 n=20+20)
RWMutexWorkWrite100      164ns ± 0%   164ns ± 0%     ~     (p=0.106 n=12+20)
RWMutexWorkWrite100-4    186ns ± 3%   193ns ± 3%   +3.46%  (p=0.000 n=20+20)
RWMutexWorkWrite100-16   204ns ± 2%   210ns ± 3%   +2.96%  (p=0.000 n=18+20)
RWMutexWorkWrite10       153ns ± 0%   153ns ± 0%   -0.20%  (p=0.017 n=20+19)
RWMutexWorkWrite10-4     179ns ± 1%   178ns ± 2%     ~     (p=0.215 n=19+20)
RWMutexWorkWrite10-16    191ns ± 1%   192ns ± 2%     ~     (p=0.166 n=15+19)

linux/amd64 bin/go 14630572 (previous commit 14605947, +24625/+0.17%)

Change-Id: I3f9d1765801fe0b8deb1bc2728b8bba8a7508e23
Reviewed-on: https://go-review.googlesource.com/c/go/+/148958
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agonet/http: support configuring redirect fetch option
Johan Brandhorst [Sun, 3 Mar 2019 20:16:13 +0000 (20:16 +0000)]
net/http: support configuring redirect fetch option

Adds a magic header value that is translated to the
Fetch API redirect option, following existing practices.

Updates #26769

Change-Id: Iaf1c9f710de63ea941a360b73f1b4bb725331a35
Reviewed-on: https://go-review.googlesource.com/c/go/+/164666
Reviewed-by: Richard Musiol <neelance@gmail.com>
Reviewed-by: Agniva De Sarker <agniva.quicksilver@gmail.com>
Run-TryBot: Agniva De Sarker <agniva.quicksilver@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

6 years agoencoding/json: add Path to UnmarshalTypeError
LE Manh Cuong [Sat, 27 Oct 2018 18:44:09 +0000 (01:44 +0700)]
encoding/json: add Path to UnmarshalTypeError

When parsing nested object, UnmarshalTypeError does not contain actual
path to nested field in original JSON.

This commit change Field to contain the full path to that field. One
can get the Field name by stripping all the leading path elements.

Fixes #22369

Change-Id: I6969cc08abe8387a351e3fb2944adfaa0dccad2a
Reviewed-on: https://go-review.googlesource.com/c/go/+/145218
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>

6 years agocmd/compile: fix mips64 instruction UNPREDICTABLE bug
hengwu0 [Tue, 5 Mar 2019 01:24:35 +0000 (01:24 +0000)]
cmd/compile: fix mips64 instruction UNPREDICTABLE bug

Replace addu with a sll instruction with a definite behavior (sll will discard the upper 32 bits of the 64 bits, then do sign extensions, with certain behavior). It won't have any UNPREDICTABLE expectation.

Fixes #30459

Change-Id: Id79085c28c5cc4f86939b4ef08ef4bff46077c45
GitHub-Last-Rev: 03569796a9a64ed6c7d56a5bca966fc62c89b4ff
GitHub-Pull-Request: golang/go#30461
Reviewed-on: https://go-review.googlesource.com/c/go/+/164758
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

6 years agosyscall: on ARM GNU/Linux let Pipe fall back to pipe
Ian Lance Taylor [Tue, 5 Mar 2019 02:28:51 +0000 (18:28 -0800)]
syscall: on ARM GNU/Linux let Pipe fall back to pipe

Android O seems to require Pipe to call the pipe2 system call.
But kernel version 2.6.23 only supports pipe, not pipe2.
So try pipe2 first, then fall back to pipe.

Fixes #30549

Change-Id: I3c5d86e8e945a5ec8a0ecea7853302952c0476c4
Reviewed-on: https://go-review.googlesource.com/c/go/+/165217
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agoos: simplify check whether to run subtest of TestRemoveAll
Leon Klingele [Sun, 3 Mar 2019 13:10:59 +0000 (13:10 +0000)]
os: simplify check whether to run subtest of TestRemoveAll

Change-Id: Ic5b46cfb393f5ba7b91b3fb73b158b0bc238a532
GitHub-Last-Rev: e5c5db51bcc4848d807b0ce45e85c022492b2013
GitHub-Pull-Request: golang/go#30019
Reviewed-on: https://go-review.googlesource.com/c/go/+/160443
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 agocmd/go: pass -X64 to ar on aix/ppc64
Clément Chigot [Thu, 28 Feb 2019 08:55:27 +0000 (09:55 +0100)]
cmd/go: pass -X64 to ar on aix/ppc64

On aix/ppc64, ar tool must always have -X64 argument if it aims to
create 64 bits archives.

This commit also adds the -D flag handler when calling ar with
gccgotoolchain, to match gccgo version.

Change-Id: I1f5750f8f64a7073780d283567f0b60fc7fa5b97
Reviewed-on: https://go-review.googlesource.com/c/go/+/164417
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years agoruntime: use AIX C ABI in asmcgocall
Clément Chigot [Wed, 20 Feb 2019 14:59:05 +0000 (15:59 +0100)]
runtime: use AIX C ABI in asmcgocall

The commit fixes asmcgocall in order to use the AIX C ABI.

Change-Id: I2a44914a65557a841ea1e12991938af26ad7fd1d
Reviewed-on: https://go-review.googlesource.com/c/go/+/164000
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years agopath/filepath: don't discard .. in EvalSymlinks
Ian Lance Taylor [Fri, 1 Mar 2019 20:31:18 +0000 (12:31 -0800)]
path/filepath: don't discard .. in EvalSymlinks

EvalSymlinks was mishandling cases like "/x/../../y" or "../../../x"
where there is an extra ".." that goes past the start of the path.

Fixes #30520

Change-Id: I07525575f83009032fa1a99aa270c8d42007d276
Reviewed-on: https://go-review.googlesource.com/c/go/+/164762
Reviewed-by: Bryan C. Mills <bcmills@google.com>
6 years agotesting: fix missing verb in StartTimer doc
Emmanuel T Odeke [Mon, 4 Mar 2019 23:02:45 +0000 (15:02 -0800)]
testing: fix missing verb in StartTimer doc

Fixes StartTimer's doc with the verb 'be'
that was previously missing in 'can also used'.

Change-Id: I4b3e6103fbf62d676056d32fcce4618536b7c05c
Reviewed-on: https://go-review.googlesource.com/c/go/+/165117
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agostrconv: simplify (*extFloat).Multiply using math/bits.Mul64
Rémy Oudompheng [Sun, 13 Jan 2019 17:10:19 +0000 (18:10 +0100)]
strconv: simplify (*extFloat).Multiply using math/bits.Mul64

This method was using a handwritten long multiplication of uint64s.
Since implementation of #24813 we can remove it and replace it
by Mul64 from math/bits.

This brings a small speedup for 64-bit platforms.

Benchmarks on Haswell Celeron 2955U.

benchmark                                  old ns/op     new ns/op     delta
BenchmarkAppendFloat/Decimal-2             127           127           +0.00%
BenchmarkAppendFloat/Float-2               340           317           -6.76%
BenchmarkAppendFloat/Exp-2                 258           233           -9.69%
BenchmarkAppendFloat/NegExp-2              256           231           -9.77%
BenchmarkAppendFloat/Big-2                 402           375           -6.72%
BenchmarkAppendFloat/BinaryExp-2           113           114           +0.88%
BenchmarkAppendFloat/32Integer-2           125           125           +0.00%
BenchmarkAppendFloat/32ExactFraction-2     274           249           -9.12%
BenchmarkAppendFloat/32Point-2             339           317           -6.49%
BenchmarkAppendFloat/32Exp-2               255           229           -10.20%
BenchmarkAppendFloat/32NegExp-2            254           229           -9.84%
BenchmarkAppendFloat/64Fixed1-2            165           154           -6.67%
BenchmarkAppendFloat/64Fixed2-2            184           176           -4.35%
BenchmarkAppendFloat/64Fixed3-2            168           158           -5.95%
BenchmarkAppendFloat/64Fixed4-2            187           177           -5.35%
BenchmarkAppendFloat/Slowpath64-2          84977         84883         -0.11%

Change-Id: If05784e856289b3b7bf136567882e7ee10234756
Reviewed-on: https://go-review.googlesource.com/c/go/+/157717
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
6 years agomath/big: rewrite pure Go implementations to use math/bits
Josh Bleecher Snyder [Sat, 2 Mar 2019 22:42:51 +0000 (14:42 -0800)]
math/big: rewrite pure Go implementations to use math/bits

While we're here, delete addWW_g and subWW_g, per the TODO.
They are now obsolete.

Benchmarks on amd64 with -tags=math_big_pure_go.

name                old time/op    new time/op     delta
AddVV/1-8             5.24ns ± 2%     5.12ns ± 1%    -2.11%  (p=0.000 n=82+87)
AddVV/2-8             6.44ns ± 1%     6.33ns ± 2%    -1.82%  (p=0.000 n=77+82)
AddVV/3-8             7.89ns ± 8%     6.97ns ± 4%   -11.71%  (p=0.000 n=100+96)
AddVV/4-8             8.60ns ± 0%     7.72ns ± 4%   -10.24%  (p=0.000 n=90+96)
AddVV/5-8             10.3ns ± 4%      8.5ns ± 1%   -17.02%  (p=0.000 n=96+91)
AddVV/10-8            16.2ns ± 5%     12.8ns ± 1%   -21.11%  (p=0.000 n=97+86)
AddVV/100-8            148ns ± 1%      117ns ± 5%   -21.07%  (p=0.000 n=66+98)
AddVV/1000-8          1.41µs ± 4%     1.13µs ± 3%   -19.90%  (p=0.000 n=97+97)
AddVV/10000-8         14.2µs ± 5%     11.2µs ± 1%   -20.82%  (p=0.000 n=99+84)
AddVV/100000-8         142µs ± 4%      113µs ± 4%   -20.40%  (p=0.000 n=91+92)
SubVV/1-8             5.29ns ± 1%     5.11ns ± 0%    -3.30%  (p=0.000 n=87+88)
SubVV/2-8             6.36ns ± 4%     6.33ns ± 2%    -0.56%  (p=0.002 n=98+73)
SubVV/3-8             7.58ns ± 5%     6.98ns ± 4%    -8.01%  (p=0.000 n=97+91)
SubVV/4-8             8.61ns ± 3%     7.98ns ± 2%    -7.31%  (p=0.000 n=95+83)
SubVV/5-8             10.6ns ± 2%      8.5ns ± 1%   -19.56%  (p=0.000 n=79+89)
SubVV/10-8            16.3ns ± 4%     12.7ns ± 1%   -21.97%  (p=0.000 n=98+82)
SubVV/100-8            124ns ± 1%      118ns ± 1%    -4.83%  (p=0.000 n=85+81)
SubVV/1000-8          1.14µs ± 5%     1.12µs ± 2%    -1.17%  (p=0.000 n=97+81)
SubVV/10000-8         11.6µs ±10%     11.2µs ± 1%    -3.39%  (p=0.000 n=100+84)
SubVV/100000-8         114µs ± 6%      114µs ± 5%      ~     (p=0.396 n=83+94)
AddVW/1-8             4.04ns ± 4%     4.34ns ± 4%    +7.57%  (p=0.000 n=96+98)
AddVW/2-8             4.34ns ± 5%     4.40ns ± 5%    +1.40%  (p=0.000 n=99+98)
AddVW/3-8             5.43ns ± 0%     5.54ns ± 2%    +1.97%  (p=0.000 n=85+94)
AddVW/4-8             6.23ns ± 1%     6.18ns ± 2%    -0.66%  (p=0.000 n=77+78)
AddVW/5-8             6.78ns ± 2%     6.90ns ± 4%    +1.77%  (p=0.000 n=80+99)
AddVW/10-8            10.5ns ± 4%      9.9ns ± 1%    -5.77%  (p=0.000 n=97+69)
AddVW/100-8            114ns ± 3%       91ns ± 0%   -20.38%  (p=0.000 n=98+77)
AddVW/1000-8          1.12µs ± 1%     0.87µs ± 1%   -22.80%  (p=0.000 n=82+68)
AddVW/10000-8         11.2µs ± 2%      8.5µs ± 5%   -23.85%  (p=0.000 n=85+100)
AddVW/100000-8         112µs ± 2%       85µs ± 5%   -24.22%  (p=0.000 n=71+96)
SubVW/1-8             4.09ns ± 2%     4.18ns ± 4%    +2.32%  (p=0.000 n=78+96)
SubVW/2-8             4.59ns ± 5%     4.52ns ± 7%    -1.54%  (p=0.000 n=98+94)
SubVW/3-8             5.41ns ±10%     5.55ns ± 1%    +2.48%  (p=0.000 n=100+89)
SubVW/4-8             6.51ns ± 2%     6.19ns ± 0%    -4.85%  (p=0.000 n=97+81)
SubVW/5-8             7.25ns ± 3%     6.90ns ± 4%    -4.93%  (p=0.000 n=97+96)
SubVW/10-8            10.6ns ± 4%      9.8ns ± 2%    -7.32%  (p=0.000 n=95+96)
SubVW/100-8           90.4ns ± 0%     90.8ns ± 0%    +0.43%  (p=0.000 n=83+78)
SubVW/1000-8           853ns ± 4%      857ns ± 2%    +0.42%  (p=0.000 n=100+98)
SubVW/10000-8         8.52µs ± 4%     8.53µs ± 2%      ~     (p=0.061 n=99+97)
SubVW/100000-8        84.8µs ± 5%     84.2µs ± 2%    -0.78%  (p=0.000 n=99+93)
AddMulVVW/1-8         8.73ns ± 0%     5.33ns ± 3%   -38.91%  (p=0.000 n=91+96)
AddMulVVW/2-8         14.8ns ± 3%      6.5ns ± 2%   -56.33%  (p=0.000 n=100+79)
AddMulVVW/3-8         18.6ns ± 2%      7.8ns ± 5%   -57.84%  (p=0.000 n=89+96)
AddMulVVW/4-8         24.0ns ± 2%      9.8ns ± 0%   -59.09%  (p=0.000 n=95+67)
AddMulVVW/5-8         29.0ns ± 2%     11.5ns ± 5%   -60.44%  (p=0.000 n=90+97)
AddMulVVW/10-8        54.1ns ± 0%     18.8ns ± 1%   -65.37%  (p=0.000 n=82+84)
AddMulVVW/100-8        508ns ± 2%      165ns ± 4%   -67.62%  (p=0.000 n=72+98)
AddMulVVW/1000-8      4.96µs ± 3%     1.55µs ± 1%   -68.86%  (p=0.000 n=99+91)
AddMulVVW/10000-8     50.0µs ± 4%     15.5µs ± 4%   -68.95%  (p=0.000 n=97+97)
AddMulVVW/100000-8     491µs ± 1%      156µs ± 8%   -68.22%  (p=0.000 n=79+95)

Change-Id: I4c6ae0b4065f371aea8103f6a85d9e9274bf01d0
Reviewed-on: https://go-review.googlesource.com/c/go/+/164965
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
6 years agoos: remove unreadable directories in RemoveAll
Baokun Lee [Mon, 4 Mar 2019 19:10:38 +0000 (03:10 +0800)]
os: remove unreadable directories in RemoveAll

Fixes #30555

Change-Id: Ib894b4f3cdba23a18a69c9470cf69ceb83591a4d
Reviewed-on: https://go-review.googlesource.com/c/go/+/165057
Run-TryBot: Baokun Lee <nototon@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
6 years agomath/big: optimize shlVU_g and shrVU_g
Josh Bleecher Snyder [Sun, 3 Mar 2019 21:08:40 +0000 (13:08 -0800)]
math/big: optimize shlVU_g and shrVU_g

Special case shifts by zero.
Provide hints to the compiler that shifts are bounded.

There are no existing benchmarks for shifts,
but the Float implementation uses shifts,
so we can use those.

Benchmarks on amd64 with -tags=math_big_pure_go.

name                  old time/op    new time/op    delta
FloatString/100-8        869ns ± 3%     872ns ± 4%   +0.40%  (p=0.001 n=94+83)
FloatString/1000-8      26.5µs ± 1%    26.4µs ± 1%   -0.46%  (p=0.000 n=87+96)
FloatString/10000-8     2.18ms ± 2%    2.18ms ± 2%     ~     (p=0.687 n=90+89)
FloatString/100000-8     200ms ± 7%     197ms ± 5%   -1.47%  (p=0.000 n=100+90)
FloatAdd/10-8           65.9ns ± 4%    64.0ns ± 4%   -2.94%  (p=0.000 n=92+93)
FloatAdd/100-8          71.3ns ± 4%    67.4ns ± 4%   -5.51%  (p=0.000 n=96+93)
FloatAdd/1000-8          128ns ± 1%     121ns ± 0%   -5.69%  (p=0.000 n=91+80)
FloatAdd/10000-8         718ns ± 4%     626ns ± 4%  -12.83%  (p=0.000 n=99+99)
FloatAdd/100000-8       6.43µs ± 3%    5.50µs ± 1%  -14.50%  (p=0.000 n=98+83)
FloatSub/10-8           57.7ns ± 2%    57.0ns ± 4%   -1.20%  (p=0.000 n=89+96)
FloatSub/100-8          59.9ns ± 3%    58.7ns ± 4%   -2.10%  (p=0.000 n=100+98)
FloatSub/1000-8         94.5ns ± 1%    88.6ns ± 0%   -6.16%  (p=0.000 n=74+70)
FloatSub/10000-8         456ns ± 1%     416ns ± 5%   -8.83%  (p=0.000 n=87+95)
FloatSub/100000-8       4.00µs ± 1%    3.57µs ± 1%  -10.87%  (p=0.000 n=68+85)
FloatSqrt/64-8           585ns ± 1%     579ns ± 1%   -0.99%  (p=0.000 n=92+90)
FloatSqrt/128-8         1.26µs ± 1%    1.23µs ± 2%   -2.42%  (p=0.000 n=91+81)
FloatSqrt/256-8         1.45µs ± 3%    1.40µs ± 1%   -3.61%  (p=0.000 n=96+90)
FloatSqrt/1000-8        4.03µs ± 1%    3.91µs ± 1%   -3.05%  (p=0.000 n=90+93)
FloatSqrt/10000-8       48.0µs ± 0%    47.3µs ± 1%   -1.55%  (p=0.000 n=90+90)
FloatSqrt/100000-8      1.23ms ± 3%    1.22ms ± 4%   -1.00%  (p=0.000 n=99+99)
FloatSqrt/1000000-8     96.7ms ± 4%    98.0ms ±10%     ~     (p=0.322 n=89+99)

Change-Id: I0f941c05b7c324256d7f0674559b6ba906e92ba8
Reviewed-on: https://go-review.googlesource.com/c/go/+/164967
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
6 years agoruntime: use MADV_FREE_REUSABLE on darwin
Michael Anthony Knyszek [Wed, 23 Jan 2019 17:33:35 +0000 (17:33 +0000)]
runtime: use MADV_FREE_REUSABLE on darwin

Currently on darwin we use MADV_FREE, which unfortunately doesn't result
in a change in the process's RSS until pages actually get kicked out,
which the OS is free to do lazily (e.g. until it finds itself under
memory pressure).

To remedy this, we instead use MADV_FREE_REUSABLE which has similar
semantics, except that it also sets a reusable bit on each page so the
process's RSS gets reported more accurately. The one caveat is for every
time we call MADV_FREE_REUSABLE on a region we must call MADV_FREE_REUSE
to keep the kernel's accounting updated.

Also, because this change requires adding new constants that only exist
on darwin, it splits mem_bsd.go into mem_bsd.go and mem_darwin.go.

Fixes #29844.

Change-Id: Idb6421698511138a430807bcbbd1516cd57557c8
Reviewed-on: https://go-review.googlesource.com/c/go/+/159117
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

6 years agomisc/git: remove pre-commit file
Agniva De Sarker [Sat, 19 Jan 2019 06:49:09 +0000 (12:19 +0530)]
misc/git: remove pre-commit file

All hook files are automatically set up when any git-codereview command is run.
And since the contribution guidelines point to installing git-codereview,
this file does not serve any purpose any more.

Change-Id: I165f6905ca03fd3d512c59e2654ef79e76de934c
Reviewed-on: https://go-review.googlesource.com/c/go/+/158677
Reviewed-by: Andrew Bonventre <andybons@golang.org>
6 years agodoc: make path platform dependent
Carrie Bynon [Fri, 15 Feb 2019 11:16:54 +0000 (22:16 +1100)]
doc: make path platform dependent

Path should now appear with the correct slash, depending on which
platform install document is being viewed - keeping in line with the
rest of the document.

Fixes #30160

Change-Id: Ib10e5a4adf366c700bff6f8d246bd5e3111ed61c
Reviewed-on: https://go-review.googlesource.com/c/go/+/162918
Reviewed-by: Andrew Bonventre <andybons@golang.org>
6 years agocmd/api: fix no go files package panic
Baokun Lee [Tue, 22 Jan 2019 16:22:53 +0000 (00:22 +0800)]
cmd/api: fix no go files package panic

Fixes #29837

Change-Id: I7d57c24d2133932c076df6f41dd6589f777b65dd
Reviewed-on: https://go-review.googlesource.com/c/158877
Run-TryBot: Baokun Lee <nototon@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agoos/exec: less allocs in the common case
Daniel Martí [Sun, 3 Mar 2019 23:52:00 +0000 (23:52 +0000)]
os/exec: less allocs in the common case

When Stdin, Stdout, and Stderr are nil, there are no goroutines to keep
track of, so we don't need a channel.

And in startProcess, preallocate the right size for sysattr.Files,
saving a bit of space and a couple of slice growth allocs.

name            old time/op    new time/op    delta
ExecHostname-8     419µs ± 0%     417µs ± 1%    ~     (p=0.093 n=6+6)

name            old alloc/op   new alloc/op   delta
ExecHostname-8    6.40kB ± 0%    6.28kB ± 0%  -1.86%  (p=0.002 n=6+6)

name            old allocs/op  new allocs/op  delta
ExecHostname-8      34.0 ± 0%      31.0 ± 0%  -8.82%  (p=0.002 n=6+6)

Change-Id: Ic1d617f29e9c6431cdcadc7f9bb992750a6d5f48
Reviewed-on: https://go-review.googlesource.com/c/164801
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agoencoding/csv: document that Writer is buffered
Brian Kessler [Fri, 1 Feb 2019 05:05:49 +0000 (22:05 -0700)]
encoding/csv: document that Writer is buffered

Add documentation that individual Write calls are buffered and
copy documentation from bufio.Writer notifying the user to call
Flush and Error when all writes are complete. Remove reference
to "file" since the implementation is general and allows any
io.Writer.

Fixes #30045

Change-Id: I50165470e548f296494e764707fbabe36c665015
Reviewed-on: https://go-review.googlesource.com/c/160680
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agointernal/poll: copy and use errnoErr to avoid allocations
Josh Bleecher Snyder [Mon, 4 Mar 2019 01:02:14 +0000 (17:02 -0800)]
internal/poll: copy and use errnoErr to avoid allocations

Converting a syscall.Errno to an interface is
a significant source of allocations in os/exec.

Elsewhere in the tree, we have pre-allocated errors
for common errno values. Use the same trick here.

This CL makes yet another copy of this code.
The problem is that there isn't really a great place to share it.

The existing copies are in:

cmd/vendor/golang.org/x/sys/unix
cmd/vendor/golang.org/x/sys/windows
cmd/vendor/golang.org/x/sys/windows/registry
internal/syscall/windows
internal/syscall/windows/registry
syscall

internal/poll can't import from cmd/vendor, and cmd/vendor
can't import from internal/*, so we can ignore cmd/vendor.

We could put the unix version in internal/syscall/unix
and then have a platform-independent wrapper in internal/syscall.
But syscall couldn't use it; internal/syscall/* depends on syscall.
So that only allows code re-use with internal/syscall/windows/*.

We could create a new very low level internal package, internal/errno.
But syscall couldn't use it, because it has to import syscall
to get access to syscall.Errno.
So that only allows code re-use with internal/syscall/windows/*.

It's not clear that that any of these options pulls its weight.

The obvious and "correct" place for this is syscall.
But we can't export syscall's version, because package syscall is frozen.

So just copy the code. There's not much of it.

name            old alloc/op   new alloc/op   delta
ExecHostname-8    6.15kB ± 0%    6.13kB ± 0%  -0.38%  (p=0.000 n=20+19)

name            old allocs/op  new allocs/op  delta
ExecHostname-8      34.0 ± 0%      31.0 ± 0%  -8.82%  (p=0.000 n=20+20)

Fixes #30535

Change-Id: Idd31c7cced6e15387acc698ffc011e1b7b479903
Reviewed-on: https://go-review.googlesource.com/c/164971
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

6 years agoall: rename WebAssembly instructions according to spec changes
Richard Musiol [Wed, 12 Dec 2018 12:04:44 +0000 (13:04 +0100)]
all: rename WebAssembly instructions according to spec changes

The names of some instructions have been updated in the WebAssembly
specification to be more consistent, see
https://github.com/WebAssembly/spec/commit/994591e51c9df9e7ef980b04d660709b79982f75.
This change to the spec is possible because it is still in a draft
state.

Go's support for WebAssembly is still experimental and thus excempt from
the compatibility promise. Being consistent with the spec should
warrant this breaking change to the assembly instruction names.

Change-Id: Iafb8b18ee7f55dd0e23c6c7824aa1fad43117ef1
Reviewed-on: https://go-review.googlesource.com/c/153797
Run-TryBot: Richard Musiol <neelance@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
6 years agocmd/compile: optimize math/bits.Div32 for arm64
erifan01 [Tue, 22 Jan 2019 09:10:59 +0000 (09:10 +0000)]
cmd/compile: optimize math/bits.Div32 for arm64

Benchmark:
name     old time/op  new time/op  delta
Div-8    22.0ns ± 0%  22.0ns ± 0%     ~     (all equal)
Div32-8  6.51ns ± 0%  3.00ns ± 0%  -53.90%  (p=0.000 n=10+8)
Div64-8  22.5ns ± 0%  22.5ns ± 0%     ~     (all equal)

Code:
func div32(hi, lo, y uint32) (q, r uint32) {return bits.Div32(hi, lo, y)}

Before:
        0x0020 00032 (test.go:24)       MOVWU   "".y+8(FP), R0
        0x0024 00036 ($GOROOT/src/math/bits/bits.go:472)        CBZW    R0, 132
        0x0028 00040 ($GOROOT/src/math/bits/bits.go:472)        MOVWU   "".hi(FP), R1
        0x002c 00044 ($GOROOT/src/math/bits/bits.go:472)        CMPW    R1, R0
        0x0030 00048 ($GOROOT/src/math/bits/bits.go:472)        BLS     96
        0x0034 00052 ($GOROOT/src/math/bits/bits.go:475)        MOVWU   "".lo+4(FP), R2
        0x0038 00056 ($GOROOT/src/math/bits/bits.go:475)        ORR     R1<<32, R2, R1
        0x003c 00060 ($GOROOT/src/math/bits/bits.go:476)        CBZ     R0, 140
        0x0040 00064 ($GOROOT/src/math/bits/bits.go:476)        UDIV    R0, R1, R2
        0x0044 00068 (test.go:24)       MOVW    R2, "".q+16(FP)
        0x0048 00072 ($GOROOT/src/math/bits/bits.go:476)        UREM    R0, R1, R0
        0x0050 00080 (test.go:24)       MOVW    R0, "".r+20(FP)
        0x0054 00084 (test.go:24)       MOVD    -8(RSP), R29
        0x0058 00088 (test.go:24)       MOVD.P  32(RSP), R30
        0x005c 00092 (test.go:24)       RET     (R30)

After:
        0x001c 00028 (test.go:24)       MOVWU   "".y+8(FP), R0
        0x0020 00032 (test.go:24)       CBZW    R0, 92
        0x0024 00036 (test.go:24)       MOVWU   "".hi(FP), R1
        0x0028 00040 (test.go:24)       CMPW    R0, R1
        0x002c 00044 (test.go:24)       BHS     84
        0x0030 00048 (test.go:24)       MOVWU   "".lo+4(FP), R2
        0x0034 00052 (test.go:24)       ORR     R1<<32, R2, R4
        0x0038 00056 (test.go:24)       UDIV    R0, R4, R3
        0x003c 00060 (test.go:24)       MSUB    R3, R4, R0, R4
        0x0040 00064 (test.go:24)       MOVW    R3, "".q+16(FP)
        0x0044 00068 (test.go:24)       MOVW    R4, "".r+20(FP)
        0x0048 00072 (test.go:24)       MOVD    -8(RSP), R29
        0x004c 00076 (test.go:24)       MOVD.P  16(RSP), R30
        0x0050 00080 (test.go:24)       RET     (R30)

UREM instruction in the previous assembly code will be converted to UDIV and MSUB instructions
on arm64. However the UDIV instruction in UREM is unnecessary, because it's a duplicate of the
previous UDIV. This CL adds a rule to have this extra UDIV instruction removed by CSE.

Change-Id: Ie2508784320020b2de022806d09f75a7871bb3d7
Reviewed-on: https://go-review.googlesource.com/c/159577
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

6 years agoos/exec: don't use the echo binary for a benchmark
Daniel Martí [Sun, 3 Mar 2019 18:31:33 +0000 (18:31 +0000)]
os/exec: don't use the echo binary for a benchmark

Most notably, it's missing on Windows machines. For example,
windows-amd64-race started failing consistently:

--- FAIL: BenchmarkExecEcho
    bench_test.go:15: could not find echo: exec: "echo": executable file not found in %PATH%

We can also reproduce this from Linux with Wine:

$ GOOS=windows go test -bench=. -benchtime=1x -run=- -exec wine
--- FAIL: BenchmarkExecEcho
    bench_test.go:15: could not find echo: exec: "echo": executable file not found in %PATH%

Instead, use the "hostname" program, which is available on Windows too.
Interestingly enough, it's also slightly faster than "echo". Any program
is fine as long as it's close enough to a no-op, though.

name        old time/op    new time/op    delta
ExecEcho-8     422µs ± 0%     395µs ± 0%  -6.39%  (p=0.004 n=6+5)

name        old alloc/op   new alloc/op   delta
ExecEcho-8    6.39kB ± 0%    6.42kB ± 0%  +0.53%  (p=0.002 n=6+6)

name        old allocs/op  new allocs/op  delta
ExecEcho-8      36.0 ± 0%      36.0 ± 0%    ~     (all equal)

Change-Id: I772864d69979172b5cf807552c84d0e165e73051
Reviewed-on: https://go-review.googlesource.com/c/164704
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

6 years agomisc/wasm: better adapt to different JavaScript environments
Richard Musiol [Wed, 26 Dec 2018 12:34:47 +0000 (13:34 +0100)]
misc/wasm: better adapt to different JavaScript environments

This change adds support for using wasm with Electron. It refactors
environment detection to a more modular approach instead of explicitly
testing for Node.js.

Fixes #29404

Change-Id: I882a9c56523744e7fd7cb2013d158df91cf91d14
Reviewed-on: https://go-review.googlesource.com/c/164665
Run-TryBot: Richard Musiol <neelance@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agodoc: fix bad lib/time link in 1.12 release notes
Alberto Donizetti [Sun, 3 Mar 2019 17:33:34 +0000 (18:33 +0100)]
doc: fix bad lib/time link in 1.12 release notes

There's a "lib/time" sub-section in the Go 1.12 relase notes that
points to a non-existent golang.org/pkg/lib/time page.

The note is about a change in the tz database in the src/lib/time
directory, but the section's title (and the link) should probably just
refer to the time package.

Change-Id: Ibf9dacd710e72886f14ad0b7415fea1e8d25b83a
Reviewed-on: https://go-review.googlesource.com/c/164977
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agoos/exec: preallocate for Cmd.childFiles
Daniel Martí [Sun, 3 Mar 2019 15:30:24 +0000 (15:30 +0000)]
os/exec: preallocate for Cmd.childFiles

We're always going to add stdin, stdout, and stderr to childFiles, so
its length will be at least three. The final length will be those three
elements plus however many files were given via ExtraFiles.

Allocate for that final length directly, saving two slice growth allocs
in the common case where ExtraFiles is empty.

name        old time/op    new time/op    delta
ExecEcho-8     435µs ± 0%     435µs ± 0%    ~     (p=0.394 n=6+6)

name        old alloc/op   new alloc/op   delta
ExecEcho-8    6.39kB ± 0%    6.37kB ± 0%  -0.39%  (p=0.002 n=6+6)

name        old allocs/op  new allocs/op  delta
ExecEcho-8      36.0 ± 0%      34.0 ± 0%  -5.56%  (p=0.002 n=6+6)

Change-Id: Ib702c0da1e43f0a55ed937af6d45fca6a170e8f3
Reviewed-on: https://go-review.googlesource.com/c/164898
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agocmd/internal/obj/mips: use r instead of p.Reg in call to OP_IRR
Leon Klingele [Sun, 3 Mar 2019 16:42:08 +0000 (16:42 +0000)]
cmd/internal/obj/mips: use r instead of p.Reg in call to OP_IRR

Change-Id: Id77764ed2d693e632e2a7b4e4638c17e0caf2276
GitHub-Last-Rev: 9ebe28252086ddcd530905eb9cf50b4a66413291
GitHub-Pull-Request: golang/go#30003
Reviewed-on: https://go-review.googlesource.com/c/160427
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

6 years agoencoding/base64: lift nil check out of encode loop
Daniel Martí [Sun, 25 Nov 2018 14:53:24 +0000 (14:53 +0000)]
encoding/base64: lift nil check out of encode loop

Most of the encoding time is spent in the first Encode loop, since the
rest of the function only deals with the few remaining bytes. Any
unnecessary work done in that loop body matters tremendously.

One such unnecessary bottleneck was the use of the enc.encode table.
Since enc is a pointer receiver, and the field is first used within the
loop, the encoder must perform a nil check at every iteration.

Add a dummy use of the field before the start of the loop, to move the
nil check there. After that line, the compiler now knows that enc can't
be nil, and thus the hot loop is free of nil checks.

name              old time/op    new time/op    delta
EncodeToString-4    14.7µs ± 0%    13.7µs ± 1%  -6.53%  (p=0.000 n=10+10)

name              old speed      new speed      delta
EncodeToString-4   559MB/s ± 0%   598MB/s ± 1%  +6.99%  (p=0.000 n=10+10)

Updates #20206.

Change-Id: Icbb523a7bd9e470a8be0a448d1d78ade97ed4ff6
Reviewed-on: https://go-review.googlesource.com/c/151158
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agomisc/android: use adb exec-out instead of adb shell to avoid buffering
Elias Naur [Sat, 2 Mar 2019 12:07:54 +0000 (13:07 +0100)]
misc/android: use adb exec-out instead of adb shell to avoid buffering

According to

https://stackoverflow.com/questions/46233200/stop-buffering-of-adb-shell-output

the adb exec-out commands avoids the buffering inherent to adb shell.

Let's see if using exec-out will fix the android builder flakyness where
exitcodes or output were sometimes missing.

Updates #30512 (perhaps fixes it).

Change-Id: Ib953ef0262b20730e0d4c332058d29c5066bfeb2
Reviewed-on: https://go-review.googlesource.com/c/164661
Run-TryBot: Elias Naur <mail@eliasnaur.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agoencoding/pem: skip whitespace work on most inputs
Daniel Martí [Mon, 31 Dec 2018 18:48:21 +0000 (19:48 +0100)]
encoding/pem: skip whitespace work on most inputs

encoding/base64 already skips \r and \n when decoding, so this package
must only deal with spaces and tabs. Those aren't nearly as common, so
we can add a fast path with bytes.ContainsAny to skip the costly alloc
and filtering code.

name      old time/op    new time/op    delta
Decode-8     279µs ± 0%     259µs ± 1%   -7.07%  (p=0.002 n=6+6)

name      old speed      new speed      delta
Decode-8   319MB/s ± 0%   343MB/s ± 1%   +7.61%  (p=0.002 n=6+6)

name      old alloc/op   new alloc/op   delta
Decode-8     164kB ± 0%      74kB ± 0%  -54.90%  (p=0.002 n=6+6)

name      old allocs/op  new allocs/op  delta
Decode-8      12.0 ± 0%      11.0 ± 0%   -8.33%  (p=0.002 n=6+6)

Change-Id: Idfca8700c52f46eb70a4a7e0d2db3bf0124e4699
Reviewed-on: https://go-review.googlesource.com/c/155964
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agosyscall: optimize SlicePtrFromStrings
Josh Bleecher Snyder [Sat, 2 Mar 2019 19:14:46 +0000 (11:14 -0800)]
syscall: optimize SlicePtrFromStrings

Instead of allocating a byte slice for every string,
calculated the required size and create
a single slice big enough to hold all of them.
As an added benefit, any error encountered
will now be returned before allocations occur.

os/exec package benchmarks:

name        old time/op    new time/op    delta
ExecEcho-8    2.14ms ± 1%    2.14ms ± 3%     ~     (p=0.842 n=10+9)

name        old alloc/op   new alloc/op   delta
ExecEcho-8    6.35kB ± 0%    6.18kB ± 0%   -2.65%  (p=0.000 n=10+10)

name        old allocs/op  new allocs/op  delta
ExecEcho-8      69.0 ± 0%      36.0 ± 0%  -47.83%  (p=0.000 n=10+10)

Change-Id: I84118d8473037d873f73903d4e4f6ed14f531ce7
Reviewed-on: https://go-review.googlesource.com/c/164961
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agoos/exec: provide map size hint in dedupEnvCase
Josh Bleecher Snyder [Sat, 2 Mar 2019 19:14:33 +0000 (11:14 -0800)]
os/exec: provide map size hint in dedupEnvCase

The common case is that most env vars are distinct;
optimize for that.

name        old time/op    new time/op    delta
ExecEcho-8    2.16ms ± 3%    2.14ms ± 1%     ~     (p=0.315 n=10+10)

name        old alloc/op   new alloc/op   delta
ExecEcho-8    7.87kB ± 0%    6.35kB ± 0%  -19.31%  (p=0.000 n=9+10)

name        old allocs/op  new allocs/op  delta
ExecEcho-8      72.0 ± 0%      69.0 ± 0%   -4.17%  (p=0.000 n=10+10)

Change-Id: I42bb696c6862f2ea12c5cbd2f24c64336a7a759a
Reviewed-on: https://go-review.googlesource.com/c/164960
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agoos/exec: add BenchmarkExecEcho
Josh Bleecher Snyder [Sat, 2 Mar 2019 19:14:29 +0000 (11:14 -0800)]
os/exec: add BenchmarkExecEcho

Change-Id: Ie955cdc505766447f70b8f262160fe05b60a5b0c
Reviewed-on: https://go-review.googlesource.com/c/164959
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agobufio: fix emptyFinalToken example to handle multiple Reads
Agniva De Sarker [Mon, 14 Jan 2019 08:13:11 +0000 (13:43 +0530)]
bufio: fix emptyFinalToken example to handle multiple Reads

Fixes #25909

Change-Id: I9a53a1a06aab5d1877a8e9b1b8b782d77d6027a8
Reviewed-on: https://go-review.googlesource.com/c/157758
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

6 years agocmd/compile/internal/ssa: ignore error from second call to MatchString in test
Leon Klingele [Mon, 4 Feb 2019 12:44:00 +0000 (12:44 +0000)]
cmd/compile/internal/ssa: ignore error from second call to MatchString in test

Change-Id: I714612b41facc8d1ec22974e8aaf2a5a3592e8f5
GitHub-Last-Rev: a0b3917e45bc1d24590e9c9cb3550da4c4008c49
GitHub-Pull-Request: golang/go#29998
Reviewed-on: https://go-review.googlesource.com/c/160422
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
6 years agoencoding/hex: simplify decoder arithmetic
Daniel Martí [Sun, 25 Nov 2018 23:22:11 +0000 (23:22 +0000)]
encoding/hex: simplify decoder arithmetic

Remove all multiplications and divisions from the main decoding loop.

name            old time/op   new time/op   delta
Decode/256-8      323ns ± 0%    293ns ± 0%   -9.29%  (p=0.000 n=5+4)
Decode/1024-8    1.26µs ± 0%   1.14µs ± 0%   -9.48%  (p=0.000 n=6+5)
Decode/4096-8    4.99µs ± 0%   4.51µs ± 0%   -9.55%  (p=0.002 n=6+6)
Decode/16384-8   20.0µs ± 0%   18.1µs ± 0%   -9.54%  (p=0.002 n=6+6)

name            old speed     new speed     delta
Decode/256-8    791MB/s ± 0%  872MB/s ± 0%  +10.34%  (p=0.002 n=6+6)
Decode/1024-8   814MB/s ± 0%  899MB/s ± 0%  +10.48%  (p=0.004 n=6+5)
Decode/4096-8   821MB/s ± 0%  908MB/s ± 0%  +10.55%  (p=0.002 n=6+6)
Decode/16384-8  821MB/s ± 0%  908MB/s ± 0%  +10.54%  (p=0.002 n=6+6)

Change-Id: Ie9f91242ce04c130a77c1184379e3b9de38fe713
Reviewed-on: https://go-review.googlesource.com/c/151199
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agocmd/internal/obj: stay consistent by defining loop variable outside loop header
Leon Klingele [Wed, 30 Jan 2019 17:35:18 +0000 (17:35 +0000)]
cmd/internal/obj: stay consistent by defining loop variable outside loop header

Change-Id: Ieb0ae01cf393c4983e809ce95fedeaa854d19a99
GitHub-Last-Rev: 908f7565183c1cd19a3fbc47f406d53ad388fb97
GitHub-Pull-Request: golang/go#30004
Reviewed-on: https://go-review.googlesource.com/c/160428
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
6 years agonet/http: make TimeoutHandler's ResponseWriter implement Pusher
LE Manh Cuong [Mon, 17 Dec 2018 04:06:30 +0000 (11:06 +0700)]
net/http: make TimeoutHandler's ResponseWriter implement Pusher

Fixes #29193

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

6 years agoruntime/pprof/internal/profile: use idiomatic swapping
Iskander Sharipov [Mon, 26 Nov 2018 08:40:32 +0000 (11:40 +0300)]
runtime/pprof/internal/profile: use idiomatic swapping

gogrep found only one such case with the pattern below:

$tmp := $x; $x = $y; $y = $tmp

R=1.13

Change-Id: I6e46fb5ef2887f24fa9fc451323a8cef272e2886
Reviewed-on: https://go-review.googlesource.com/c/151200
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
6 years agocmd/go/internal/modfetch: add missing error checks
Leon Klingele [Wed, 30 Jan 2019 17:34:43 +0000 (17:34 +0000)]
cmd/go/internal/modfetch: add missing error checks

Change-Id: I51a9c06384875fbb12db0e05128f23bd23a163a1
GitHub-Last-Rev: 126452f15cbb8e06ff683dcd60e63f1925dcf8f1
GitHub-Pull-Request: golang/go#30000
Reviewed-on: https://go-review.googlesource.com/c/160424
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

6 years agocmd/go/internal/modload: correctly report devel versions
Leon Klingele [Wed, 30 Jan 2019 17:35:01 +0000 (17:35 +0000)]
cmd/go/internal/modload: correctly report devel versions

Change-Id: Ie26b86c7502e41796732caad4d7e254246f70b7f
GitHub-Last-Rev: 3b80c0e4b17ec2b2a5b95e40d5880df2b856c6dd
GitHub-Pull-Request: golang/go#30002
Reviewed-on: https://go-review.googlesource.com/c/160426
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

6 years agocmd/go/internal/work: properly ignore error
Leon Klingele [Wed, 30 Jan 2019 17:34:52 +0000 (17:34 +0000)]
cmd/go/internal/work: properly ignore error

Change-Id: Id0e8d170730d946b60c661d90bc98d0ca7545391
GitHub-Last-Rev: 19fed775b7e87c8c721b4487458354a2d5532a6c
GitHub-Pull-Request: golang/go#30001
Reviewed-on: https://go-review.googlesource.com/c/160425
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

6 years agocmd/link: add missing error check in test
Leon Klingele [Mon, 4 Feb 2019 12:42:55 +0000 (12:42 +0000)]
cmd/link: add missing error check in test

Change-Id: I54998f1b7daa8f8db7a2007b4eb86e9789c03656
GitHub-Last-Rev: 97667ead6f62dad2af0d6b1f78deccef16417044
GitHub-Pull-Request: golang/go#30006
Reviewed-on: https://go-review.googlesource.com/c/160430
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

6 years agocmd/go/internal/modconv: remove unused variables
Leon Klingele [Wed, 30 Jan 2019 17:34:34 +0000 (17:34 +0000)]
cmd/go/internal/modconv: remove unused variables

Change-Id: I429db8dca219fb931f7b05ce7a7324e8c4ba935b
GitHub-Last-Rev: 2257a5bf23e7d79f54bedba2c2bed8c59bb6114c
GitHub-Pull-Request: golang/go#29999
Reviewed-on: https://go-review.googlesource.com/c/160423
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

6 years agoencoding/base64: remove ineffectual assignment in test
Leon Klingele [Mon, 4 Feb 2019 12:46:00 +0000 (12:46 +0000)]
encoding/base64: remove ineffectual assignment in test

Change-Id: I4a0d5b2f76138895567939920fa5d83cbdec17d2
GitHub-Last-Rev: 061d9d1d5655a6a9d8371f08d2f77a0ed7a495cc
GitHub-Pull-Request: golang/go#30008
Reviewed-on: https://go-review.googlesource.com/c/160432
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

6 years agogo/printer: add missing error checks in tests
Leon Klingele [Wed, 30 Jan 2019 17:36:22 +0000 (17:36 +0000)]
go/printer: add missing error checks in tests

Change-Id: I696da3b07c8b0a2802d3d1291f475e241e4ad90a
GitHub-Last-Rev: df571ce03bd07a1e12203774f4c120f5017590f6
GitHub-Pull-Request: golang/go#30011
Reviewed-on: https://go-review.googlesource.com/c/160435
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

6 years agocmd/link: reliably remove temporary directory in testDwarf
Ian Lance Taylor [Fri, 1 Mar 2019 20:55:43 +0000 (12:55 -0800)]
cmd/link: reliably remove temporary directory in testDwarf

We were using t.Parallel in a subtest, which meant that the main test
would not wait for the subtest, so the main test would delete the
temporary directory before the subtest used it. The subtest worked
because "go build -o /tmp/x/y/p.exe p" creates /tmp/x/y as needed.

Updates #30500

Change-Id: I5904ecac748d15ded4cb609f049fa548b8916a0e
Reviewed-on: https://go-review.googlesource.com/c/164857
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
6 years agoencoding/base32: remove ineffectual assignment in test
Leon Klingele [Mon, 4 Feb 2019 12:46:08 +0000 (12:46 +0000)]
encoding/base32: remove ineffectual assignment in test

Change-Id: I8aaa3d1d2797f3ace34bc09f5123538f6a77efce
GitHub-Last-Rev: 2758c462041ff5e444651b7927d53e809d2efe4d
GitHub-Pull-Request: golang/go#30009
Reviewed-on: https://go-review.googlesource.com/c/160433
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>