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

2154 Commits

Author SHA1 Message Date
Josh Bleecher Snyder
9bf174b4d3 cmd/stringer: use source importer when available
This means that running stringer should always
have the intended effect, without having to
go install the package first, which was a common
source of confusion.

The source importer is marginally slower,
but stringer is run infrequently,
and we're only typechecking one package (and fmt),
not an entire tree, as vet does.

Fixes golang/go#10249

Change-Id: Ib8cde29bd6cc596964dbe7348065932dd59075fc
Reviewed-on: https://go-review.googlesource.com/40403
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Robert Griesemer <gri@golang.org>
2017-04-12 18:56:47 +00:00
Brad Fitzpatrick
7ee420f17d Revert "imports: wait for fastWalk workers to finish before returning"
This reverts commit 4436e54754.

Reason for revert: Breaks goimports. See:
https://github.com/golang/go/issues/16399#issuecomment-293248363

Change-Id: I3bda8f0fd32380d19d7daecf3489a24e51abfbe7
Reviewed-on: https://go-review.googlesource.com/40296
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-04-11 14:41:52 +00:00
Dmitri Shuralyov
ef3dcd5937 cmd/heapview: look for tools repository in all GOPATH entries
The GOPATH environment variable is defined at
https://golang.org/cmd/go/#hdr-GOPATH_environment_variable as:

> The GOPATH environment variable lists places to look for Go code. On
> Unix, the value is a colon-separated string. On Windows, the value is
> a semicolon-separated string. On Plan 9, the value is a list.

It is legal for Go packages to be in any of those places, not only
the first entry. Look in all places for golang.org/x/tools repository.

Cache the directory that is found. It's slightly more expensive
to look for it, since potentially multiple directories must be
checked for existence.

Updates golang/go#19400.

Change-Id: I16661b7149d52ea6168fffc605c842d7a4da009b
Reviewed-on: https://go-review.googlesource.com/38778
Reviewed-by: Michael Matloob <matloob@golang.org>
2017-04-10 18:12:01 +00:00
Josh Bleecher Snyder
6e29264c4f cmd/compilebench: fix package name in comment
Change-Id: Ie5c413fc9f13cf029d8d8a6cae5754838c834395
Reviewed-on: https://go-review.googlesource.com/40170
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-04-10 17:39:46 +00:00
Giovanni Bajo
5584fb0720 gotype: fix default importer for Go 1.8.
Importer "source" does not exist in Go 1.8, so this means that
default usage of gotype is broken in that compiler version.

Change-Id: I517520b0cac7c62a3e213d0647a3d621e8ced58c
Reviewed-on: https://go-review.googlesource.com/40091
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-04-10 16:28:46 +00:00
Joël Stemmer
4436e54754 imports: wait for fastWalk workers to finish before returning
In some cases walkFn is being called after the fastWalk function has
returned. This often happens when an error was encountered early on in
scanning directories with many entries.

It is caused by fastWalk not waiting for its workers to complete their
work. A sync.WaitGroup is used to wait for all workers to finish when
the function returns.

Updates golang/go#16399

Change-Id: I695d30c18e4878b789520b9d8a650f9688d896ac
Reviewed-on: https://go-review.googlesource.com/40092
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-04-09 19:02:35 +00:00
Josh Bleecher Snyder
24acc66eab cmd/compilebench: put in correct subdirectory
Apparently there was a typo during initial import,
and compilebench was placed at the top level,
rather than in the cmd subdirectory. Oops. Fix that.

Change-Id: Ibea9ed132dca26c022ea02933defec9534105f18
Reviewed-on: https://go-review.googlesource.com/39792
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-04-06 18:57:16 +00:00
Josh Bleecher Snyder
ded95f530c cmd/compilebench: generate separate cpu profiles when using -count
When the -count flag is provided,
instead of having each run overwrite the previous profile,
add a count suffix to the profile filename.
Then you can combine the profiles with

go tool pprof `go tool -n compile` <all profile files here>

This allows generation of precise profiles,
even for fast-compiling packages.

Change-Id: I006cf8fad143346b28a646a0b3582cc0f6eec310
Reviewed-on: https://go-review.googlesource.com/39718
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2017-04-06 17:20:06 +00:00
Josh Bleecher Snyder
1cab72a478 cmd/compilebench: unify Size benchmark implementations
Change-Id: I181d9f9ce8880af8fbcdd43073d62f492725c85b
Reviewed-on: https://go-review.googlesource.com/39717
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-04-06 17:20:00 +00:00
Josh Bleecher Snyder
89b6e5ee0d cmd/compilebench: change MakeBash to StdCmd
Instead of running make.bash, run 'go build -a std cmd'.
Change the benchmark name to reflect this.

This does roughly the same task, namely compile and link
all the code in the tree, but with several advantages:

* It works cross-platform.
* It is a bit faster, while measuring the same fundamentals.
* It doesn't measure how fast the bootstrap compiler works,
  which is irrelevant.
* If interrupted, it leaves the current Go installation
  in a usable state.

Change-Id: I469b1d032b48b06e3dea021bd031283bc3a16ff4
Reviewed-on: https://go-review.googlesource.com/39714
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2017-04-06 17:19:53 +00:00
Josh Bleecher Snyder
7e40ef3876 cmd/compilebench: update list of packages
There's a surprising amount of variety
in the drivers of compilation speed.
It's helpful to have a variety of packages here.
For example, archive/tar exhibits golang/go#19839
much more than the others.

Change-Id: If66b332d63427fb246305cb14cfee9ef450bcdcf
Reviewed-on: https://go-review.googlesource.com/39713
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2017-04-06 17:15:02 +00:00
Josh Bleecher Snyder
a0d14bb1f7 cmd/compilebench: import from rsc.io
This CL is an import of compilebench from rsc.io/compilebench
at commit 1a5bec7724500bd6df47e053dbc42b41fe653372.

This CL brings in only main.go, unaltered.
The other files were:

* LICENSE: now unnecessary
* README.md: now unnecessary
* compilecmp: still available at its original home,
  soon to be superceded by a new tool in x/tools

Once compilecmp is available in x/tools,
I will replace rsc.io/compilebench with a breadcrumb repo.

All outstanding pull requests against rsc.io/compilebench are from me.
They will be closed, and new CLs sent here as appropriate.

Change-Id: Ic436abf4a662173c6c184bc765b1b9cab13b3cfb
Reviewed-on: https://go-review.googlesource.com/39712
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-04-06 16:32:47 +00:00
Josh Bleecher Snyder
5054e612af cmd/toolstash: don't build cmd for android
Linking cmd for android requires a cross-compiling toolchain,
which is not standard fare.

Skip it, and trust that the other platforms will pick up the slack.

Change-Id: Ifcf74f77e98489c859805ab7a448d80d019f3d20
Reviewed-on: https://go-review.googlesource.com/39556
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-04-05 15:47:30 +00:00
Kevin Burke
37a1062ad0 cmd/tip: redirect http://tip.golang.org to https
At some point we switched tip.golang.org to run in GKE, which
terminates TLS directly on port 443. This requires a new technique
for detecting a plain HTTP connection. In addition we may want to run
talks.golang.org on App Engine Flex, which uses an X-Forwarded-Proto
header to indicate HTTP, so let's prepare for that possibility.

Fixes golang/go#19759.

Change-Id: Iddc567214c5d28f61c405db065aa1b3f2c92fd85
Reviewed-on: https://go-review.googlesource.com/38800
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-04-03 05:32:14 +00:00
Kevin Burke
620ecdb8d7 all: apply new machine-generated doc spec to files
Updates golang/go#13560.

Change-Id: I1664807a065c7982a57d4dc9cee22ce261536c5b
Reviewed-on: https://go-review.googlesource.com/39202
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-04-01 01:24:29 +00:00
haya14busa
d83db204ce cmd/goimports: flush to disk before diffing
Port of gofmt change at golang.org/cl/36750

Change-Id: Ie0ef6770be6361264ed45a9a9ece950aba24e852
Reviewed-on: https://go-review.googlesource.com/39073
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-03-31 04:14:08 +00:00
Yasuhiro Matsumoto
d63e2b22b0 cmd/toolstash: use strings.LastIndexAny
Change-Id: I06a4610a5f5c49806a1b151a65c25bbbd881a314
Reviewed-on: https://go-review.googlesource.com/38753
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-03-28 14:23:59 +00:00
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