David du Colombier [Sun, 13 Jan 2019 21:11:44 +0000 (22:11 +0100)]
net: skip TestLookupGmailTXT on Plan 9
CL 157638 updated TestLookupGmailTXT. However, this
test is failing on Plan 9, because the DNS resolver
(ndb/dns) only returns a single TXT record.
Updates #29722.
Change-Id: I01cd94e6167902361c3f5d615868f6f763a31fb1
Reviewed-on: https://go-review.googlesource.com/c/157737
Run-TryBot: David du Colombier <0intro@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Austin Clements [Wed, 9 Jan 2019 03:23:52 +0000 (22:23 -0500)]
cmd/compile: separate data and function LSyms
Currently, obj.Ctxt's symbol table does not distinguish between ABI0
and ABIInternal symbols. This is *almost* okay, since a given symbol
name in the final object file is only going to belong to one ABI or
the other, but it requires that the compiler mark a Sym as being a
function symbol before it retrieves its LSym. If it retrieves the LSym
first, that LSym will be created as ABI0, and later marking the Sym as
a function symbol won't change the LSym's ABI.
Marking a Sym as a function symbol before looking up its LSym sounds
easy, except Syms have a dual purpose: they are used just as interned
strings (every function, variable, parameter, etc with the same
textual name shares a Sym), and *also* to store state for whatever
package global has that name. As a result, it's easy to slip up and
look up an LSym when a Sym is serving as the name of a local variable,
and then later mark it as a function when it's serving as the global
with the name.
In general, we were careful to avoid this, but #29610 demonstrates one
case where we messed up. Because of on-demand importing from indexed
export data, it's possible to compile a method wrapper for a type
imported from another package before importing an init function from
that package. If the argument of the method is named "init", the
"init" LSym will be created as a data symbol when compiling the
wrapper, before it gets marked as a function symbol.
To fix this, we separate obj.Ctxt's symbol tables for ABI0 and
ABIInternal symbols. This way, the compiler will simply get a
different LSym once the Sym takes on its package-global meaning as a
function.
This fixes the above ordering issue, and means we no longer need to go
out of our way to create the "init" function early and mark it as a
function symbol.
Michael Anthony Knyszek [Fri, 4 Jan 2019 20:17:15 +0000 (20:17 +0000)]
runtime: make mTreap iterator bidirectional
This change makes mTreap's iterator type, treapIter, bidirectional
instead of unidirectional. This change helps support moving the find
operation on a treap to return an iterator instead of a treapNode, in
order to hide the details of the treap when accessing elements.
Alex Brainman [Sat, 5 Jan 2019 07:35:27 +0000 (18:35 +1100)]
path/filepath: return special error from EvalSymlinks
CL 155597 attempted to fix #29372. But it failed to make all new
test cases pass. Also CL 155597 broke some existing code
(see #29449 for details).
Make small adjustment to CL 155597 that fixes both #29372 and #29449.
Suggested by Ian.
Updates #29372
Fixes #29449
Change-Id: I9777a615514d3f152af5acb65fb1239e696607b6
Reviewed-on: https://go-review.googlesource.com/c/156398
Run-TryBot: Alex Brainman <alex.brainman@gmail.com> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Clément Chigot [Wed, 9 Jan 2019 13:05:17 +0000 (14:05 +0100)]
cmd/dist, cmd/link, runtime: fix stack size when cross-compiling aix/ppc64
This commit allows to cross-compiling aix/ppc64. The nosplit limit must
twice as large as on others platforms because of AIX syscalls.
The stack limit, especially stackGuardMultiplier, was set by cmd/dist
during the bootstrap and doesn't depend on GOOS/GOARCH target.
Fixes #29572
Change-Id: Id51e38885e1978d981aa9e14972eaec17294322e
Reviewed-on: https://go-review.googlesource.com/c/157117
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
David du Colombier [Wed, 9 Jan 2019 20:32:11 +0000 (21:32 +0100)]
cmd/go: skip tests using Git on Plan 9
TestScript/get_unicode, TestScript/get_dotfiles and
TestScript/get_brace are failing on Plan 9 since they
expect a full-featured git command, while the git tool
has been emulated as a simple rc script on Plan 9.
This change skips tests using Git on Plan 9.
Fixes #29640.
Change-Id: Id7f6fdca552167f4631fe401f63167e5653daafa
Reviewed-on: https://go-review.googlesource.com/c/157119
Run-TryBot: David du Colombier <0intro@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Cherry Zhang [Wed, 9 Jan 2019 16:21:07 +0000 (11:21 -0500)]
cmd/internal/obj/wasm: increment PC by 2 at sigpanic
On Wasm, PC is not the instruction counter but the block ID. We
advance the PC only when necessary. In the case of sigpanic (used
in nil check), the panic stack trace expects the PC at the call
of sigpanic, not the next one. However, runtime.Caller subtracts
1 from the PC. To make both PC and PC-1 work (have the same line
number), we advance the PC by 2 at sigpanic.
Fixes #29632.
Change-Id: Ieb4d0bb9dc6a8103855a194e3d289f1db4bfb1e5
Reviewed-on: https://go-review.googlesource.com/c/157157 Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Richard Musiol <neelance@gmail.com>
Run-TryBot: Richard Musiol <neelance@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Robert Griesemer [Wed, 9 Jan 2019 06:39:13 +0000 (22:39 -0800)]
go/types: don't create new context string for each argument of each call
The argument context string is only used in error messages. Don't format
the function AST into a string for every single argument of every single
call that is type-checked. Instead do it once per call (still not great,
but much much better).
LE Manh Cuong [Wed, 9 Jan 2019 02:27:54 +0000 (09:27 +0700)]
debug/gosym: remove outdated comment
Change-Id: I2bba13064c8d21ded41499c6ec225ef83d1a533e
Reviewed-on: https://go-review.googlesource.com/c/156997 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Yuval Pavel Zholkover [Mon, 7 Jan 2019 00:06:38 +0000 (02:06 +0200)]
os: disable the use of netpoll on regular files on *BSDs.
The kqueue based netpoller always registers file descriptors with EVFILT_READ and EVFILT_WRITE.
However only EVFILT_READ notification is supported for regular files.
On FreeBSD a regular file is always reported as ready for writing, resulting in a busy wait.
On Darwin, Dragonfly, NetBSD and OpenBSD, a regular file is reported as ready for both reading and writing only once.
Updates #19093
Change-Id: If284341f60c6c2332fb5499637d4cfa7a4e26b7b
Reviewed-on: https://go-review.googlesource.com/c/156379
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Brad Fitzpatrick [Wed, 2 Jan 2019 18:33:31 +0000 (18:33 +0000)]
bufio: document relationship between UnreadByte/UnreadRune and Peek
Fixes #29387
Change-Id: I2d9981f63ac16630ed39d6da6692c81396f4e9ea
Reviewed-on: https://go-review.googlesource.com/c/155930 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Keith Randall [Sat, 5 Jan 2019 22:31:23 +0000 (14:31 -0800)]
runtime: make FuncForPC return the innermost inlined frame
Returning the innermost frame instead of the outermost
makes code that walks the results of runtime.Caller{,s}
still work correctly in the presence of mid-stack inlining.
Fixes #29582
Change-Id: I2392e3dd5636eb8c6f58620a61cef2194fe660a7
Reviewed-on: https://go-review.googlesource.com/c/156364
Run-TryBot: Keith Randall <khr@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Keith Randall [Mon, 7 Jan 2019 20:24:01 +0000 (12:24 -0800)]
runtime: store incremented PC in result of runtime.Callers
In 1.11 we stored "return addresses" in the result of runtime.Callers.
I changed that behavior in CL 152537 to store an address in the call
instruction itself. This CL reverts that part of 152537.
The change in 152537 was made because we now store pcs of inline marks
in the result of runtime.Callers as well. This CL will now store the
address of the inline mark + 1 in the results of runtime.Callers, so
that the subsequent -1 done in CallersFrames will pick out the correct
inline mark instruction.
This CL means that the results of runtime.Callers can be passed to
runtime.FuncForPC as they were before. There are a bunch of packages
in the wild that take the results of runtime.Callers, subtract 1, and
then call FuncForPC. This CL keeps that pattern working as it did in
1.11.
The changes to runtime/pprof in this CL are exactly a revert of the
changes to that package in 152537 (except the locForPC comment).
Update #29582
Change-Id: I04d232000fb482f0f0ff6277f8d7b9c72e97eb48
Reviewed-on: https://go-review.googlesource.com/c/156657 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Mark Rushakoff [Tue, 8 Jan 2019 01:13:01 +0000 (01:13 +0000)]
cmd/go: fix typo in output of go help importpath
The output refers to 'go help modules-get' but the actual command is 'go
help module-get', singular.
Change-Id: Ie001f4181d80d3bf1995af2f257bf789dad5b33f
GitHub-Last-Rev: ce9b90e9a656fbab097d440458e93ab29ba014af
GitHub-Pull-Request: golang/go#29605
Reviewed-on: https://go-review.googlesource.com/c/156737 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Cherry Zhang [Mon, 31 Dec 2018 04:53:27 +0000 (23:53 -0500)]
runtime/pprof: add a test for gccgo bug #29448
With gccgo, if a profiling signal arrives in certain time during
traceback, it may crash or hang. The fix is CL 156037 and
CL 156038. This CL adds a test.
Updates #29448.
Change-Id: Idb36af176b4865b8fb31a85cad185ed4c07ade0c
Reviewed-on: https://go-review.googlesource.com/c/156018 Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Jay Conrod [Fri, 4 Jan 2019 22:30:36 +0000 (17:30 -0500)]
cmd/go: deflake TestScript/gcflags_patterns
The check below can fail incorrectly if the buildid ends with '-p'.
! stderr 'compile.* -e .*-p [^z]'
This fix changes regular expressions to '-e.* -p' or '-N.* -p' instead
of '-e .*-p'. '-l' is no longer used because the compiler accepts
multiple flags starting with '-l' ('-e' and '-N' do not have this
problem), so there could be false matches.
Mainly to pull in the bug fix in the structtag pass, where filenames
could sometimes be wrong. The bug wasn't present in 1.11, so it was a
regression and needs fixing before 1.12 is out.
Fixes #29130.
Change-Id: Ie9d9bff84873f34d748ebd8f056b6bc2ac822a55
Reviewed-on: https://go-review.googlesource.com/c/156378
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Alan Donovan <adonovan@google.com>
Filippo Valsorda [Sat, 5 Jan 2019 00:27:08 +0000 (19:27 -0500)]
crypto/x509: ignore harmless edge case in TestSystemRoots
The no-cgo validation hack lets in certificates from the root store that
are not marked as roots themselves, but are signed by a root; the cgo
path correctly excludes them. When TestSystemRoots compares cgo and
no-cgo results it tries to ignore them by ignoring certificates which
pass validation, but expired certificates were failing validation.
Letting through expired certs is harmless anyway because we will refuse
to build chains to them.
Filippo Valsorda [Sat, 5 Jan 2019 00:09:01 +0000 (19:09 -0500)]
crypto/x509: ignore 5 phantom 1024-bit roots in TestSystemRoots
On macOS 10.11, but not 10.10 and 10.12, the C API returns 5 old root
CAs which are not in SystemRootCertificates.keychain (but seem to be in
X509Anchors and maybe SystemCACertificates.keychain, along with many
others that the C API does not return). They all are moribund 1024-bit
roots which are now gone from the Apple store.
Since we can't seem to find a way to make the no-cgo code see them,
ignore them rather than skipping the test.
David Chase [Fri, 4 Jan 2019 16:43:23 +0000 (11:43 -0500)]
cmd/compile: modify swt.go to skip repeated walks of switch
The compiler appears to contain several squirrelly corner
cases where nodes are double walked, some where new nodes
are created from walked parts. Rather than trust that we
had searched hard enough for the last one, change
exprSwitch.walk() to return immediately if it has already
been walked. This appears to be the only case where
double-walking a node is actually harmful.
Fixes #29562.
Change-Id: I0667e8769aba4c3236666cd836a934e256c0bfc5
Reviewed-on: https://go-review.googlesource.com/c/156317
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org>
Dmitri Shuralyov [Fri, 4 Jan 2019 00:44:55 +0000 (19:44 -0500)]
CONTRIBUTORS: first round of automated updates for Go 1.12
These updates have been automatically generated using a modified
version of the updateac command with the following changes:
- code to automatically update the AUTHORS file has been removed,
since we're not updating that file automatically after Go 1.11
(see CL 128877)
- CLA checking code has been removed, since it was primarily needed
for updating the AUTHORS file
- instead of executing the misc/sortac binary, its code was embedded
into the updateac command itself
The modified updateac command will be added to x/build repository soon,
and the misc/sortac command can be removed afterwards.
Austin Clements [Thu, 3 Jan 2019 19:48:30 +0000 (14:48 -0500)]
runtime: work around "P has cached GC work" failures
We still don't understand what's causing there to be remaining GC work
when we enter mark termination, but in order to move forward on this
issue, this CL implements a work-around for the problem.
If debugCachedWork is false, this CL does a second check for remaining
GC work as soon as it stops the world for mark termination. If it
finds any work, it starts the world again and re-enters concurrent
mark. This will increase STW time by a small amount proportional to
GOMAXPROCS, but fixes a serious correctness issue.
This works-around #27993.
Change-Id: Ia23b85dd6c792ee8d623428bd1a3115631e387b8
Reviewed-on: https://go-review.googlesource.com/c/156140
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>
Jay Conrod [Thu, 3 Jan 2019 23:33:36 +0000 (18:33 -0500)]
cmd/go: fix failure in TestScript/build_runtime_gcflags
This test case failed on the longtest builder. It relied on
runtime/internal/atomic not being compiled with the -l flag in the
cache. The test case now creates its own GOCACHE, similar to
build_cache_compile and a few others.
Also, mention the correct issue the test case verifies.
Fixes #29395
Change-Id: Id50e9dfc50db03fb11582d3dd6b69c3e1ed750eb
Reviewed-on: https://go-review.googlesource.com/c/156237
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Fixes bug introduced by https://golang.org/cl/129059 where
gcflags='all=...' and ldflags='all=...' would not be applied to some
packages built by 'go test'.
LoadImport used to set gcflags/ldflags for the Package objects it
created, in https://golang.org/cl/129059 this code was factored out to
setToolFlags. The codepath of `go build` was updated to call
setToolFlags appropriatley, but the codepath of `go test -c` wasn't,
resulting in gcflags/ldflags being applied inconsistently when building
tests.
This commit changes TestPackagesFor to call setToolFlags on the package
objects it creates.
Fixes #27681
Change-Id: Idcbec0c989ee96ec066207184611f08818873e8d
Reviewed-on: https://go-review.googlesource.com/c/136275
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Jay Conrod <jayconrod@google.com>
Keith Randall [Mon, 31 Dec 2018 23:03:33 +0000 (15:03 -0800)]
cmd/compile: fix no-op instruction used by s390x
CL 152537 introduced a new use for ginsnop, the arch-dependent
routine that generates nops. The previous s390x nop clobbered flags.
It turns out the previous uses of this nop did not require flags
to be preserved, but the new use does.
Use a real nop: the 4-byte preferred nop.
Fixes #29453
Change-Id: I95310dfdd831932e26f5d5b6608324687f4c3162
Reviewed-on: https://go-review.googlesource.com/c/155926 Reviewed-by: Michael Munday <mike.munday@ibm.com>
David Chase [Wed, 2 Jan 2019 21:52:49 +0000 (16:52 -0500)]
cmd/compile: Update ssa/debug_test reference files for delve and gdb
Recent changes to compiler backtraces perturbed the line
number assignment, some better, some worse, probably net
worse. For purposes of passing the long tests, update the
reference files (delve's file was also stale).
TODO: Figure out a less delicate way to locate statement
boundaries for 1.13.
Austin Clements [Mon, 31 Dec 2018 01:04:16 +0000 (20:04 -0500)]
runtime: don't spin in checkPut if non-preemptible
Currently it's possible for the runtime to deadlock if checkPut is
called in a non-preemptible context. In this case, checkPut may spin,
so it won't leave the non-preemptible context, but the thread running
gcMarkDone needs to preempt all of the goroutines before it can
release the checkPut spin loops.
Fix this by returning from checkPut if it's called under any of the
conditions that would prevent gcMarkDone from preempting it. In this
case, it leaves a note behind that this happened; if the runtime does
later detect left-over work it can at least indicate that it was
unable to catch it in the act.
Cherry Zhang [Wed, 2 Jan 2019 17:27:55 +0000 (12:27 -0500)]
cmd/compile: fix deriving from x+d >= w on overflow in prove pass
In the case of x+d >= w, where d and w are constants, we are
deriving x is within the bound of min=w-d and max=maxInt-d. When
there is an overflow (min >= max), we know only one of x >= min
or x <= max is true, and we derive this by excluding the other.
When excluding x >= min, we did not consider the equal case, so
we could incorrectly derive x <= max when x == min.
Fixes #29502.
Change-Id: Ia9f7d814264b1a3ddf78f52e2ce23377450e6e8a
Reviewed-on: https://go-review.googlesource.com/c/156019 Reviewed-by: David Chase <drchase@google.com>
Richard Musiol [Tue, 11 Dec 2018 12:59:18 +0000 (13:59 +0100)]
runtime: fix notetsleepg deadline on js/wasm
A notetsleepg may get stuck if its timeout callback gets invoked
exactly on its deadline due to low precision of nanotime. This change
fixes the comparison so it also resolves the note if the timestamps are
equal.
Updates #28975
Change-Id: I045d2f48b7f41cea0caec19b56876e9de01dcd6c
Reviewed-on: https://go-review.googlesource.com/c/153558
Run-TryBot: Richard Musiol <neelance@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Michael McLoughlin [Tue, 1 Jan 2019 01:14:54 +0000 (17:14 -0800)]
runtime: fix REFLECTMETHOD macro
Removes spurious equals sign from REFLECTMETHOD macro.
Fixes #29487
Change-Id: Iaa3d85ff57087aa79a259f28816f8b0a552536f3
Reviewed-on: https://go-review.googlesource.com/c/155927
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
whereas this is a longstanding tradition
and insofaras it is worth continuing such traditions
and notwithstanding an attempt at future-proofing
thetruthofthematter is that I have been waiting for years to send this change
so despiteallobjections I have updated the copyright year.
Yuval Pavel Zholkover [Sat, 29 Dec 2018 12:27:15 +0000 (14:27 +0200)]
syscall: revert to pre-FreeBSD 10 / POSIX-2008 timespec field names in Stat_t on FreeBSD
CL 138595 introduced the new names when the hardcoded stat8 definitions was replaced
with a cgo generated one.
Fixes #29393
Updates #22448
Change-Id: I6309958306329ff301c17344b2e0ead0cc874224
Reviewed-on: https://go-review.googlesource.com/c/155958
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Jordan Rhee [Sun, 30 Dec 2018 00:19:16 +0000 (16:19 -0800)]
runtime: use EnumTimeFormatsEx instead of EnumWindows in callback tests
Use EnumTimeFormatsEx() to test panics across callback boundaries
instead of EnumWindows(). EnumWindows() is incompatible with Go's panic
unwinding mechanism. See the associated issue for more information.
Updates #26148
Change-Id: If1dd70885d9c418b980b6827942cb1fd16c73803
Reviewed-on: https://go-review.googlesource.com/c/155923
Run-TryBot: Alex Brainman <alex.brainman@gmail.com> Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Keith Randall [Fri, 28 Dec 2018 20:43:48 +0000 (12:43 -0800)]
cmd/compile: fix racewalk{enter,exit} removal
We can't remove race instrumentation unless there are no calls,
not just no static calls. Closure and interface calls also count.
The problem in issue 29329 is that there was a racefuncenter, an
InterCall, and a racefuncexit. The racefuncenter was removed, then
the InterCall was rewritten to a StaticCall. That prevented the
racefuncexit from being removed. That caused an imbalance in
racefuncenter/racefuncexit calls, which made the race detector barf.
Work involved in getting a stack trace is divided between
runtime.Callers and runtime.CallersFrames.
Before this CL, runtime.Callers returns a pc per runtime frame.
runtime.CallersFrames is responsible for expanding a runtime frame
into potentially multiple user frames.
After this CL, runtime.Callers returns a pc per user frame.
runtime.CallersFrames just maps those to user frame info.
Entries in the result of runtime.Callers are now pcs
of the calls (or of the inline marks), not of the instruction
just after the call.
Fixes #29007
Fixes #28640
Update #26320
Change-Id: I1c9567596ff73dc73271311005097a9188c3406f
Reviewed-on: https://go-review.googlesource.com/c/152537
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: David Chase <drchase@google.com>
This rule is problematic. 1<<(32-uint32(d)) <= int32(c) meant to
say that it is true if c is greater than the largest possible
value of the right shift. But when d==1, 1<<(32-1) is negative
and results in the wrong comparison.
Max Ushakov [Fri, 21 Dec 2018 14:53:33 +0000 (17:53 +0300)]
time: return ENOENT if a zoneinfo zip file is not found
Updates #20969
Change-Id: Ibcf0bf932d5b1de67c22c63dd8514ed7a5d198fb
Reviewed-on: https://go-review.googlesource.com/c/155538
Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
LE Manh Cuong [Fri, 21 Dec 2018 04:21:02 +0000 (11:21 +0700)]
path/filepath: walkSymlinks: return correct error for file with trailing slash
Rather than return os.ErrNotExist for /path/to/existing_file/,
walkSymLinks now returns syscall.ENOTDIR.
This is consistent with behavior of os.Lstat.
Fixes #29372
Change-Id: Id5c471d901db04b2f35d60f60a81b2a0be93cae9
Reviewed-on: https://go-review.googlesource.com/c/155597
Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Daniel Martí [Thu, 20 Dec 2018 23:04:18 +0000 (00:04 +0100)]
cmd/go: add regression test for cryptic vcs errors
On Go 1.11.x, if one ran 'go build' on a main package within a module,
while a needed vcs program like git was missing, a confusing error would
show up:
build testmod: cannot find module for path rsc.io/quote
The error should instead point at the source of the problem, which is
the missing vcs program. Thankfully, Go 1.12 doesn't have this bug, even
though it doesn't seem like the bug was fixed directly and
intentionally.
To ensure that this particular edge case isn't broken again, add a
regression test. Piggyback on mod_vcs_missing, since it already requires
a missing vcs program and network access.
I double-checked that Go 1.11 fails this test via /usr/bin/go, which is
1.11.3 on my system:
$ PATH=~/tip/bin go test -v -run Script/mod_vcs_missing
[...]
> exec /usr/bin/go build
[stderr]
build m: cannot find module for path launchpad.net/gocheck
Fixes #28948.
Change-Id: Iff1bcf77d9f7c11d15935cb87d6f58d7981d33d2
Reviewed-on: https://go-review.googlesource.com/c/155537
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Bryan C. Mills <bcmills@google.com>
Keith Randall [Sat, 22 Dec 2018 00:36:45 +0000 (16:36 -0800)]
cmd/compile: pad zero-sized stack variables
If someone takes a pointer to a zero-sized stack variable, it can
be incorrectly interpreted as a pointer to the next object in the
stack frame. To avoid this, add some padding after zero-sized variables.
We only need to pad if the next variable in memory (which is the
previous variable in the order in which we allocate variables to the
stack frame) has pointers. If the next variable has no pointers, it
won't hurt to have a pointer to it.
Because we allocate all pointer-containing variables before all
non-pointer-containing variables, we should only have to pad once per
frame.
Fixes #24993
Change-Id: Ife561cdfdf964fdbf69af03ae6ba97d004e6193c
Reviewed-on: https://go-review.googlesource.com/c/155698
Run-TryBot: Keith Randall <khr@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Keith Randall [Fri, 21 Dec 2018 23:41:28 +0000 (15:41 -0800)]
cmd/compile: fix line number for implicitly declared method expressions
Method expressions where the method is implicitly declared have no
line number. The Error method of the built-in error type is one such
method. We leave the line number at the use of the method expression
in this case.
Fixes #29389
Change-Id: I29c64bb47b1a704576abf086599eb5af7b78df53
Reviewed-on: https://go-review.googlesource.com/c/155639
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Jay Conrod [Fri, 21 Dec 2018 18:47:20 +0000 (13:47 -0500)]
cmd/go: use cached source files in "go list -find -compiled"
When "go list" is invoked with -find, it clears the list of imports
for each package matched on the command line. This affects action IDs,
since they incorporate dependencies' action IDs. Consequently, the
build triggered by -compiled won't find sources cached by
"go build".
We can still safely cache compiled sources from multiple runs of
"go list -find -compiled" though, since cgo generated sources are not
affected by imported dependencies. This change adds a second look into
the cache in this situation.
Fixes #29371
Change-Id: Ia0ae5a403ab5d621feaa16f521e6a65ac0ae6d9a
Reviewed-on: https://go-review.googlesource.com/c/155481 Reviewed-by: Bryan C. Mills <bcmills@google.com>