1
0
mirror of https://github.com/golang/go synced 2024-10-02 16:28:34 -06:00
Commit Graph

35188 Commits

Author SHA1 Message Date
Ian Lance Taylor
5952317637 cmd/go: only run -race test if -race works
Updates #23694

Change-Id: I5fdad8cceacb8bbc85ca2661eb6482aa80343656
Reviewed-on: https://go-review.googlesource.com/92075
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-02-05 21:08:18 +00:00
Andrew Bonventre
4558321eb2 doc/editors: remove feature matrix for various editors/IDEs
The speed of feature development for these products outpaces the
standard Go 6-month release cycle tied to this page. The cost of
maintaining this list is becoming a burden as we make every
attempt at being impartial. As of this writing, we believe feature
lists belong on the pages of the editors/IDEs themselves.

Change-Id: Ie2dfe0e0d47d203c913373e58cbb65cb0fb14d0c
Reviewed-on: https://go-review.googlesource.com/91976
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-02-05 18:37:02 +00:00
Ian Lance Taylor
e6756ec149 cmd/go: ignore coverpkg match on sync/atomic in atomic coverage mode
Otherwise we get into a dependency loop as we try to apply coverage
analysis to sync/atomic when the coverage analysis itself requires
sync/atomic.

Fixes #23694

Change-Id: I3a74ef3881ec5c6197ed348acc7f9e175417f6c7
Reviewed-on: https://go-review.googlesource.com/91875
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2018-02-05 15:32:06 +00:00
Russ Cox
10d096fec2 cmd/go: fix import config debugging flag
Was improperly bypassed in a couple places.

Change-Id: I13426b3efe68b9e67324c283540d0ef7b81b3d41
Reviewed-on: https://go-review.googlesource.com/91636
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-02-02 21:02:56 +00:00
Ian Lance Taylor
f598ad5820 go/internal/gccgoimporter: remove old and exp gccgo packages in test
The old and exp packages listed in gccgoinstallation_test.go have been
removed from gccgo. Remove them from the test.

Fixes #20932

Change-Id: I04a5148e18dccef332904b836c42098b55f2516c
Reviewed-on: https://go-review.googlesource.com/91656
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-02-02 20:06:07 +00:00
Ian Lance Taylor
2a8229d96e misc/cgo/test: get uintptr, not pointer, from dlopen
The dlopen function returns an opaque handle, and it is possible for
it to look like a Go pointer, causing garbage collector and cgo
confusion.

Fixes #23663

Change-Id: Id080e2bbcee8cfa7ac4a457a927f96949eb913f8
Reviewed-on: https://go-review.googlesource.com/91596
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2018-02-02 18:42:10 +00:00
Robert Griesemer
851e98f0ee spec: remove need for separate Function production (cleanup)
The EBNF production

	Function = Signature FunctionBody .

was used in FunctionDecl, MethodDecl, and FunctionLit, but only
for the latter it shortened the syntax slightly.

This change "inlines" Function which simplifies FunctionDecl and
MethodDecl and gets rid of the Function production.

This has no impact on the specified language. Also, the Function
production is never referred to by the prose, so it's safe to
remove it from the spec.

Finally, neither go/ast nor go/parser have a representation of
this production via a corresponding node or parse function, so
no possibly valuable documentation is lost, either.

Change-Id: Ia2875d31c6ec2d2079081ef481e50bad4f43c694
Reviewed-on: https://go-review.googlesource.com/91515
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
2018-02-02 00:22:16 +00:00
Mikio Hara
cbe1a61e74 net: fix the kernel state name for TCP listen queue on FreeBSD
Fixes #23653.

Change-Id: Ic1e3c8f156ae576cfb5da1b4d082d4b12fae114f
Reviewed-on: https://go-review.googlesource.com/91317
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-02-02 00:04:20 +00:00
David du Colombier
6f37fee354 cmd/go: fix TestNoCache on Plan 9
CL 91097 added TestNoCache. However, this
test is failing on Plan 9 because the HOME
environment variable doesn't contain the
home directory where the Go cache is located.

This change fixes the TestNoCache test
by using the home environment variable
instead of HOME on Plan 9.

Fixes #23644.

Change-Id: Icfb7a7a4c2852f159c93032b4081411628a2787f
Reviewed-on: https://go-review.googlesource.com/91216
Run-TryBot: David du Colombier <0intro@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-01-31 22:12:10 +00:00
Austin Clements
e5186895fc runtime: restore RSB for sigpanic call on mips64x
preparePanic must set all registers expected by Go runtime conventions
in case the sigpanic is being injected into C code. However, on
mips64x it fails to restore RSB (R28). As a result, if C code modifies
RSB and then raises a signal that turns into a sigpanic call, sigpanic
may crash when it attempts to lock runtime.debuglock (the first global
it references).

Fix this by restoring RSB in the signal context using the same
convention as main and sigtramp.

Fixes #23641.

Change-Id: Ib47e83df89e2a3eece10f480e4e91ce9e4424388
Reviewed-on: https://go-review.googlesource.com/91156
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-01-31 20:57:53 +00:00
Austin Clements
3ff41cdffa runtime: suppress "unexpected return pc" any time we're in cgo
Currently, gentraceback suppresses the "unexpected return pc" error
for sigpanic's caller if the M was running C code.

However, there are various situations where a sigpanic is injected
into C code that can cause traceback to unwind *past* the sigpanic
before realizing that it's in trouble (the traceback beyond the
sigpanic will be wrong).

Rather than try to fix these issues for Go 1.10, this CL simply
disables complaining about unexpected return PCs if we're in cgo
regardless of whether or not they're from the sigpanic frame. Go 1.9
never complained about unexpected return PCs when printing, so this is
simply a step closer to the old behavior.

This should fix the openbsd-386 failures on the dashboard, though this
issue could affect any architecture.

Fixes #23640.

Change-Id: I8c32c1ee86a70d2f280661ed1f8caf82549e324b
Reviewed-on: https://go-review.googlesource.com/91136
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-01-31 20:57:52 +00:00
Tobias Klauser
d929e40e9a syscall: use SYS_GETDENTS64 on linux/mips64{,le}
The getdents64 syscall is only available for mips64/mips64le starting
with Linux kernel 3.10. Since mips64le requires at least 4.8 according
to [1] (regarding #16848) using it should be fine.

[1] https://golang.org/wiki/MinimumRequirements

This CL changes the binary layout of type Dirent for mips64/mips64le,
but not the public API. But since the currently used layout doesn't
match the struct linux_dirent returned by the getdents syscall this
should be fine as well.

Fixes #23624

Change-Id: Iaa7306fa6e4442ad2fed41c60b37627a7314f117
Reviewed-on: https://go-review.googlesource.com/91055
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2018-01-31 20:42:49 +00:00
Cherry Zhang
43288467d2 test: add test for gccgo bug 23545
The fix is CL 91035.

Build only with gccgo at the moment, as it hits issue #23546.

Updates #23545.

Change-Id: I3a1367bb31b04773d31f71016f8fd7bd1855d7b5
Reviewed-on: https://go-review.googlesource.com/89735
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-01-31 20:03:31 +00:00
Ian Lance Taylor
1915030318 cmd/go: if unable to initialize cache, just disable it
Fixes #23638

Change-Id: I51967290448217f371fc7aba9259918ee9857143
Reviewed-on: https://go-review.googlesource.com/91097
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2018-01-31 19:35:00 +00:00
Austin Clements
ebe38b867c runtime: fail silently if we unwind over sigpanic into C code
If we're running C code and the code panics, the runtime will inject a
call to sigpanic into the C code just like it would into Go code.
However, the return PC from this sigpanic will be in C code. We used
to silently abort the traceback if we didn't recognize a return PC, so
this went by quietly. Now we're much louder because in general this is
a bad thing. However, in this one particular case, it's fine, so if
we're in cgo and are looking at the return PC of sigpanic, silence the
debug output.

Fixes #23576.

Change-Id: I03d0c14d4e4d25b29b1f5804f5e9ccc4f742f876
Reviewed-on: https://go-review.googlesource.com/90896
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-01-31 02:13:21 +00:00
Austin Clements
5c2be42a68 runtime: don't unwind past asmcgocall
asmcgocall switches to the system stack and aligns the SP, so
gentraceback both can't unwind over it when it appears on the system
stack (it'll read some uninitialized stack slot as the return PC).
There's also no point in unwinding over it, so don't.

Updates #23576.

Change-Id: Idfcc9599c7636b80dec5451cb65ae892b4611981
Reviewed-on: https://go-review.googlesource.com/90895
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-01-31 02:13:19 +00:00
Michael Hudson-Doyle
03e10bd9c4 os/signal: skip TestTerminalSignal if posix_openpt fails with EACCES
This happens in a chroot and so causes failures when packaging Go 1.10 for
Debian/Ubuntu.

Change-Id: I817038c237e584ce185b2168f8c7a10b9ef27b43
Reviewed-on: https://go-review.googlesource.com/90875
Run-TryBot: Michael Hudson-Doyle <michael.hudson@canonical.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-01-31 00:50:06 +00:00
Michael Hudson-Doyle
d30591c18d cmd/vendor/github.com/google/pprof: cherry-pick fix to cope with $HOME not being writable
Upstream PRs: https://github.com/google/pprof/pull/305,
https://github.com/google/pprof/pull/306.

Change-Id: I28969118f52ee08fcaf3572ad5da015ae756fd7a
Reviewed-on: https://go-review.googlesource.com/90935
Run-TryBot: Michael Hudson-Doyle <michael.hudson@canonical.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-01-31 00:49:35 +00:00
Brad Fitzpatrick
bcc86d5f42 doc: add GOMIPS to source installation docs
Also close </li> tags.

Fixes #23614

Change-Id: Icabcd577ef7df43e54d2b0068ee54614ba65bea1
Reviewed-on: https://go-review.googlesource.com/90815
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2018-01-30 19:54:01 +00:00
Mohit Agarwal
926f27873f cmd/fix: cleanup directories created during typecheck
Executing

$ go tool dist test -run=^go_test:cmd/fix$

leaves a number of directories (fix_cgo_typecheck*) in TMPDIR.

Change-Id: Ia5bdc2f7d884333771d50365063faf514ebf6eae
Reviewed-on: https://go-review.googlesource.com/90795
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-01-30 15:22:28 +00:00
Ian Lance Taylor
32a08d09b8 bootstrap.bash: only fetch git revision if we need it
Updates #22912
Fixes #23610

Change-Id: Id1c91fc3f040412d5931dba40e430685793f8eea
Reviewed-on: https://go-review.googlesource.com/90715
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-01-30 15:11:56 +00:00
Daniel Martí
14f8027a10 cmd/vet: extra args if any formats are indexed are ok
For example, the following program is valid:

	func main() {
		fmt.Printf("%[1]d", 1, 2, 3)
	}

If any of the formats are indexed, fmt will not complain about unused
extra arguments. See #22867 for more detail.

Make vet follow the same logic, to avoid erroring on programs that would
run without fmt complaining.

Fixes #23564.

Change-Id: Ic9dede5d4c37d1cd4fa24714216944897b5bb7cc
Reviewed-on: https://go-review.googlesource.com/90495
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
2018-01-30 14:36:35 +00:00
Daniel Martí
4072608b58 cmd/vet: %s is valid for an array of stringer
vet was quiet for []stringer, but not for [N]stringer. The source of the
problem was how the recursive call used .Elem().Underlying() for arrays,
but .Elem() for slices. In the first case, the named type is dropped,
thus losing all information of attached methods.

Be consistent across slices and arrays, by dropping the Underlying call
that is causing trouble. Add regression tests too, including cases where
the element type does not implement fmt.Stringer.

Fixes #23552.

Change-Id: I0fde07d101f112d5768be0a79207ef0b3dc45f2e
Reviewed-on: https://go-review.googlesource.com/90455
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
2018-01-30 14:36:11 +00:00
Daniel Martí
1f85917fb6 cmd/vet: **T is not Stringer if *T has a String method
vet recorded what types had String methods defined on them, but it did
not record whether the receivers were pointer types. That information is
important, as the following program is valid:

	type T string

	func (t *T) String() string {
		return fmt.Sprint(&t) // prints address
	}

Teach vet that, if *T is Stringer, **T is not.

Fixes #23550.

Change-Id: I1062e60e6d82e789af9cca396546db6bfc3541e8
Reviewed-on: https://go-review.googlesource.com/90417
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
2018-01-30 14:35:34 +00:00
Rob Pike
8c1f21d9a2 cmd/vet: disable complaint about 0 flag in print
The problem is that vet complains about 0 as a Printf flag in some
situations where fmt allows it but probably shouldn't. The two
need to be brought in line, but it's too late in the release cycle.

The situation is messy and should be resolved properly in 1.11. This
CL is a simple fix to disable a spurious complaint for 1.10 that will be
resolved in a more thorough way in 1.11.

The workaround is just to be silent about flag 0, as suggested in
issue 23605.

Fixes #23605
Update #23498

Change-Id: Ice1a4f4d86845d70c1340a0a6430d74e5de9afd4
Reviewed-on: https://go-review.googlesource.com/90695
Run-TryBot: Rob Pike <r@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-01-30 04:26:07 +00:00
Mohit Agarwal
d529aa93ea doc: fix the closing tag in contribute.html
Change-Id: I802bc11d90d414e7313dd11842a04fd6b591ea06
Reviewed-on: https://go-review.googlesource.com/90595
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-01-29 19:08:24 +00:00
Alberto Donizetti
f8610bbd5c doc: fix two small mistakes in 1.10 release notes
Change-Id: If928b14f6cd89b1d78745e8bc7a081ccbd7fd38f
Reviewed-on: https://go-review.googlesource.com/90515
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-01-29 18:34:00 +00:00
David du Colombier
5af1e7d78e cmd/go: skip external tests on plan9/arm
CL 13166, CL 13342 and CL 33425 skipped external tests
on freebsd/arm, linux/arm and linux/mips.

This CL does the same for plan9/arm to reduce test time
on plan9/arm and prevent the Go builder to time out.

Change-Id: I16fcc5d8010a354f480673b8c4a8a11dbc833557
Reviewed-on: https://go-review.googlesource.com/90416
Run-TryBot: David du Colombier <0intro@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-01-28 19:54:48 +00:00
Kevin Burke
00587e8988 doc: fix spelling mistake
Change-Id: I7bf1a93d3377acccdd3a34c5dcef7863310496e0
Reviewed-on: https://go-review.googlesource.com/89955
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-01-26 23:55:04 +00:00
Austin Clements
3ee8c3cc0b os: document inheritance of thread state over exec
Fixes #23570.

Change-Id: I462ada2960d710c2c94dc22a59d292703d83f612
Reviewed-on: https://go-review.googlesource.com/90255
Reviewed-by: Russ Cox <rsc@golang.org>
2018-01-26 18:54:04 +00:00
Austin Clements
b5b35be2b8 cmd/compile: don't inline functions that call recover
recover determines whether it's being called by a deferred frame by
matching its caller's argument frame pointer with the one recorded in
the panic object. That means its caller needs a valid and unique
argument frame pointer, so it must not be inlined.

With this fix, test/recover.go passes with -l=4.

Fixes #23557.

Change-Id: I1f32a624c49e387cfc67893a0829bb248d69c3d4
Reviewed-on: https://go-review.googlesource.com/90035
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-01-25 23:15:55 +00:00
Daniel Theophanes
651ddbdb50 database/sql: buffers provided to Rows.Next should not be modified by drivers
Previously we allowed drivers to modify the row buffer used to scan
values when closing Rows. This is no longer acceptable and can lead
to data races.

Fixes #23519

Change-Id: I91820a6266ffe52f95f40bb47307d375727715af
Reviewed-on: https://go-review.googlesource.com/89936
Run-TryBot: Daniel Theophanes <kardianos@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2018-01-25 19:14:14 +00:00
Sarah Adams
7350297eb6 doc: remove Sarah Adams from conduct working group contacts
Change-Id: Id2332332ba5ff5a3ae6e58882743aa25359c02f6
Reviewed-on: https://go-review.googlesource.com/89675
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-01-25 17:27:24 +00:00
Daniel Theophanes
1b69d19a42 database/sql: fix TestConversions when count > 1
Provide a fresh conversion table for TestConversions as it gets
modified on each test.

Change-Id: I6e2240d0c3455451271a6879e994b82222c3d44c
Reviewed-on: https://go-review.googlesource.com/89595
Run-TryBot: Daniel Theophanes <kardianos@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2018-01-25 03:39:24 +00:00
Richard Miller
e72e69a3f6 os: use the syscall version of Getwd for Plan 9
In Plan 9, each OS thread has its own independent working directory,
so the Go runtime for Plan 9 needs to coordinate Chdir and Getwd
operations to keep the working directory consistent for all goroutines.

The function os.Getwd in Plan 9 should always call syscall.Getwd
to retrieve the common working directory.  Failure to do this was
the cause of (at least some of) the intermittent failures in the
Plan 9 builders with a seemingly spurious "file does not exist"
message, when a thread's working directory had been removed in
another thread.

Change-Id: Ifb834ad025ee39578234ad3b04d08bc98e939291
Reviewed-on: https://go-review.googlesource.com/89575
Reviewed-by: David du Colombier <0intro@gmail.com>
Run-TryBot: David du Colombier <0intro@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-01-25 00:12:18 +00:00
Russ Cox
8d88c9ae07 cmd/go: fix -coverpkg=all with dot imports
If you use -coverpkg=all you get coverage for all packages in the build.
Go 1.9 used a global counter for all the GoCover variables, so that they
were distinct for the entire build. The global counter caused problems
with caching, so we switched to a per-package counter. But now the
GoCover_0 in one package may be dot-imported into another and
conflict with the GoCover_0 in that other package.

Reestablish (overwhelmingly likely) global uniqueness of GoCover
variables by appending an _xxxxxxxxxxxx suffix, where the x's are
the prefix of the SHA256 hash of the import path. The point is only
to avoid accidents, not to defeat people determined to break the tools.

Fixes #23432.

Change-Id: I3088eceebbe35174f2eefe8d558b7c8b59d3eeac
Reviewed-on: https://go-review.googlesource.com/89135
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-01-24 16:33:06 +00:00
Kevin Burke
236abdb46b go/types: fix spelling mistake in comment
Change-Id: If8609dd7c4bdc261056804759ec254f8af0156df
Reviewed-on: https://go-review.googlesource.com/89417
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-01-24 14:37:29 +00:00
Hana Kim
e89d08e021 runtime/pprof: scale mutex profile with sampling rate
pprof expects the samples are scaled and reflects unsampled numbers.
The legacy profile parser uses the sampling period in the output
and multiplies all values with the period.

0138a3cd6d/profile/legacy_profile.go (L815)

Apply the same scaling when we output the mutex profile
in the pprof proto format.

Block profile shares the same code, but how to infer unsampled
values is unclear. Legacy profile parser doesn't do anything special
so we do nothing for block profile here.

Tested by checking the profiles reported with debug=0 (proto format)
are similar to the profiles computed from legacy format profile
when the profile rate is a non-trivial number (e.g. 2) manually.

Change-Id: Iaa33f92051deed67d8be43ddffc7c1016db566ca
Reviewed-on: https://go-review.googlesource.com/89295
Reviewed-by: Peter Weinberger <pjw@google.com>
2018-01-24 14:06:59 +00:00
David du Colombier
157d8cfbc1 os: homogenize error checks on Plan 9
Remove leading space at the beginning of error strings,
so the strings are consistent between isExist, isNotExist
and isPermission functions.

Here is a list of error strings returned on the most common
file servers on Plan 9:

     match                     cwfs                      fossil                   ramfs

"exists"            "create/wstat -- file exists"  "file already exists"    "file exists"
"is a directory"                                   "is a directory"         "file is a directory"

"does not exist"                                   "file does not exist"    "file does not exist"
"not found"         "directory entry not found"
"has been removed"                                 "file has been removed"

"permission denied" "access permission denied"     "permission denied"      "permission denied"

"no parent" is an error returned by lib9p when removing a file without parent.

Change-Id: I2362ed4b6730b8bec7a707a1052bd1ad8921cd97
Reviewed-on: https://go-review.googlesource.com/89315
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
2018-01-24 07:18:36 +00:00
Kyle Shannon
c46952172d lib/time: follow redirects in curl
Starting on or about the 2018c archives, www.iana.org is redirected to
data.iana.org.  Tell curl to follow the redirect.

Updates: #22487

Change-Id: I00acada1a3ba01ef701d6d4ffae6cc2cbb6a068f
Reviewed-on: https://go-review.googlesource.com/89375
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-01-24 04:39:28 +00:00
Keith Randall
7eaa8efbe4 cmd/compile: don't let spills clobber arguments
The compiler allows code to have multiple differently-typed views of a
single argument. For instance, if we have

func f(x float64) {
   y := *(*int64)(unsafe.Pointer(&x))
   ...
}

Then in SSA we get two OpArg ops, one with float64 type and one with
int64 type.

The compiler will try to reuse argument slots for spill slots. It
checks that the argument slot is dead by consulting an interference
graph.

When building the interference graph, we normally ignore cross-type
edges because the values on either end of that edge can't be allocated
to the same slot. (This is just a space-saving optimization.) This
rule breaks down when one of the values is an argument, because of the
multiple views described above. If we're spilling a float64, it is not
enough that the float64 version of x is dead; the int64 version of x
has to be dead also.

Remove the optimization of not recording interference edges if types
don't match. That optimization is incorrect if one of the values
connected by the edge is an argument.

Fixes #23522

Change-Id: I361f85d80fe3bc7249014ca2c3ec887c3dc30271
Reviewed-on: https://go-review.googlesource.com/89335
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-01-23 21:51:55 +00:00
Robert Griesemer
f27a1ff2c8 go/types: more robust behavior in the presence errors (due to import "C")
- Don't complain about invalid constant type if the type is
  invalid already (we do this in other places as well). This
  is useful to do in general, and even more so if we have
  invalid types due to import "C".

- Type-check the lhs of an assignment even if we bail out early
  due to an error on the rhs. This was simply an oversight. We
  already have machinery in place to "use" expressions; in this
  case we just have to also make sure we don't overcount "uses"
  of variables on the lhs.

- Fix overcount uses correction in assignments: Only do it if
  the variable in question is declared inside the same package
  to avoid possible race conditions when type-checking exported
  variables concurrently.

Fixes #22090.

Change-Id: I4c1b59f9ce38970e7129fedc5f6023908386e4f1
Reviewed-on: https://go-review.googlesource.com/88375
Reviewed-by: Alan Donovan <adonovan@google.com>
2018-01-23 20:52:40 +00:00
Austin Clements
2edc4d4634 runtime: never allocate during an unrecoverable panic
Currently, startpanic_m (which prepares for an unrecoverable panic)
goes out of its way to make it possible to allocate during panic
handling by allocating an mcache if there isn't one.

However, this is both potentially dangerous and unnecessary.
Allocating an mcache is a generally complex thing to do in an already
precarious situation. Specifically, it requires obtaining the heap
lock, and there's evidence that this may be able to deadlock (#23360).
However, it's also unnecessary because we never allocate from the
unrecoverable panic path.

This didn't use to be the case. The call to allocmcache was introduced
long ago, in CL 7388043, where it was in preparation for separating Ms
and Ps and potentially running an M without an mcache. At the time,
after calling startpanic, the runtime could call String and Error
methods on panicked values, which could do anything including
allocating. That was generally unsafe even at the time, and CL 19792
fixed this be pre-printing panic messages before calling startpanic.
As a result, we now no longer allocate after calling startpanic.

This CL not only removes the allocmcache call, but goes a step further
to explicitly disallow any allocation during unrecoverable panic
handling, even in situations where it might be safe. This way, if
panic handling ever does an allocation that would be unsafe in unusual
circumstances, we'll know even if it happens during normal
circumstances.

This would help with debugging #23360, since the deadlock in
allocmcache is currently masking the real failure.

Beyond all.bash, I manually tested this change by adding panics at
various points in early runtime init, signal handling, and the
scheduler to check unusual panic situations.

Change-Id: I85df21e2b4b20c6faf1f13fae266c9339eebc061
Reviewed-on: https://go-review.googlesource.com/88835
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-01-23 20:08:46 +00:00
Austin Clements
9483a0bc23 runtime: don't grow the stack on sigpanic if throwsplit
Currently, if a _SigPanic signal arrives in a throwsplit context,
nothing is stopping the runtime from injecting a call to sigpanic that
may attempt to grow the stack. This will fail and, in turn, mask the
real problem.

Fix this by checking for throwsplit in the signal handler itself
before injecting the sigpanic call.

Updates #21431, where this problem is likely masking the real problem.

Change-Id: I64b61ff08e8c4d6f6c0fb01315d7d5e66bf1d3e2
Reviewed-on: https://go-review.googlesource.com/87595
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-01-23 19:50:18 +00:00
Robert Griesemer
9b49ac0366 spec: consistently use "defined type" and "type name" (cleanup)
When we introduced the notion of alias type declarations, we renamed
"named type" to "defined type" to avoid confusion with types denoted
by aliases and thus are also types with names, or "named types".

Some of the old uses of "named types" remained; this change removes
them.

Now the spec consistently uses the terms:

- "defined type"  for a type declared via a type definition
- "type name"     for any name denoting an (alias or defined) type
- "alias"         for a type name declared in an alias declaration

New prose is encouraged to avoid the term "named type" to counter-
act further confusion.

Fixes #23474.

Change-Id: I5fb59f1208baf958da79cf51ed3eb1411cd18e03
Reviewed-on: https://go-review.googlesource.com/89115
Reviewed-by: Rob Pike <r@golang.org>
2018-01-23 17:39:18 +00:00
fanzha02
cafb36bf11 cmd/internal/obj/arm64: fix assemble VLD1/VST1 bug
The current code misassembles VLD1/VST1 instruction with non-zero
offset. The offset is dropped silently without any error message.
The cause of the misassembling is the current code treats argument
(Rn)(Rm) as ZOREG type.

The fix changes the matching rules and considers (Rn)(Rm) as ROFF
type. The fix will report error information when assembles VLD1/VST1
(R8)(R13), [V1.16B].
The fix enables the ARM64Errors test.

Fixes #23448

Change-Id: I3dd518b91e9960131ffb8efcb685cb8df84b70eb
Reviewed-on: https://go-review.googlesource.com/87956
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-01-23 15:59:15 +00:00
Russ Cox
4a2f28f51e doc, cmd/go: final release notes edits
Except for removing the DRAFT marker, I think these are now ready to go.

Change-Id: I20604f5b135616189a24990db463c7bb5e7d48f1
Reviewed-on: https://go-review.googlesource.com/88975
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-01-23 14:37:53 +00:00
Fazlul Shahriar
99e6e482f4 os: handle ' is a directory' error as IsExist on Plan 9
This error is returned by os.Mkdir when the directory already exists.

This change fixes some upspin tests.

Change-Id: I9ad5aefebb32dff577726d537b4f3826d79868eb
Reviewed-on: https://go-review.googlesource.com/88656
Reviewed-by: David du Colombier <0intro@gmail.com>
Run-TryBot: David du Colombier <0intro@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-01-23 07:52:44 +00:00
Martin Möhrmann
4a7334b7f2 cmd/dist: only run swig tests when a go directory is present in swiglib
When there is no go directory inside the swiglib directory then swig
was installed without Go support. Tests in misc/swig will fail when
swig is installed without Go support.

Add additional checks for the presence of a go directory in the directory
reported by 'swig -go -swiglib' to determine if misc/swig tests should
be run.

This avoids all.bash failing when swig but not swig-go is installed
using macports.

Tested on darwin with swig and with and without swig-go installed
using macports.

Fixes #23469

Change-Id: I173201221554982ea0d9f2bea70a3cb85b297cec
Reviewed-on: https://go-review.googlesource.com/88776
Reviewed-by: David Chase <drchase@google.com>
2018-01-23 04:18:23 +00:00
Andrew Bonventre
6c27114ced doc: document Go 1.8.6
Update golang/go#23515

Change-Id: Id334d8663bf4cbb68f224d1bba4c9ad3855f8aae
Reviewed-on: https://go-review.googlesource.com/89155
Reviewed-by: Andrew Gerrand <adg@golang.org>
2018-01-23 02:15:53 +00:00