Visible changes:
- "referrers" queries now emit a stream of results,
so they start appearing quickly even in large queries.
We no longer report the total number of matches.
- packageReferrers now also uses AfterTypeCheck hook and streaming.
- XML support has been dropped.
- The -format flag has been replaced by -json.
JSON protocol changes:
- The enclosing Result struct has been removed.
- Likewise the 'mode' field (since the caller knows it already)
- "freevars" and "referrers" now emit a stream of objects
In the case of referrers, the first object has a different from the rest.
- The "referrers" results include the text of the matching line
(parity with -json=false)
Implementation details:
- the concurrency-safe q.Output function can be called
many times, each with a queryResult to print.
- fset is no longer saved in Query (cleaner)
- queryResult methods renamed PrintPlain, JSON
Change-Id: I41a4e3f57f266fcf043ece4045bca82c6f6a356f
Reviewed-on: https://go-review.googlesource.com/21397
Reviewed-by: Michael Matloob <matloob@golang.org>
This is the first of a series of changes that add support for
speaker notes to the Go present tool. This is done by displaying
slides with speaker notes on a second window, and synchronizing
both windows.
Updates golang/go#14654
Change-Id: Ic7b158d1e40f9e7e58d01791c88909f5619ce87f
Reviewed-on: https://go-review.googlesource.com/21485
Reviewed-by: Andrew Gerrand <adg@golang.org>
Per https://groups.google.com/forum/#!topic/golang-announce/qu_rAphYdxY
this change deletes the packages
go/exact
go/gccgoimporter
go/gcimporter
go/importer
go/types
cmd/vet
from the x/tools repo and any files depending on those packages
building against Go 1.4.
x/tools packages depending on any of these libraries must use the
respective versions from the std lib or use vendored versions if
building against 1.4.
Remaining packages may or may not build against Go 1.4 anymore
and will not be supported against 1.4.
Change-Id: I1c655fc30aee49b6c7326ebd4eb1bb0836ac97e0
Reviewed-on: https://go-review.googlesource.com/20810
Reviewed-by: Alan Donovan <adonovan@google.com>
Always serve from four instances to avoid flakiness.
Change-Id: I11684f93bb27a377f54ddbe4fb3d95894d393a48
Reviewed-on: https://go-review.googlesource.com/21528
Reviewed-by: Chris Broadfoot <cbro@golang.org>
This is simply a copy of std lib's go/internal/gcimporter/bimport.go
with updated header comment and build tag. No semantic changes.
This will fix part of the x/tools build break at tip. The other part
is to adjust bexport.go (next CL).
Change-Id: Ibc37fae7e0d0447fdea9e3a733aa38589735c59a
Reviewed-on: https://go-review.googlesource.com/21543
Reviewed-by: Alan Donovan <adonovan@google.com>
Although these flags are harmless on linux, they
cause clang on darwin to issue an error about
unused flags (-lpthread). We only care about compilation
so we don't need them.
Change-Id: I0fc756e2f4d7a829d43b5aa912c4e4b24a802a1c
Reviewed-on: https://go-review.googlesource.com/21283
Reviewed-by: Robert Griesemer <gri@golang.org>
The os/user.lookup function no longer exists so instead we use
os/user.current. (This function also existed in go1.5.)
Change-Id: Ic66d80acc186289331f1023e0145370feab6a001
Reviewed-on: https://go-review.googlesource.com/21281
Reviewed-by: Robert Griesemer <gri@golang.org>
It has few interesting effects on aliasing and it contains a lot of
unsafe code that we can't analyze.
Change-Id: I66d3592ea7797802c6be36eb30fd17e2ee307e50
Reviewed-on: https://go-review.googlesource.com/21260
Reviewed-by: Robert Griesemer <gri@golang.org>
We cannot determine the extension of buffers with no file names (not
without throwing an error, anyway.)
Change-Id: I2b10390da738d71b6f95a6f668d3b92b54db29ed
Reviewed-on: https://go-review.googlesource.com/20470
Reviewed-by: Alan Donovan <adonovan@google.com>
That way, running guru on /a/foo.go, followed by /b/bar.go won't leave
the user with a display buffer that still defaults to /a/
Change-Id: I3f9b085c6d206ac2adc269fc2009799c624c371a
Reviewed-on: https://go-review.googlesource.com/20475
Reviewed-by: Alan Donovan <adonovan@google.com>
Now that we have both interactive and non-interactive uses of the guru,
we should separate the command output buffer from the display buffer.
Change-Id: I50082fdc3847c7b12869e204509141e906df3852
Reviewed-on: https://go-review.googlesource.com/20473
Reviewed-by: Alan Donovan <adonovan@google.com>
By using guru's -modified flag and making up a file name, we can run
guru on a buffer that has no file attached to it. This feature will only
be useful for queries that operate on single files, as otherwise our made
up name could cause conflicts.
This will be useful for the "what" query and features using it.
Change-Id: I3d199bc0548245d59ba7b492f57beb9422d7f43d
Reviewed-on: https://go-review.googlesource.com/20431
Reviewed-by: Alan Donovan <adonovan@google.com>
This fixes some print calls with wrong format directives. Additionally,
struct initialisers were changed to use keyed fields, purely to reduce
the amount of noise generated by go vet.
Change-Id: Ib9f6fd8f2dff7ce84826478de0ba83dda9746270
Reviewed-on: https://go-review.googlesource.com/21180
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Fix the following issue detected by golint:
import.go:9:1: package comment should be of the form "Package importer ..."
It makes the package comment more consistent with other packages.
Change-Id: I1415066c136ce249af19d70848a38203caf7c9c7
Reviewed-on: https://go-review.googlesource.com/21177
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
The prior commit fixed this test for tip (1.7) but broke it for 1.6.
Change-Id: Ic39d215ac8bc60dba4b66201f1f16713b2e02d9c
Reviewed-on: https://go-review.googlesource.com/21144
Reviewed-by: Alan Donovan <adonovan@google.com>
Implement the "what" query and use it to get all uses of an
identifier (the "sameids" attribute). The user can either manually call
go-guru-hl-identifier, which will highlight all instances of the
identifier under point, or they can enable the
go-guru-hl-identifier-mode minor mode. The minor mode sets up an idle
timer, which will highlight the current identifier after a configurable
timeout. If the user modifies the buffer, or moves point off of an
identifier, we clear the highlight.
Change-Id: Iac870f3bcd17e0002eafcba0b73f07adaa03cd76
Reviewed-on: https://go-review.googlesource.com/20433
Reviewed-by: Alan Donovan <adonovan@google.com>
The existing implementation of NameSpace implicitly assumes that a
FileSystem with a directory at the top will be mounted at the root
mount point "/" of the NameSpace. If this is not the case, then
Stat("/") will fail even if ReadDir("/") succeedes. This is unexpected
behavior which breaks directory traversal routines (eg. http.FileServer).
This CL adds an unexported implementation of FileSystem called emptyVFS
that emulates an empty directory and adds a NewNameSpace() function that
binds emptyVFS to "/" so that unexpected behavior does not arise even if
the use does not mount anything explicitly at "/".
Latest patch set causes the FileInfo of the empty top level emulated
directory to return "/" for Name() and Zero Time for ModTime() and
removes the related struct state fields being used in the previous
implementation.
Fixesgolang/go#14190
Change-Id: Idce2fc3c9b81206847a33840d76b660059d53d18
Reviewed-on: https://go-review.googlesource.com/19445
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
go vet detected that the value of pkgIndexOnce
is copied through assignments in the test.
This patch fixes that by converting it to *sync.Once instead.
Change-Id: I90b2252942625b2f8a93eb5da24d16c6a8a56e4e
Reviewed-on: https://go-review.googlesource.com/20910
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
The previous CL added a duplicate InvalidType to the predecl table so
that it tracked the one used by gc, but this caused it to fail an
assertion of uniqueness, and I ran the wrong tests.
Change-Id: I56342046cea328e503d917127f5b12205df7999a
Reviewed-on: https://go-review.googlesource.com/20870
Reviewed-by: Robert Griesemer <gri@golang.org>
Although invalid types and unknown constant values should never appear
in .a files (since gc will stop with an error before writing export
data), they can now be faithfully encoded and decoded. This makes the
protocol robust for IDE-like applications that must deal with incomplete
or incorrect programs.
(Corresponding std lib CL: https://go-review.googlesource.com/20828)
Change-Id: I539ffd951b90f01705a7f23ec778c623c729d9a0
Reviewed-on: https://go-review.googlesource.com/20827
Reviewed-by: Robert Griesemer <gri@golang.org>
To help track down some flakiness.
Change-Id: I2dd21abdc0f05c58857da580d962b0ab72cf52b3
Reviewed-on: https://go-review.googlesource.com/20728
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
In go1.5, go/constant (floating-point) numeric values are printed
as fractions. Correct output as necessary so that they always
appear as floating-point numbers to match golden files.
Change-Id: If63a14d8d87bb664bf6272b16345e38e8d638ead
Reviewed-on: https://go-review.googlesource.com/20719
Reviewed-by: Alan Donovan <adonovan@google.com>
The binary import/export functionality depends on go/constant from
go1.6 - make it only available if we build against go1.6. Eventually
this packet will be replaced by std lib go/importer functionality.
Change-Id: If96cf2e889daf1250152d7719afa64ad1ba8fb0e
Reviewed-on: https://go-review.googlesource.com/20716
Reviewed-by: Alan Donovan <adonovan@google.com>
These changes will need to be reverted once we use
vendoring in the stdlib again, but it's trivial to
do so when the time comes.
TBR=adonovan
Fixes#14823.
Change-Id: I2173c48d5466874492affc679332f6484bf96592
Reviewed-on: https://go-review.googlesource.com/20695
Reviewed-by: Robert Griesemer <gri@golang.org>
Also: renamed file to match 1.7 tag.
Fixesgolang/go#14824.
Change-Id: Iea92292d93c1140e3396678bc37f50f0348e616a
Reviewed-on: https://go-review.googlesource.com/20694
Reviewed-by: Michael Hudson-Doyle <michael.hudson@canonical.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
This change copies the respective changes from https://golang.org/cl/20605.
There is a format conflict here - we are going to track tip, not 1.6.
This change should fix the issue when testing against tip.
Fixesgolang/go#14824.
Change-Id: I58e79cc65748e7a3e5c8486c6cee339884110a07
Reviewed-on: https://go-review.googlesource.com/20693
Reviewed-by: Alan Donovan <adonovan@google.com>
When an Example's output is listed as being Unordered this will make
godoc display "Unordered output:" rather than the normal "Output:".
For an example of where this is useful, see the recently added example
for math.rand.Perm().
Change-Id: I737c901102dca46434f46a48300445bb43ce34e0
Reviewed-on: https://go-review.googlesource.com/20458
Reviewed-by: Andrew Gerrand <adg@golang.org>
Also fix a typo in the tool's help string.
Change-Id: I54a9ed4a5515b137b0fbf1b2391dd6fa84b2d2d8
Reviewed-on: https://go-review.googlesource.com/20474
Reviewed-by: Alan Donovan <adonovan@google.com>
If godoc didn't come up quickly enough, we would leave it running and
then try to start another one on the same port.
The new one would fail to start, being unable to bind to the address,
causing cascading failures.
Also increase the timeout to 10 minutes.
Change-Id: I7008a39f649021ea213902d557f26bf78567026d
Reviewed-on: https://go-review.googlesource.com/20420
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
The error message is attempting to display the line of text, but was
incorrectly using m (which is always nil) instead of line.
Change-Id: Id09f488b3b7b0e8c3c2cb6e8f0a8d635861c77ac
Reviewed-on: https://go-review.googlesource.com/19330
Reviewed-by: Ian Lance Taylor <iant@golang.org>
The BuilderModeFlag function does not work with flag packages (such as
Google's) that define their own FlagSet. This change exposes a type
that satisifies flag.Value insted of a function. That type
is *BuilderMode; there's no need for a separate wrapper type.
Change-Id: I8095b80de499e3c52a29a5c1996d1b1fe3799358
Reviewed-on: https://go-review.googlesource.com/20330
Reviewed-by: Michael Matloob <matloob@golang.org>