1
0
mirror of https://github.com/golang/go synced 2024-10-01 07:38:32 -06:00
Commit Graph

2137 Commits

Author SHA1 Message Date
Yasuhiro Matsumoto
474a26d4c8 cmd/guru: Close before Remove a file
Change-Id: Ia12ff7a0f6898f8d140565d255793904ce8585c4
Reviewed-on: https://go-review.googlesource.com/38754
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-03-28 13:38:24 +00:00
Yasuhiro Matsumoto
963fe939f1 cmd/heapview: remove needless slash
Change-Id: Ie19a60595862c0afff9364ee21dd9598370e6c91
Reviewed-on: https://go-review.googlesource.com/38752
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-03-28 13:38:09 +00:00
haya14busa
1f0f7f68c9 imports: return when done channel is closed
Change-Id: I49317a947ec58572fd16078279678d4514cc2a4b
Reviewed-on: https://go-review.googlesource.com/37919
Run-TryBot: Matt Layher <mdlayher@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matt Layher <mdlayher@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-03-27 15:17:22 +00:00
Robert Griesemer
c21bc47f89 go/gcimporter: exclude failing test from gcimporter tests (fix build)
This is already tested in the std library. Ok to take the easy way
out here.

Change-Id: Ie17e16fddba827bfe279e1f790006b3874f830ad
Reviewed-on: https://go-review.googlesource.com/38455
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2017-03-22 23:20:07 +00:00
Josh Bleecher Snyder
322b9d710a cmd/toolstash: use 'go tool dist list' to get platforms
This fixes several issues:

* The ls sed hackery generates GOARCH values mipsx and mipsxle,
  instead of mips, mips64, mipsle, and mips64le.
* It removes the dependence on the 9 command.
* It marginally increases readability.

Change-Id: Ie46abc289c2c9923eed693dcf1194f4fd3ea9bd2
Reviewed-on: https://go-review.googlesource.com/38347
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2017-03-22 14:37:47 +00:00
Matthew Dempsky
81dff79736 cmd/godoc: fix tests for cmd/compile refactorings
In golang.org/cl/38089, I removed all of the prog.go files.

Change-Id: I4d8dd021a62b5d6d8b7cb5cfe0ecd7268812805c
Reviewed-on: https://go-review.googlesource.com/38432
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-03-21 23:01:40 +00:00
Matthew Dempsky
b08393ce6d go/gcimporter15: backport interface embedding support
Backports golang.org/cl/38392 from go/internal/gcimporter.

Updates golang/go#16369.

Change-Id: Ic805f96e6565590987a5dae9f0f76c206fceab05
Reviewed-on: https://go-review.googlesource.com/38429
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
2017-03-21 22:26:56 +00:00
Rob Pike
23ca8a2633 cmd/stringer: tweak "Code generated by" comment to match new standard
See https://golang.org/issue/13560 for the full discussion.

The actual change is just the addition of a final period.

Update golang/go#13560

Change-Id: Icc2f52b67181de344aa5107f94faa0e739ff993c
Reviewed-on: https://go-review.googlesource.com/38415
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-03-21 04:07:08 +00:00
Josh Bleecher Snyder
a5c9681e31 cmd/toolstash: don't pass -N when compiling runtime
The runtime cannot be compiled with optimizations disabled.
This lead to very confusing error messages
when toolstash -cmp failed.

Change-Id: Ie341d633ff9b26693b475957309591ff0757f1ab
Reviewed-on: https://go-review.googlesource.com/38378
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2017-03-20 21:03:53 +00:00
Kevin Burke
2946dd1f77 godoc/static: add license preamble to static file
Change-Id: Icfdb6b544ff8613efc5a183d50efe6bb92dc6784
Reviewed-on: https://go-review.googlesource.com/38165
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-03-16 00:32:22 +00:00
Tamir Duberstein
6185cb1f31 cmd/goyacc: remove empty branch
Found with honnef.co/go/tools/cmd/staticcheck.

Change-Id: I39e23936e01543db62b7b0919a3b58b65cd40099
Reviewed-on: https://go-review.googlesource.com/38174
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-03-15 21:33:42 +00:00
Tamir Duberstein
43bc42d6f5 cmd/goyacc: remove unused functions
Found with honnef.co/go/tools/cmd/unused.

Change-Id: Ie7ee9f687bcec1faa40c890a84666ef6c27d9b77
Reviewed-on: https://go-review.googlesource.com/38176
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-03-15 21:33:35 +00:00
Chris Broadfoot
b282a57667 godoc/redirect: allow trailing slashes for prefix handlers
This allows URLs like golang.org/wiki/DevExp/, where before only
golang.org/wiki/DevExp was accepted.

Fixes golang/go#19432.

Change-Id: Ie41a4fe1d1930fd947c1d0523060d08c7c6d6d39
Reviewed-on: https://go-review.googlesource.com/37882
Reviewed-by: Jaana Burcu Dogan <jbd@google.com>
2017-03-15 20:02:31 +00:00
Tamir Duberstein
d332283808 cmd/goyacc: remove ineffective break statement
Found with honnef.co/go/tools/cmd/staticcheck.

Change-Id: I7f765ef1710d151ebda5716c99587acd3a90db1f
Reviewed-on: https://go-review.googlesource.com/38173
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-03-15 15:30:16 +00:00
Tamir Duberstein
1f5953e340 cmd/goyacc: use a constant instead of zero value
Found with honnef.co/go/tools/cmd/unused.

Change-Id: I373d710e0f5f98dcf591826a26541d1d12696e14
Reviewed-on: https://go-review.googlesource.com/38175
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-03-15 15:28:09 +00:00
Tamir Duberstein
ab34c5f581 cmd/goyacc: remove unused generated bindings
Found with honnef.co/go/tools/cmd/unused (in CockroachDB).

Change-Id: I0e2f7ac6ad2a0fdc724928f316060f06c3261ece
Reviewed-on: https://go-review.googlesource.com/38178
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
2017-03-14 23:14:11 +00:00
Tamir Duberstein
f2e43688df cmd/goyacc: merge variable declaration with assignment
Found with honnef.co/go/tools/cmd/simple.

Change-Id: I04c65394f1c6404f57bb2088353325899f35011f
Reviewed-on: https://go-review.googlesource.com/38177
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
2017-03-14 23:13:33 +00:00
Robert Griesemer
2f69a5922b cmd/gotype: make it compile against Go 1.8 and earlier
types.SizesFor was introduced for Go 1.9. Need to provide
a local implementation to have gotype build against earlier
versions.

Fixes golang/go#19545.

Change-Id: I6fdbe414e6574eda00c01295b666230daff2dfdc
Reviewed-on: https://go-review.googlesource.com/38157
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
2017-03-14 21:50:22 +00:00
Robert Griesemer
381149a2d6 cmd/gotype: re-introduce gotype command at traditional location
Except for the added comment in the beginning and the removal of
the 'ignore' build tag, there is no difference between gotype.go
and the original.

Fixes golang/go#19516.

Change-Id: Ie1ab9aced6e650573c2cdce0c165af1e1094213f
Reviewed-on: https://go-review.googlesource.com/38132
Reviewed-by: Alan Donovan <adonovan@google.com>
2017-03-13 17:37:17 +00:00
Brad Fitzpatrick
f60b69ed8c imports: fix symlink loop detection, deflaking TestImportSymlinks
Change the shouldTraverse function to no longer keep a global map of
which inodes it's seen. Instead, whenever a symlink is seen for a path
name, check every directory entry in that path name and see if any are
the same inode as the current one, detecting any loop just from the
name itself.

More details of why the test was flaky are in the bug.

Fixes golang/go#18142

Change-Id: I869f7a13d130c63d78b7af81802a16c4b4b2f3bd
Reviewed-on: https://go-review.googlesource.com/37947
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-03-08 23:27:09 +00:00
Alan Donovan
7fdb908ead cmd/guru: fix tests now that go1.9 go/types returns fake packages
The go1.9 type checker now returns fake packages in addition to an
error if the package was not found at all.  This changes the behavior
of guru in a release-specific way, requiring the test to be split into
a common part and a go1.9-specific part.

In hindsight, perhaps it would have been better to place the
expectation in a comment alongside the query so that they can be
easily enabled or disabled together.  (The downside of that design is
that you can't batch-update all the expectations to match the actual
behavior.)

Change-Id: I58054adec428fbab7fe3c57097aefc827f89a46e
Reviewed-on: https://go-review.googlesource.com/37865
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-03-08 23:16:52 +00:00
Brad Fitzpatrick
03d3934baf cmd/tip: move tip.golang.org from App Engine to Kubernetes on GKE
Change-Id: I52ca7eaca98de27bd920ae01086b3f7724819738
Reviewed-on: https://go-review.googlesource.com/37754
Reviewed-by: Chris Broadfoot <cbro@golang.org>
2017-03-07 03:49:08 +00:00
Alan Donovan
767744efe2 go/ssa/interp: add more intrinsics for sync/atomic and runtime
Change-Id: I4743fa32be5549b2d141595d236c653e53cc9ff4
Reviewed-on: https://go-review.googlesource.com/37712
Reviewed-by: Robert Griesemer <gri@golang.org>
2017-03-06 18:20:00 +00:00
Dominik Honnef
a99f4ece36 go/pointer: implement extended queries
The existing API for querying values only allows directly querying
pointer-like values, or pointers to such values. The new, extended
queries make it possible to destructure values and access arbitrarily
nested pointers, such as fields in structs, or specific values in
tuples.

We use single Go expressions as the queries, which we further restrict
to a subset of the language (indexing, field access, pointer
dereferences and channel receives).

Instead of adding another map to Result, we return a *Pointer and
populate it during analysis. This does mean that a Config cannot be
reused for multiple analyses, as it now holds analysis-specific state.
That is, however, not a big problem as reusing one Config had little
use.

Since the new API can do everything the old could, it deprecates
AddQuery and AddIndirectQuery.

Change-Id: I4b2ae7d85c462bc7faa6bab76456106e76be5a65
Reviewed-on: https://go-review.googlesource.com/37635
Reviewed-by: Alan Donovan <adonovan@google.com>
2017-03-06 04:11:41 +00:00
Dmitri Shuralyov
f595fb5c96 cmd/godoc, godoc: implement build.Context.IsDir, update expected error string
Prior to this change, handlerServer.GetPageInfo created a build.Context
starting with build.Default, and provided custom implementations for
its IsAbsPath, ReadDir, and OpenFile funcs. Those funcs would operate
on h.c.fs virtual filesystem.

https://godoc.org/go/build#Context.IsDir is documented as:

	// IsDir reports whether the path names a directory.
	// If IsDir is nil, Import calls os.Stat and uses the result's IsDir method.
	IsDir func(path string) bool

IsDir was left as nil, and so the default implementation was used.
The default implementation uses os.Stat and isn't aware of the h.c.fs
virtual filesystem.

This appears to have been harmless in the past, but after the change to
go/build in https://golang.org/cl/33158, it started to interfere with
the operation of godoc. The command godoc began to fail to resolve
relative import path "." in directories that exist, because the
incorrect IsDir implementation was looking in real filesystem, rather
than the virtual one:

	$ ./godoc fmt
	2017/03/04 18:59:50 cannot find package "." in:
		/target
	$ ./godoc -http=localhost:6060
	2017/03/04 19:00:07 cannot find package "." in:
		/src/fmt

Providing a custom implementation of IsDir that is aware of the h.c.fs
virtual filesystem, and performs a stat operation on the correct path
there resolves that problem. It also fixes the failing tests.

Additionally, because the exact error string returned from
Context.Import has changed after https://golang.org/cl/33158,
and now contains the text "package not found" rather than the
underlying error text from filesystem caused by a failed ReadDir
operation, the expected error message from "./godoc nonexistingpkg"
in a test needed to be updated to "cannot find package". It's no longer
dependent on the operating system.

It might be desirable to provide more relevant detail in the error
message from cmd/godoc when a package is not found, but that should be
determined and done in a followup CL. The scope of this one is to fix
normal functionality.

This change follows update to go/build in https://golang.org/cl/33158.

Helps golang/go#19401.

Change-Id: I00e2f746ec4a2fe7e640218adce75f15bdf29aaf
Reviewed-on: https://go-review.googlesource.com/37768
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-03-05 21:32:12 +00:00
David R. Jenni
8ffd8eda92 x/tools/cmd/guru: fix golden files for what query
CL golang.org/cl/37349 broke the tests, because the
golden files were not updated appropriately.

Change-Id: I9a2a56d1ca74b8bc77935aff26ed6297fbacf232
Reviewed-on: https://go-review.googlesource.com/37770
Reviewed-by: Dominik Honnef <dominik@honnef.co>
Run-TryBot: Dominik Honnef <dominik@honnef.co>
2017-03-04 20:46:07 +00:00
Alan Donovan
3537037b0b cmd/guru: report 'whicherrs' in modes of 'what' query
A 'what' query reports which other query modes are applicable to the
selected syntax.  A 'whicherrs' query is similar to a 'pointsto'
query, so we enable it using the same criteria.

Fixes issue golang/go#18938

Change-Id: Iae062e0c933c7764bc335488adabf816d63ac837
Reviewed-on: https://go-review.googlesource.com/37349
Reviewed-by: Dominik Honnef <dominik@honnef.co>
2017-03-04 02:31:33 +00:00
Dmitri Shuralyov
a663d825ff cmd/godoc: Fix package comment inconsistencies.
Remove inadvertent and unwanted spaces in the middle of an
indented block.

Insert blank lines before indented sections for consistency.

Insert colon after "pointer" for consistency with "type".

Fixes golang/go#19356.

Change-Id: Iaae12f69d17adb51a27b516727c13132cb8df8e8
Reviewed-on: https://go-review.googlesource.com/37660
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Dominik Honnef <dominik@honnef.co>
Run-TryBot: Dominik Honnef <dominik@honnef.co>
2017-03-04 00:53:44 +00:00
Alan Donovan
181cdfd456 go/ssa: create an 'init' function even if len(files)==0
Package "unsafe" has no files, and is treated like a regular package since
https://go-review.googlesource.com/37710, and the interpreter needs an
init function with a body for every package.

Change-Id: I27bd7cdb1ecaf01d0b5ed91db57145d1b4f551e1
Reviewed-on: https://go-review.googlesource.com/37711
Reviewed-by: Robert Griesemer <gri@golang.org>
2017-03-03 14:03:29 +00:00
Robert Griesemer
f5a6ee1ea9 cmd/gotype: delete this command in favor of go/types/gotype.go in the std lib
Change-Id: Ifd03e5ec607ff127ab11c307d99877de81aeacf2
Reviewed-on: https://go-review.googlesource.com/37657
Reviewed-by: Paul Jolly <paul@myitcv.org.uk>
Reviewed-by: Alan Donovan <adonovan@google.com>
2017-03-02 22:45:06 +00:00
Alan Donovan
7a49e427c8 go/loader: don't create types.Package for "unsafe"
https://golang.org/cl/37694 is a backwards-incompatible change to the
go/types API that causes "unsafe" to be included among the results of
(*types.Package).Imports().  Client packages such as go/loader and
go/ssa now need to recognize the special unsafe package and its
unusual *Bultin members and not create a types.Package for it.

Change-Id: I902725d3053cb887246978efdb5ec5dcdc0e4818
Reviewed-on: https://go-review.googlesource.com/37710
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-03-02 21:55:26 +00:00
David R. Jenni
1dce95f761 x/tools/imports: remove unused type gate.
Found with honnef.co/go/tools/cmd/unused.

Change-Id: I3e40d58044c250bfeafc77e5eef4533390ace12b
Reviewed-on: https://go-review.googlesource.com/37607
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-03-01 15:49:35 +00:00
David R. Jenni
ee178bea37 x/tools/godoc: remove unused functions
Found with honnef.co/go/tools/cmd/unused.

Change-Id: I193ddd265673f133a489d268629b94be693a8dbc
Reviewed-on: https://go-review.googlesource.com/37606
Reviewed-by: Alan Donovan <adonovan@google.com>
2017-03-01 14:54:25 +00:00
David R. Jenni
b20a216efb x/tools/go/internal/gccgoimporter: remove unused method
Found with honnef.co/go/tools/cmd/unused.

Change-Id: Ib8acac744a171b70f3f842f8f5f8c34064869383
Reviewed-on: https://go-review.googlesource.com/37604
Reviewed-by: Alan Donovan <adonovan@google.com>
2017-03-01 14:54:10 +00:00
David R. Jenni
76c38d6bce x/tools/go/buildutil: remove unused function
Found with honnef.co/go/tools/cmd/unused.

Change-Id: I1dc8e4dbfd784bb22b2f0dabb7c1a08cf1ef44ee
Reviewed-on: https://go-review.googlesource.com/37603
Reviewed-by: Alan Donovan <adonovan@google.com>
2017-03-01 14:53:57 +00:00
David R. Jenni
fd9cb7c10f x/tools/cmd/html2article: remove unused functions
Found with honnef.co/go/tools/cmd/unused.

Change-Id: Ifd1ed4005eec55cebfd5c0d0519b8af328fcc470
Reviewed-on: https://go-review.googlesource.com/37601
Reviewed-by: Alan Donovan <adonovan@google.com>
2017-03-01 14:53:04 +00:00
David R. Jenni
8211efe185 x/tools/cmd/guru: remove unused method.
Found with honnef.co/go/tools/cmd/unused.

Change-Id: Ied3a906269ca7782071428eeb1764b3b863576a2
Reviewed-on: https://go-review.googlesource.com/37600
Reviewed-by: Alan Donovan <adonovan@google.com>
2017-03-01 14:52:51 +00:00
David R. Jenni
e06694fefd x/tools/cmd/godoc: remove unused variable
Found with honnef.co/go/tools/cmd/unused.

Change-Id: I3db2aad14de33f0be69569cd355e453173098358
Reviewed-on: https://go-review.googlesource.com/37599
Reviewed-by: Alan Donovan <adonovan@google.com>
2017-03-01 14:52:40 +00:00
Alan Donovan
81cc31eaa9 Revert "x/tools/container/intsets: remove unused function"
This reverts commit 79902b439b.

Reason for revert: build broken on some platforms.

Change-Id: I5ceddc305580ff97f47ae27da831f99e96dab424
Reviewed-on: https://go-review.googlesource.com/37539
Reviewed-by: David R. Jenni <david.r.jenni@gmail.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
2017-03-01 14:51:44 +00:00
David R. Jenni
f9348ea9b1 x/tools/present: remove unused code
Found with honnef.co/go/tools/cmd/unused.

Change-Id: Iabfa1e9926e097ba11d1db0a2d785fec70ce3997
Reviewed-on: https://go-review.googlesource.com/37609
Reviewed-by: Alan Donovan <adonovan@google.com>
2017-03-01 14:50:10 +00:00
David R. Jenni
64f598be56 x/tools/refactor/eg: remove unused variable
Found with honnef.co/go/tools/cmd/unused.

Change-Id: I4a39f337a266e14f0188d32cf89a7e19718e0ded
Reviewed-on: https://go-review.googlesource.com/37630
Reviewed-by: Alan Donovan <adonovan@google.com>
2017-03-01 14:46:18 +00:00
David R. Jenni
79902b439b x/tools/container/intsets: remove unused function
Found with honnef.co/go/tools/cmd/unused.

Change-Id: I54dab41d423050b883a3af1f5bb8c5119e2b7100
Reviewed-on: https://go-review.googlesource.com/37602
Reviewed-by: Alan Donovan <adonovan@google.com>
2017-03-01 14:40:33 +00:00
David R. Jenni
36a48c93a6 x/tools/go/ssa: remove unused field from NamedConst
Found with honnef.co/go/tools/cmd/unused.

Change-Id: I68b4af07cc64a46f5794a0e339859f4d6bc9dad1
Reviewed-on: https://go-review.googlesource.com/37605
Reviewed-by: Alan Donovan <adonovan@google.com>
2017-03-01 14:40:01 +00:00
David R. Jenni
43de7a390a x/tools/cmd/goyacc: remove unused function.
Found with honnef.co/go/tools/cmd/unused.

Change-Id: Iad26e1ae1dbeb29a3223279eccc4ba6f6bb48bd6
Reviewed-on: https://go-review.googlesource.com/37631
Reviewed-by: Alan Donovan <adonovan@google.com>
2017-03-01 14:38:58 +00:00
David R. Jenni
718875e4f9 x/tools: simplify and format code
Semi-mechanical changes using gofmt -s
and honnef.co/go/tools/cmd/gosimple.

Change-Id: I41bcf4bea5b16c4776b7cf6534b76aa59b3c022d
Reviewed-on: https://go-review.googlesource.com/37447
Reviewed-by: Alan Donovan <adonovan@google.com>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-02-28 14:15:42 +00:00
David R. Jenni
4968197297 x/tools/refactor/rename: fix nil pointer dereference.
Fix a nil pointer dereference by checking the error returned by
conf.Load.

Bug was reported on Reddit:
https://www.reddit.com/r/golang/comments/5vo0fb/

Change-Id: I2ad6f03922b772f03e282a0af6eea24f8de9cef8
Reviewed-on: https://go-review.googlesource.com/37432
Reviewed-by: Alan Donovan <adonovan@google.com>
2017-02-24 20:12:46 +00:00
Alan Donovan
219e654bb7 go/ssa: eliminate dead φ-nodes in cycles
The previous "dead φ" check was simple and naive but left cycles of
dead φ-nodes.  This confused some downstream static analysis tools.
This change makes the φ-nodes liveness check transitive.

+ Test.

Also, number phi nodes so they're not all called t0 during debugging.

Reduces memory consumption by  1%.
Increases execution time   by <1%.

Change-Id: I2908662c1478d455fdf4a179f4a12d6184a456c0
Reviewed-on: https://go-review.googlesource.com/37157
Reviewed-by: Robert Griesemer <gri@golang.org>
2017-02-22 01:23:56 +00:00
Paul Jolly
8e779ee0a4 x/tools/cmd/gotype: support type checking of xtest packages.
As noted by griesemer in golang/go#18799, this doesn't address the issues
raised in golang/go#11415 because when checking an xtest package the
corresponding package is assumed to have been installed. This
however is similar to the assumptions made by go vet (raised
as an issue in golang/go#16086). So whilst not perfect, it will probably
suffice until golang/go#11415 is resolved.

Fixes golang/go#18799

Change-Id: I1ea005c402e5d6f5abddda68fee6386b0531dfba
Reviewed-on: https://go-review.googlesource.com/36992
Reviewed-by: Robert Griesemer <gri@golang.org>
2017-02-17 23:47:18 +00:00
Jay Conrod
e1bdc76d04 x/tools/cmd/godoc: fix broken links in composite literals
Previously, field names in composite literals were treated as normal
identifiers. For example, in Foo{X: 42}, X was treated link a normal
variable and was linked to "#X".

With this change, field links now include a prefix for their type
definition, for example, "#Foo.X".

Fixes golang/go#16031

Change-Id: I9cb501704f284fbbc05424555312307c61843e47
Reviewed-on: https://go-review.googlesource.com/36830
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
2017-02-17 22:21:49 +00:00
Jay Conrod
00f7cd5589 x/tools/cmd/godoc: Fix incorrectly indented literals in examples
godoc formats function examples for text or HTML output by
stripping the surrounding braces and un-indenting by replacing
"\n    " with "\n". This modifies the content of string literals,
resulting in misleading examples.

This change introduces a function, replaceLeadingIndentation, which
unindents more carefully. It removes the first level of indentation
only outside of string literals. For plain text output, it adds custom
indentation at the beginning of every line including string literals.

Fixes golang/go#18446

Change-Id: I52a7f5756bdb69c8a66f031452dd35eab947ec1f
Reviewed-on: https://go-review.googlesource.com/36544
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
2017-02-17 21:58:39 +00:00