Also add a TODO inside the format.Options expression,
as we are not currently wiring up some information from the main go.mod.
The TODO comment contains a summary of what should be done.
Change-Id: Ibace6c36de4b729b5ba8b347f6f48f0a8fda695e
Reviewed-on: https://go-review.googlesource.com/c/tools/+/387374
Trust: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Robert Findley <rfindley@google.com>
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Gopls was using an old version of workfile support in x/mod that did not
support the 'use' syntax.
Upgrade to x/mod@master, and update tests accordingly.
For golang/go#44696
Change-Id: I87841cd1322d7b1aa0fbc929838746ea600bee77
Reviewed-on: https://go-review.googlesource.com/c/tools/+/382078
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
This breaks the build at Go 1.12, as documented in golang/go#50827.
Fixesgolang/go#50827
Change-Id: Ic7c122757e53981c5ee8f7fdf74fe276895717f2
Reviewed-on: https://go-review.googlesource.com/c/tools/+/380555
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Use github.com/jba/printsrc in place of github.com/sanity-io/litter to
generate the Go code with API documentation. It is smart enough
to elide type names, making the "massive hack" of deleting them
unnecessary. It also omits zero values from the output.
Change-Id: Ic1bb937b9a3695e6da6db72b74c6049be1c5b80d
Reviewed-on: https://go-review.googlesource.com/c/tools/+/370840
Trust: Jonathan Amsterdam <jba@google.com>
Run-TryBot: Jonathan Amsterdam <jba@google.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
This enables the narrower "all" pattern described in
https://golang.org/doc/go1.16#all-pattern,
eliminating some otherwise-unnecessary checksums.
For golang/go#36460.
Change-Id: Ia894b1c1d85f8d1317aebb816921e95e7c1da506
Reviewed-on: https://go-review.googlesource.com/c/tools/+/315569
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
This test checks that if a single value in the Initialize message
changes, the resulting unmarshalled struct changes in no more than
one place. The implication is that ignoring UnmarshalTypeErrors
in LSP processing is safer than causing a fatal error, which is the
current state.
Change-Id: I64bbf6f785c32fa7483966a117ac3b6f11d573be
Reviewed-on: https://go-review.googlesource.com/c/tools/+/310109
Run-TryBot: Peter Weinberger <pjw@google.com>
Trust: Peter Weinberger <pjw@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
This change ensures that packages using exec.LookPath or
exec.Command to find or run binaries do not accidentally run
programs from the current directory when they mean to run programs
from the system PATH instead.
Change-Id: I5907aa630ff64012395a7eb472967a477d90f12e
Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/949438
Reviewed-by: Katie Hockman <katiehockman@google.com>
Reviewed-by: Russ Cox <rsc@google.com>
Reviewed-on: https://go-review.googlesource.com/c/tools/+/284773
Run-TryBot: Roland Shoemaker <roland@golang.org>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Roland Shoemaker <roland@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
Largely no functional changes, but it's the first tagged release and it
has a few bug fixes compared to the previous version from September.
It pulls in new versions of x/mod and even x/tools itself, which is
amusing.
Change-Id: I9b889a162af14d75aa5ca2f448a29b18a555f572
Reviewed-on: https://go-review.googlesource.com/c/tools/+/280315
Trust: Daniel Martí <mvdan@mvdan.cc>
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
gopls-CI: kokoro <noreply+kokoro@google.com>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
The test doesn't pass on Android, likely because of the use of
go/packages.
Change-Id: If31ea39e9dfbbb1dc0d9c123a43384cb552cd025
Reviewed-on: https://go-review.googlesource.com/c/tools/+/279712
Trust: Rebecca Stambler <rstambler@golang.org>
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
gopls-CI: kokoro <noreply+kokoro@google.com>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
Reviewed-by: Peter Weinberger <pjw@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
When internal data structures in gopls changed, the templates driving
the debug server failed because fields or methods they relied on
had gone away. At some cost, this change adds tests that all the
fields and methods in the templates can be satisfied.
The test assumes that all the template uses are through render() in
debug/serve.go. It checks that is list of templates is the same
as the server's, and then type checks each template.
The costs are
1. the template type checking is done by a new external dependency,
github.com/jba/templatecheck
2. To avoid adding a new dependency to x/tools, the test is in
the gopls module, not the debug package, so variables from the
debug package have to be exported
In an ideal world the debug package, and much of internal/lsp,
would be in the gopls package. In that case the cost 2 about could
be avoided.
In an ideal world, the core runtime template packages would
contain template checking code, and cost 1 would be unnecessary.
In a more likely (or not so distant) world, perhaps jba would move
(or allow us to move) the template check package into x/tools.
Change-Id: I36b509a00cbdcb5323ee1af3c1193b603c7a907f
Reviewed-on: https://go-review.googlesource.com/c/tools/+/277292
Run-TryBot: Peter Weinberger <pjw@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
Trust: Peter Weinberger <pjw@google.com>
Combine the generation of the API json with the generation of the
documentation. This cuts out a step from the generation process, and
allows us to depend on third-party modules. Use litter to print a
composite literal instead of JSON text, which will diff and merge much
better.
The only real drawback is that you have to "go run" from the gopls
module to avoid adding the extra deps to tools.
Sorry about the copy and paste; there's relatively little actual code
change, just a bit in doMain and rewriteAPI.
Change-Id: Iac936d31b7e52651b3b33f27497cfdbd133f1e76
Reviewed-on: https://go-review.googlesource.com/c/tools/+/274373
Trust: Heschi Kreinick <heschi@google.com>
Run-TryBot: Heschi Kreinick <heschi@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
This change reworks CL 240118 to apply gofumpt directly as a formatter,
not an analyzer. Depending on how gofumpt changes, we may be able to use
it as an analyzer in the future, but for now it's just easier to add it
as a formatting hook.
Fixesgolang/go#39805
Change-Id: I227fde4b1916d8a82557f30dfca88e155136dff5
Reviewed-on: https://go-review.googlesource.com/c/tools/+/241985
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
CL 226639 changed the positions of the go.mod diagnostics (in a
negligible way), but the tests are quite brittle and can't handle the
different position. Rewrite this test as a regression test to handle it.
The special // indirect marker can be removed from the go/expect package
as a result, since it was only used in this one place.
Change-Id: I7d9a62e32e53d477838e65673635ed231c07b659
Reviewed-on: https://go-review.googlesource.com/c/tools/+/240691
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Markdown is enabled by starting the title with "# ".
See the new documentation in present/doc.go for details.
For golang/go#33955.
Change-Id: I04ef2aa2cf253bdf48910c5674d679a482ffa33f
Reviewed-on: https://go-review.googlesource.com/c/tools/+/222846
Reviewed-by: Rob Pike <r@golang.org>
Used Rohan's new code lens feature to upgrade some of our outdated
dependencies.
Change-Id: Ifddd5c00f36e5a7e32aca3113e03cd3caeb4cdb9
Reviewed-on: https://go-review.googlesource.com/c/tools/+/221102
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
This change updates staticcheck to 2020.1.3.
It fixes two bugs involving //lint:ignore directives:
- When ignoring U1000 and checking a package that contains tests, Staticcheck would incorrectly complain that the linter directive didn't match any problems, even when it did.
- On repeated runs, the position information for a this linter directive didn't match anything report would either be missing, or be wildly incorrect.
Change-Id: I98bc57d290393d77af1ab8acf486239a8f125fac
Reviewed-on: https://go-review.googlesource.com/c/tools/+/220597
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
This change updates Staticcheck to the newly released 2020.1.2.
Change-Id: I80606b9c993de2f504c0ca3ee68f695ec8bd50e9
Reviewed-on: https://go-review.googlesource.com/c/tools/+/220477
Run-TryBot: Robert Findley <rfindley@google.com>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
Our current implementation isn't robust, and it doesn't seem worth it to
invest significant effort in improving it when this library exists.
Also, make the protocol part of the default URL regex non-optional, as
the alternative is that any string of the format "foo.bar" will appear
to be a link.
Updates golang/go#33505
Change-Id: Ia430a1c193eded394f8af12050bdd4dc2a9ccc94
Reviewed-on: https://go-review.googlesource.com/c/tools/+/212517
Reviewed-by: Heschi Kreinick <heschi@google.com>
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Created an analogous data structure for go.mod files when we parse them
using the golang.org/x/mod package. Gopls can now access the data
within a go.mod file using a parseModHandle and the corresponding
parseModData object. This will help down the road when it is time
to implement the lsp functions for go.mod files.
Updates golang/go#31999
Change-Id: Ibd4d64569bbe3df61b203490b63399d479e7d794
Reviewed-on: https://go-review.googlesource.com/c/tools/+/211303
Run-TryBot: Rohan Challa <rohan@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
this shuffles things so there a single exporter API rather than an observer
It also removes most of the globals.
per telemetry type.
Change-Id: Iaa82abe2ded1fff9df8e067ed4a55bcbd9d9591f
Reviewed-on: https://go-review.googlesource.com/c/tools/+/190405
Run-TryBot: Ian Cottrell <iancottrell@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
If a user runs a file= query for a source that doesn't exist,
and they are outside of a module, fill in the GoSources for the
empty package that go list returns, so the overlay can be applied.
Also add a hack for the case where go list can't determine the compiler
(gc or gccgo) a user is using because
go list -f "{{context.Compiler}}" -- unsafe
doesn't work. If go list complains that a user is outside a module,
we'll give ourselves flexibility to guess things because there's
no right answer. So we'll guess that the compiler is gc.
Fixesgolang/go#33482
Change-Id: I6a8aa0c617c4d803558389fb4272854245f59c5a
Reviewed-on: https://go-review.googlesource.com/c/tools/+/189322
Run-TryBot: Michael Matloob <matloob@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
This is used by all the telemetry packages that come next
Change-Id: Ic84d91da2a792b53ee8839aae207ae5767ab17e0
Reviewed-on: https://go-review.googlesource.com/c/tools/+/184940
Run-TryBot: Ian Cottrell <iancottrell@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
CL 183264 accidentally introduced a circular modular reference from
golang.org/x/tools -> golang.org/x/tools/gopls.
Fixed by running go mod tidy on all modules under the x/tools repo for
good measure.
Change-Id: Ib09b111315cb107bc4e34015b74266d2522f33fd
Reviewed-on: https://go-review.googlesource.com/c/tools/+/184018
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>