1
0
mirror of https://github.com/golang/go synced 2024-11-18 06:34:53 -07:00
Commit Graph

39736 Commits

Author SHA1 Message Date
Leon Klingele
4e20d999ec os: simplify check whether to run subtest of TestRemoveAll
Change-Id: Ic5b46cfb393f5ba7b91b3fb73b158b0bc238a532
GitHub-Last-Rev: e5c5db51bc
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>
2019-03-05 02:42:51 +00:00
Clément Chigot
b6625758e4 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>
2019-03-05 02:09:48 +00:00
Clément Chigot
c1e2227505 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>
2019-03-05 01:30:35 +00:00
Ian Lance Taylor
294edb272d 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>
2019-03-05 01:01:11 +00:00
Emmanuel T Odeke
6b04550820 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>
2019-03-04 23:07:12 +00:00
Rémy Oudompheng
a1f7dbf0aa 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>
2019-03-04 22:25:21 +00:00
Josh Bleecher Snyder
d5edbcac98 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>
2019-03-04 20:49:12 +00:00
Baokun Lee
c74659290a 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>
2019-03-04 20:01:35 +00:00
Josh Bleecher Snyder
87cc56718a 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>
2019-03-04 19:30:57 +00:00
Michael Anthony Knyszek
abf8e355a8 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>
2019-03-04 18:28:52 +00:00
Agniva De Sarker
0c7cdb49d8 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>
2019-03-04 18:01:17 +00:00
Carrie Bynon
88da9ccb98 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>
2019-03-04 17:36:16 +00:00
Baokun Lee
68eb3ccdec 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>
2019-03-04 15:32:18 +00:00
Daniel Martí
d1887676d9 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>
2019-03-04 09:45:46 +00:00
Brian Kessler
0db5534d7a 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>
2019-03-04 05:47:35 +00:00
Josh Bleecher Snyder
4fb900e9ca 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>
2019-03-04 01:22:28 +00:00
Richard Musiol
c0d82bb0ec 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
994591e51c.
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>
2019-03-03 21:10:01 +00:00
erifan01
159b2de442 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>
2019-03-03 20:20:10 +00:00
Daniel Martí
83610c90bb 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>
2019-03-03 18:43:53 +00:00
Richard Musiol
42b79f0823 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>
2019-03-03 17:55:52 +00:00
Alberto Donizetti
0dc6256540 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>
2019-03-03 17:48:05 +00:00
Daniel Martí
59712fd03d 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>
2019-03-03 17:45:46 +00:00
Leon Klingele
ec01d8f74b cmd/internal/obj/mips: use r instead of p.Reg in call to OP_IRR
Change-Id: Id77764ed2d693e632e2a7b4e4638c17e0caf2276
GitHub-Last-Rev: 9ebe282520
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>
2019-03-03 17:04:38 +00:00
Daniel Martí
fc42cf8b8c 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>
2019-03-03 10:33:18 +00:00
Elias Naur
3de2fb21b7 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>
2019-03-02 22:21:49 +00:00
Daniel Martí
e0ff4e6dc0 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>
2019-03-02 20:43:08 +00:00
Josh Bleecher Snyder
06c86e0fc3 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>
2019-03-02 20:13:13 +00:00
Josh Bleecher Snyder
beadf433c3 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>
2019-03-02 20:11:47 +00:00
Josh Bleecher Snyder
37b84e2782 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>
2019-03-02 19:37:02 +00:00
Agniva De Sarker
5126feadd6 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>
2019-03-02 18:28:10 +00:00
Leon Klingele
5edb175b40 cmd/compile/internal/ssa: ignore error from second call to MatchString in test
Change-Id: I714612b41facc8d1ec22974e8aaf2a5a3592e8f5
GitHub-Last-Rev: a0b3917e45
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>
2019-03-02 17:32:52 +00:00
Daniel Martí
aa5165d62c 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>
2019-03-02 16:48:05 +00:00
Leon Klingele
337a1bde02 cmd/internal/obj: stay consistent by defining loop variable outside loop header
Change-Id: Ieb0ae01cf393c4983e809ce95fedeaa854d19a99
GitHub-Last-Rev: 908f756518
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>
2019-03-02 05:48:42 +00:00
LE Manh Cuong
2889332edf 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>
2019-03-02 05:42:50 +00:00
Iskander Sharipov
342764a216 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>
2019-03-02 05:10:52 +00:00
Leon Klingele
d346a9b772 cmd/go/internal/modfetch: add missing error checks
Change-Id: I51a9c06384875fbb12db0e05128f23bd23a163a1
GitHub-Last-Rev: 126452f15c
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>
2019-03-02 05:04:49 +00:00
Leon Klingele
acf8f2c154 cmd/go/internal/modload: correctly report devel versions
Change-Id: Ie26b86c7502e41796732caad4d7e254246f70b7f
GitHub-Last-Rev: 3b80c0e4b1
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>
2019-03-02 05:04:22 +00:00
Leon Klingele
3fe97ba0ff cmd/go/internal/work: properly ignore error
Change-Id: Id0e8d170730d946b60c661d90bc98d0ca7545391
GitHub-Last-Rev: 19fed775b7
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>
2019-03-02 05:03:59 +00:00
Leon Klingele
49bc5690a3 cmd/link: add missing error check in test
Change-Id: I54998f1b7daa8f8db7a2007b4eb86e9789c03656
GitHub-Last-Rev: 97667ead6f
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>
2019-03-02 05:00:48 +00:00
Leon Klingele
b136b17a8c cmd/go/internal/modconv: remove unused variables
Change-Id: I429db8dca219fb931f7b05ce7a7324e8c4ba935b
GitHub-Last-Rev: 2257a5bf23
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>
2019-03-02 04:59:43 +00:00
Leon Klingele
44dec304ad encoding/base64: remove ineffectual assignment in test
Change-Id: I4a0d5b2f76138895567939920fa5d83cbdec17d2
GitHub-Last-Rev: 061d9d1d56
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>
2019-03-02 04:55:30 +00:00
Leon Klingele
c422c97b72 go/printer: add missing error checks in tests
Change-Id: I696da3b07c8b0a2802d3d1291f475e241e4ad90a
GitHub-Last-Rev: df571ce03b
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>
2019-03-02 04:55:18 +00:00
Ian Lance Taylor
44dc661453 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>
2019-03-02 04:25:26 +00:00
Leon Klingele
3415b3556b encoding/base32: remove ineffectual assignment in test
Change-Id: I8aaa3d1d2797f3ace34bc09f5123538f6a77efce
GitHub-Last-Rev: 2758c46204
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>
2019-03-02 02:14:45 +00:00
Marat Khabibullin
aef1a7e192 html/template: prevent test from failing with nil pointer dereference
The variable err could have nil value when we call err.Error(),
because after we check it for nil above we continue the test
(t.Errorf doesn't stop the test execution).

Updates #30208

Change-Id: I6f7a8609f2453f622a1fa94a50c99d2e04d5fbcd
GitHub-Last-Rev: 3a5d9b1e9e
GitHub-Pull-Request: golang/go#30215
Reviewed-on: https://go-review.googlesource.com/c/162477
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-03-02 01:53:40 +00:00
Samuel Kelemen
c05f2b4869 net/http: update net/http package to replace a broken link with an archive link
replaces broken link with a web.archive.org link.

Change-Id: I438536a6ac51d837c30be5df7d3d0caadf65bb95
GitHub-Last-Rev: 0601e4d6b2
GitHub-Pull-Request: golang/go#30523
Reviewed-on: https://go-review.googlesource.com/c/164761
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2019-03-02 01:34:38 +00:00
Vladimir Varankin
249f5d2af4 cmd/go: refer to testflag help in go test -help output
The change makes it easier for a user to get to the page where
she can check supported test flags, by adding 'go test testflag'
reference to the 'go test -help' output.

Fix #30365

Change-Id: I5b3db7853021ef68d096dcb467d7957d7e1bf623
GitHub-Last-Rev: ce3dec59fc
GitHub-Pull-Request: golang/go#30420
Reviewed-on: https://go-review.googlesource.com/c/163858
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-03-01 23:14:39 +00:00
Ian Lance Taylor
619cc9fa41 go/internal/gccgoimporter: remove temporary directories in test
Updates #30500

Change-Id: I42716c2bfd7f087303bc63d7518e32b52fd0d762
Reviewed-on: https://go-review.googlesource.com/c/164862
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-03-01 22:27:12 +00:00
Ian Lance Taylor
412f659280 net: return poll.SendFile error from sendFile
We were accidentally ignoring any error returned by poll.SendFile.
Noticed by reading the code. It could only change behavior if the
sendfile system call both wrote some bytes and returned an error.

Change-Id: I0693d6ec0a30f5a86b78d38793899ca29fb9e156
Reviewed-on: https://go-review.googlesource.com/c/164760
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-03-01 22:15:57 +00:00
Ian Lance Taylor
7dc3d9f85f misc/cgo/testplugin: let TestMain run deferred functions
Split TestMain into two functions so that we can defer cleanups.

Updates #30500

Change-Id: I4a5c7ddb8218a8bd056c8733c3cb9feb895e77a0
Reviewed-on: https://go-review.googlesource.com/c/164859
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
2019-03-01 21:33:27 +00:00