1e1ec013b9
Global, package-level queries can be done without typechecking. This makes it significantly cheaper. Instead of typechecking, consider all packages that directly import the query package. In each of those packages, filter out: * files that don't contain the query name * files that don't import the query package Fully parse the remaining files and look for selector expressions matching the query package and name. There are a few twists (dot imports, the query package, xtests). They are described, along with how they are handled, in the large comment at the beginning of globalReferrersPkgLevel. On my machine and GOPATH, this reduces typical time needed to find referrers to encoding/json.MarshalIndent from (roughly) real 0m39.946s user 2m27.844s sys 0m54.774s to (roughly) real 0m5.687s user 0m15.793s sys 0m16.001s The processing of packages could be parallelized; that is left for a future change, to ease reviewing. Benefits from that will be limited; building the reverse import graph accounts for 73% of the runtime, and that is dominated by syscalls. Optimization idea from Alan Donovan. This work supported by Sourcegraph. Change-Id: Ib19e25fcdcb27673fb03d7300dba2a53198901ad Reviewed-on: https://go-review.googlesource.com/97800 Reviewed-by: Alan Donovan <adonovan@google.com> Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> |
||
---|---|---|
benchmark/parse | ||
blog | ||
cmd | ||
container/intsets | ||
cover | ||
go | ||
godoc | ||
imports | ||
internal/fastwalk | ||
playground | ||
present | ||
refactor | ||
third_party | ||
.gitattributes | ||
.gitignore | ||
AUTHORS | ||
codereview.cfg | ||
CONTRIBUTING.md | ||
CONTRIBUTORS | ||
LICENSE | ||
PATENTS | ||
README.md |
Go Tools
This subrepository holds the source for various packages and tools that support the Go programming language.
Some of the tools, godoc
and vet
for example, are included in binary Go
distributions.
Others, including the Go guru
and the test coverage tool, can be fetched with
go get
.
Packages include a type-checker for Go and an implementation of the Static Single Assignment form (SSA) representation for Go programs.
Download/Install
The easiest way to install is to run go get -u golang.org/x/tools/...
. You can
also manually git clone the repository to $GOPATH/src/golang.org/x/tools
.
Report Issues / Send Patches
This repository uses Gerrit for code changes. To learn how to submit changes to this repository, see https://golang.org/doc/contribute.html.
The main issue tracker for the tools repository is located at https://github.com/golang/go/issues. Prefix your issue with "x/tools/(your subdir):" in the subject line, so it is easy to find.