Commit graph

39347 commits

Author SHA1 Message Date
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
Ian Lance Taylor 4aff88ded2 misc/cgo/testcshared: delete temporary directory in test
The deferred os.RemoveAll was accidentally committed as commented out
in the original https://golang.org/cl/87158.

Updates #30500

Change-Id: Idc5195816d7978253760dbfd78fde6d22c456296
Reviewed-on: https://go-review.googlesource.com/c/164858
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:00 +00:00
Ian Lance Taylor 1cd6d8b974 cmd/vet: let TestMain run deferred functions
Split TestMain into two functions so that we can defer cleanups.

Updates #30500

Change-Id: I1fa7957be0779c079ec4d221a8321b45ddb973e2
Reviewed-on: https://go-review.googlesource.com/c/164860
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:32:30 +00:00
Bryan C. Mills b45f5b5e16 cmd/go: quote expanded shell variables used within regular expressions
We mostly use shell variables for paths, and we don't want file paths
like "C:\work\go1.4" to turn into regular expressions.

Updates #30228
Updates #30241

Change-Id: If18b775b2f8b2821eaf197c4be4a322066af839f
Reviewed-on: https://go-review.googlesource.com/c/164626
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2019-03-01 20:53:50 +00:00
Elias Naur 45861a64d3 androidtest.bash: delete
Android now works with all.bash.

Change-Id: I1087308865d2eb31f02501b5798e14d11145b185
Reviewed-on: https://go-review.googlesource.com/c/164700
Run-TryBot: Elias Naur <mail@eliasnaur.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-03-01 19:50:38 +00:00
Bryan C. Mills ee6bec958d misc/cgo/test: set PWD when executing 'go test' in an alternate GOPATH
That makes the test more friendly to the Android exec script, since it
won't have to evaluate symlinks to find the directory.

Change-Id: I06aae3224d489eed6d7fac7e462361f3bf1dd3da
Reviewed-on: https://go-review.googlesource.com/c/164624
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Elias Naur <mail@eliasnaur.com>
2019-03-01 18:35:31 +00:00
Ian Lance Taylor 820ad17303 cmd/go: remove work directory on usage error
Ensure that cmd/go consistently calls base.Exit rather than os.Exit,
so that we don't incorrectly leave the work directory around on exit.

Test this by modifying the testsuite to run all the tests with TMPDIR
set to a temporary directory, and then check that no files are left
behind in that temporary directory. Adjust a couple of tests to make
this approach work.

Updates #30500
Updates https://gcc.gnu.org/PR89406

Change-Id: Ib6a5fc8a288a6cf4713022baa2b8dfefad62ba34
Reviewed-on: https://go-review.googlesource.com/c/163237
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2019-03-01 18:26:37 +00:00
Bryan C. Mills 7c388cc89c go/internal/srcimporter: set -mod=vendor before running tests
Otherwise, if the working directory is inside a standard-library
module, the test may try to fetch module contents from GOPROXY or
upstream.

Updates #26924
Updates #30228
Updates #30241

Change-Id: I4cb9a07721bd808fd094f7ed55a74cf7bce9cd6f
Reviewed-on: https://go-review.googlesource.com/c/164625
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2019-03-01 17:21:57 +00:00
Elias Naur 8eef74b493 misc/android,misc/ios: evaluate current working directory symlinks
Previous CLs added symlink evaulation to GOROOT and GOPATH.
Unfortunately that only fixed tests that ran outside GOROOT.

To fix the standard library tests, evaluate symlinks in the current
working directory as well.

Change-Id: Ia406a968235ae4321a1002567520105998582d15
Reviewed-on: https://go-review.googlesource.com/c/164699
Run-TryBot: Elias Naur <mail@eliasnaur.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-03-01 16:41:38 +00:00
Bryan C. Mills 4e10ce45f5 go/build: set GO111MODULE=off explicitly in TestImportVendor*
These tests check for GOPATH-mode vendoring behavior, so make sure
they're in GOPATH mode.

Updates #30228

Change-Id: I646f59b67cb76dacd07adc3f6ed15ed63f4e22a4
Reviewed-on: https://go-review.googlesource.com/c/164620
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2019-03-01 16:27:27 +00:00
Cherry Zhang 4f4c2a79d4 runtime: scan defer closure in stack scan
With stack objects, when we scan the stack, it scans defers with
tracebackdefers, but it seems to me that tracebackdefers doesn't
include the func value itself, which could be a stack allocated
closure. Scan it explicitly.

Alternatively, we can change tracebackdefers to include the func
value, which in turn needs to change the type of stkframe.

Fixes #30453.

Change-Id: I55a6e43264d6952ab2fa5c638bebb89fdc410e2b
Reviewed-on: https://go-review.googlesource.com/c/164118
Reviewed-by: Keith Randall <khr@golang.org>
2019-03-01 16:21:29 +00:00
Vladimir Kuzmin c04e47f821 net/http: add StatusEarlyHints (103)
HTTP status code 103 (Early Hints) from RFC 8297.

Fixes #29655

Change-Id: Ia1edbb561ee46f42d7fa1aae3ab9586497fcdb6c
Reviewed-on: https://go-review.googlesource.com/c/157339
Run-TryBot: Agniva De Sarker <agniva.quicksilver@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-03-01 16:10:59 +00:00
artemkaxboy e881604d1c cmd/internal/obj/x86: unexport movtab
Change-Id: Ia071f6914b3c155a88103f930af00028986ec8c7
Reviewed-on: https://go-review.googlesource.com/c/151019
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2019-03-01 16:04:36 +00:00
erifan01 192b675f17 cmd/compile: add an optimaztion rule for math/bits.ReverseBytes16 on arm64
On amd64 ReverseBytes16 is lowered to a rotate instruction. However arm64 doesn't
have 16-bit rotate instruction, but has a REV16W instruction which can be used
for ReverseBytes16. This CL adds a rule to turn the patterns like (x<<8) | (x>>8)
(the type of x is uint16, and "|" can also be "^" or "+") to a REV16W instruction.

Code:
func reverseBytes16(i uint16) uint16 { return bits.ReverseBytes16(i) }

Before:
        0x0004 00004 (test.go:6)        MOVHU   "".i(FP), R0
        0x0008 00008 ($GOROOT/src/math/bits/bits.go:262)        UBFX    $8, R0, $8, R1
        0x000c 00012 ($GOROOT/src/math/bits/bits.go:262)        ORR     R0<<8, R1, R0
        0x0010 00016 (test.go:6)        MOVH    R0, "".~r1+8(FP)
        0x0014 00020 (test.go:6)        RET     (R30)

After:
        0x0000 00000 (test.go:6)        MOVHU   "".i(FP), R0
        0x0004 00004 (test.go:6)        REV16W  R0, R0
        0x0008 00008 (test.go:6)        MOVH    R0, "".~r1+8(FP)
        0x000c 00012 (test.go:6)        RET     (R30)

Benchmarks:
name                old time/op       new time/op       delta
ReverseBytes-224    1.000000ns +- 0%  1.000000ns +- 0%     ~     (all equal)
ReverseBytes16-224  1.500000ns +- 0%  1.000000ns +- 0%  -33.33%  (p=0.000 n=9+10)
ReverseBytes32-224  1.000000ns +- 0%  1.000000ns +- 0%     ~     (all equal)
ReverseBytes64-224  1.000000ns +- 0%  1.000000ns +- 0%     ~     (all equal)

Change-Id: I87cd41b2d8e549bf39c601f185d5775bd42d739c
Reviewed-on: https://go-review.googlesource.com/c/157757
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-03-01 15:42:19 +00:00
Cherry Zhang 40df9cc606 cmd/compile: make KeepAlive work on stack object
Currently, runtime.KeepAlive applied on a stack object doesn't
actually keeps the stack object alive, and the heap object
referenced from it could be collected. This is because the
address of the stack object is rematerializeable, and we just
ignored KeepAlive on rematerializeable values. This CL fixes it.

Fixes #30476.

Change-Id: Ic1f75ee54ed94ea79bd46a8ddcd9e81d01556d1d
Reviewed-on: https://go-review.googlesource.com/c/164537
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2019-03-01 15:36:52 +00:00
Ketan Parmar 1f3d38fdaa bytes: add examples for ToTitleSpecial, ToUpperSpecial and ToLowerSpecial
Change-Id: If700a150492181f68e23e90ef829ff9eaf7ca7b5
Reviewed-on: https://go-review.googlesource.com/c/161737
Run-TryBot: Andrew Bonventre <andybons@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2019-03-01 14:56:41 +00:00
Alex Brainman 44d3bb998c path/filepath: do not call GetFinalPathNameByHandle from EvalSymlinks
EvalSymlinks is using GetFinalPathNameByHandle to handle symlinks with
unusual targets like \??\Volume{ABCD}\. But since CL 164201, os.Readlink
handles path like that too.

So remove all that extra code that EvalSymlinks calls when os.Readlink
fails - it is not needed any more.

Now that windows EvalSymlinks implementation is similar to unix
implementation, we can remove all slashAfterFilePathError related code
too. So do that.

This also makes TestIssue29372 pass even when TMP directory refers to
symlinks with target like \??\Volume{ABCD}\. So remove TestIssue29372
code that helped it pass on windows-arm. TestIssue29372 should pass as
is now.

Fixes #29746

Change-Id: I568d142c89d3297bff8513069bceaa6be51fe7e4
Reviewed-on: https://go-review.googlesource.com/c/164202
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-03-01 07:45:00 +00:00
Alex Brainman 2edd559223 os: make Readlink work with symlinks with target like \??\Volume{ABCD}\
windows-arm TMP directory live inside such link (see
https://github.com/golang/go/issues/29746#issuecomment-456526811 for
details), so symlinks like that will be common at least on windows-arm.

This CL builds on current syscall.Readlink implementation. Main
difference between the two is how new code handles symlink targets,
like \??\Volume{ABCD}\.

New implementation uses Windows CreateFile API with
FILE_FLAG_OPEN_REPARSE_POINT flag to get \??\Volume{ABCD}\ file handle.
And then it uses Windows GetFinalPathNameByHandle with VOLUME_NAME_DOS
flag to convert that handle into standard Windows path.
FILE_FLAG_OPEN_REPARSE_POINT flag ensures that symlink is not followed
when CreateFile opens the file.

Fixes #30463

Change-Id: I33b18227ce36144caed694169ef2e429fd995fb4
Reviewed-on: https://go-review.googlesource.com/c/164201
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-03-01 07:44:37 +00:00
Tobias Klauser e27402aee0 cmd/dist, cmd/link: allow passing default dynamic linker/loader
Add an environment variable to make.bash to allow setting the default
dynamic linker/loader. This fixes alpine builds to use
/lib/ld-musl-x86_64.so.1:

  $ readelf -l ../bin/go | grep 'interpreter:' | sed -e 's/^.*interpreter: \(.*\)[]]/\1/'
  /lib/ld-musl-x86_64.so.1

Also re-enable the internal linker tests that were previously disabled
for alpine (CL 41759, CL 41678).

Fixes #18243
Updates #19938

This resurrects CL 50070 authored by Jessie Frazelle.

Change-Id: I132b5282045a3d60c8568e3b002a7f075eac2d93
Reviewed-on: https://go-review.googlesource.com/c/163977
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-01 06:06:13 +00:00
Elias Naur 60abc07113 misc/android: adb push --sync testdata
(A stripped down version of) $GOROOT is uploaded to the device
before running standar library tests, including many (all?)
testdata directories.

Use the --sync flag when pushing testdata directories to the device
in case it is already present.

Change-Id: If8104f9d15838c1be3623adcf831a7188303c376
Reviewed-on: https://go-review.googlesource.com/c/164338
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-03-01 06:04:29 +00:00
Tobias Klauser 4832bf8bde debug/elf: perform stricter section header table checks in NewFile
If an ELF file has no section header table (shoff = 0), shnum must be
zero as well according to elf(5).

So far, when only shnum was zero but shoff was non-zero (i.e. in an
invalid ELF file) shstrndx wasn't properly checked and could result in
an 'index out of range' later on.

Fixes #10996

Change-Id: Ic248d2d77099b0036458e2a844b086a5f463c844
Reviewed-on: https://go-review.googlesource.com/c/162857
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-01 06:04:20 +00:00
Elias Naur d24c3124ca misc/android: evaluate symlinks before comparing GOROOT and GOPATH
Should fix Android builders on Darwin hosts.

Change-Id: I1554849bdf2ad2440529af7f93566fa6f11d5407
Reviewed-on: https://go-review.googlesource.com/c/164697
Run-TryBot: Elias Naur <mail@eliasnaur.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-03-01 06:03:52 +00:00
Matthew Dempsky 38642b9fce Revert "cmd/compile: rewrite f(g()) for multi-value g() during typecheck"
This reverts commit d96b7fbf98.

Reason for revert: broke noopt and longtest builders.

Change-Id: Ifaec64d817c4336cb255a2e9db00526b7bc5606a
Reviewed-on: https://go-review.googlesource.com/c/164757
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-03-01 05:58:51 +00:00
Baokun Lee 13d24b685a cmd/go/internal/cache: disable builds if GOCACHE is not an absolute path
If GOCACHE is set but is not an absolute path, we cannot build.
And GOCACHE=off also returns the error message "build cache is
disabled by GOCACHE=off".

Fixes #30447

Change-Id: I24f64bc886599ca0acd757acada4714aebe4d3ae
Reviewed-on: https://go-review.googlesource.com/c/164200
Run-TryBot: Baokun Lee <nototon@gmail.com>
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-01 02:23:02 +00:00
Alex Tokarev db2b6e1566 cmd/link: remove unused flag -D (FlagDataAddr)
FlagDataAddr is a vestige from git commit 0cafb9e (2008;
no Gerrit CL number).

It was never used but unfortunately setting it would
cause a spurious warning:

  warning: -D<value> is ignored because of -R0x1000

yet if -R was unset e.g. -R=0, the linker would crash
with a divide by zero runtime panic.

Fixes #28921

Change-Id: Ia910399bc269337a9a860f3a26cd48fae6e62724
Reviewed-on: https://go-review.googlesource.com/c/151021
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-03-01 02:14:00 +00:00
Elias Naur aafa855fd3 misc/ios: evaluate symlinks before comparing GOROOT and GOPATH
CL 163726 added workarounds to keep the iOS builders happy in
a symlinked temporary dir.

The workarounds also made the tests more realistic and improved
performance. Keep them but also handle symlinks better in the
exec wrapper.

Change-Id: Iaa2c03a1a3fb3aa5aaf62d79d52b63d5d8f11db5
Reviewed-on: https://go-review.googlesource.com/c/164698
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2019-03-01 00:54:35 +00:00
Matthew Dempsky d96b7fbf98 cmd/compile: rewrite f(g()) for multi-value g() during typecheck
This CL moves order.go's copyRet logic for rewriting f(g()) into t1,
t2, ... = g(); f(t1, t2, ...) earlier into typecheck. This allows the
rest of the compiler to stop worrying about multi-value functions
appearing outside of OAS2FUNC nodes.

This changes compiler behavior in a few observable ways:

1. Typechecking error messages for builtin functions now use general
case error messages rather than unnecessarily differing ones.

2. Because f(g()) is rewritten before inlining, saved inline bodies
now see the rewritten form too. This could be addressed, but doesn't
seem worthwhile.

3. Most notably, this simplifies escape analysis and fixes a memory
corruption issue in esc.go. See #29197 for details.

Fixes #15992.
Fixes #29197.

Change-Id: I86a70668301efeec8fbd11fe2d242e359a3ad0af
Reviewed-on: https://go-review.googlesource.com/c/153841
Reviewed-by: Robert Griesemer <gri@golang.org>
2019-02-28 22:50:08 +00:00
lukechampine 9d40fadb1c fmtsort: sort interfaces deterministically
Previously, the result of sorting a map[interface{}] containing
multiple concrete types was non-deterministic. To ensure consistent
results, sort first by type name, then by concrete value.

Fixes #30398

Change-Id: I10fd4b6a74eefbc87136853af6b2e689bc76ae9d
GitHub-Last-Rev: 1b07f0c275
GitHub-Pull-Request: golang/go#30406
Reviewed-on: https://go-review.googlesource.com/c/163745
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-02-28 21:09:49 +00:00
Matthew Dempsky 7fa195c1b9 cmd/compile: fix false positives in isGoConst
isGoConst could spuriously return true for variables that shadow a
constant declaration with the same name.

Because even named constants are always represented by OLITERAL nodes,
the easy fix is to just ignore ONAME nodes in isGoConst. We can
similarly ignore ONONAME nodes.

Confirmed that k8s.io/kubernetes/test/e2e/storage builds again with
this fix.

Fixes #30430.

Change-Id: I899400d749982d341dc248a7cd5a18277c2795ec
Reviewed-on: https://go-review.googlesource.com/c/164319
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2019-02-28 20:31:53 +00:00
cia-rana b47f31f68c image/png: delete unused statement
Change-Id: I91378d5d5ecc1fc6741127a3924c631904da736b
Reviewed-on: https://go-review.googlesource.com/c/164199
Run-TryBot: Rob Pike <r@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
2019-02-28 18:24:51 +00:00
Damien Neil 444039e054 fmt: fix %d and other non-string verbs on errors
When formatting an error with a non-string formatting verb such as %d,
use the default formatting behavior rather than treating this as a bad
verb.

For example, this should print 42, not %!d(main.E=42):

  var E int
  func (E) Error() string { return "error" }
  fmt.Printf("%d", E(42))

Fixes #30472

Change-Id: I62fd309c8ee9839a69052b0ec7f1808449dcee8e
Reviewed-on: https://go-review.googlesource.com/c/164557
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-02-28 17:31:37 +00:00
Richard Musiol 72d24a7484 cmd/compile: simplify zero ext operations on wasm
On wasm every integer is stored with 64 bits. We can do zero
extension by simply zeroing the upper bits.

Change-Id: I02c54a38b3b2b7654fff96055edab1b92d48ff32
Reviewed-on: https://go-review.googlesource.com/c/164461
Run-TryBot: Richard Musiol <neelance@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2019-02-28 15:25:42 +00:00
Michael Munday 1f17d61026 internal/cpu: change s390x API to match x/sys/cpu
This CL changes the internal/cpu API to more closely match the
public version in x/sys/cpu (added in CL 163003). This will make it
easier to update the dependencies of vendored code. The most prominent
renaming is from VE1 to VXE for the vector-enhancements facility 1.
VXE is the mnemonic used for this facility in the HWCAP vector.

Change-Id: I922d6c8bb287900a4bd7af70567e22eac567b5c1
Reviewed-on: https://go-review.googlesource.com/c/164437
Reviewed-by: Martin Möhrmann <moehrmann@google.com>
Run-TryBot: Michael Munday <mike.munday@ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-02-28 13:46:45 +00:00
Benny Siegert 336ae0d242 cmd: update vendored golang.org/x/sys/unix
This pulls in CL 164497.

Fixes #24771

Change-Id: I88f2062e2c42363591dcb9e592a7a8381268ddeb
Reviewed-on: https://go-review.googlesource.com/c/164460
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-02-28 13:29:53 +00:00
Benny Siegert c2b707bcf1 syscall: use 64-bit alignment on netbsd-arm
netbsd-arm needs the same override to the alignment function as
openbsd-arm. This fixes the TestPassFD failure.

Update golang/go#24771

Change-Id: Ib124fc776f6e2e3b3932784365c2bd3944523a52
Reviewed-on: https://go-review.googlesource.com/c/164458
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-02-28 11:24:52 +00:00
Daniel Martí 6a72dd77f4 cmd/go: delay parsing the testmain template
The template is over a hundred lines and full of pipelines, and
text/template isn't optimised to parse quickly, so it's no wonder that
delaying the parsing to the first template use makes 'go env' much
faster.

Like in the previous patches to get rid of global regexp.MustCompile
vars, use the newly introduced lazytemplate package. Close to two full
milliseconds are shaved off of 'go env' runs.

name         old time/op    new time/op    delta
ExecGoEnv-8    4.27ms ± 0%    2.63ms ± 1%  -38.43%  (p=0.002 n=6+6)

Updates #29382.

Change-Id: I4e2569e51ddf2afe1b46eb1a9e9e5845f7a3b0bd
Reviewed-on: https://go-review.googlesource.com/c/155962
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-02-28 09:34:47 +00:00
Rob Pike 61170f85e6 time: move the explanation of u/micro to the ParseDuration example
Fix a few missing capitalizations in drive-by.

Change-Id: I7353c12f3ccddefc0f26a98590caf9e446129558
Reviewed-on: https://go-review.googlesource.com/c/163918
Run-TryBot: Rob Pike <r@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-02-28 00:24:56 +00:00
Daniel Martí bd23e84b73 internal/lazytemplate: add a lazy template wrapper
Similar to internal/lazyregexp, this will allow removing unnecessary
work from init functions with trivial refactors, thanks to sync.Once.

Copy the structure. The only major difference is that a template also
carries a name.

For #29382.

Change-Id: I65d096dc2e2072b310bf59a814cd62669856b5b5
Reviewed-on: https://go-review.googlesource.com/c/164337
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-02-27 23:49:01 +00:00
Clément Chigot 8e8abf368d archive/tar, syscall: add statUnix for aix/ppc64
This commit add statUnix function for aix/ppc64. It also adds Unix
and Nano methods for AIX time structure.

Change-Id: I9fd62d34a47e87cd46f2f936cb736da0bdff7959
Reviewed-on: https://go-review.googlesource.com/c/163957
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-02-27 23:40:20 +00:00
Clément Chigot d3631955d4 cmd/link: set correct sizes for XCOFF outer symbols
This commit fixes the size of outer symbols like type.*.
Outer symbols cannot have a nil size on AIX or they will be
removed by ld as long as all their sub-symbols.

Change-Id: I68ff3ce5a3a034e3c3eb23431aba31245073cf20
Reviewed-on: https://go-review.googlesource.com/c/163999
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-02-27 23:24:03 +00:00