1
0
mirror of https://github.com/golang/go synced 2024-10-01 15:58:33 -06:00
Commit Graph

3146 Commits

Author SHA1 Message Date
Rebecca Stambler
a754db16a4 internal/lsp: absolutize paths when converting filenames to URIs
Fixes golang/go#30280

Change-Id: I95e72c8d952ce7d64114772e9ef3df6568ae5dd4
Reviewed-on: https://go-review.googlesource.com/c/163160
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2019-02-21 00:07:07 +00:00
Rebecca Stambler
8bdde6d5f2 internal/lsp: create new cache for each analysis
Because diagnostics computations happen in parallel, we were getting
concurrent map writes by keeping one cache.

Change-Id: Ifa5adffe14c509168c9f8c5cb012f3fcd3a32441
Reviewed-on: https://go-review.googlesource.com/c/163161
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
2019-02-20 22:52:34 +00:00
Rebecca Stambler
191e9ce6ac go/gcexportdata: switch constant used in tests
text/scanner was used in tests because it was unlikely to change between
releases, but of course, a line number changed, breaking the tests. Use
a different constant for testing that remained on the same line.

Change-Id: I41425728e0918ffe388b3c8df9fd71e8371eb38e
Reviewed-on: https://go-review.googlesource.com/c/163197
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Julie Qiu <julie@golang.org>
2019-02-20 22:41:35 +00:00
Dmitri Shuralyov
97f80cd550 godoc/dl, godoc/proxy, godoc/short, internal/memcache: delete
These packages existed only to power cmd/godoc for the purpose of
serving the golang.org website. That functionality has moved into
x/website as part of golang/go#29206. x/website has become the
canonical source of golang.org in CL 162157, the golang.org-serving
code was removed from cmd/godoc in CL 162400, and these packages can
be deleted too now.

This removes the last dependency on the cloud.google.com/go module,
which results in a significant reduction of the number of indirect
dependencies in x/tools (this is due to issue golang/go#29935, which
affects the current version of the cloud.google.com/go module).

Run go mod tidy (using Go 1.12 RC 1).

Updates golang/go#29206
Updates golang/go#29981

Change-Id: If07e3ccae8538b3ebd51af64b6af5be5463f4906
Reviewed-on: https://go-review.googlesource.com/c/162401
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Channing Kimble-Brown <channing@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
2019-02-20 19:06:17 +00:00
Dmitri Shuralyov
b4f3f03986 cmd/godoc: remove golang.org serving code
The code to serve the golang.org website has been moved to
the golang.org/x/website sub-repository. x/website has become
the canonical source of the golang.org website as of CL 162157,
and so this code can be removed from here now.

This has the benefit of removing some external dependencies
that were only used by the website in production mode, and
in turn enabling x/tools to be a smaller tools-related module.

In future changes, the golang.org/x/tools/cmd/godoc command
will be reduced in scope to be a tool for serving Go package
documentation only, not the rest of the golang.org website.

Run go mod tidy (using Go 1.12 RC 1).

Updates golang/go#29206
Updates golang/go#29981

Change-Id: I61fd25627d0506901b04688dea8d8c9da9fe8f04
Reviewed-on: https://go-review.googlesource.com/c/162400
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Channing Kimble-Brown <channing@golang.org>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
2019-02-20 19:02:57 +00:00
Rebecca Stambler
58344e5403 internal/lsp: use cached AST when parsing files, if available
Change-Id: Ie5c9f77d973b8f9d8f7732d62b54e0a99e6b4659
Reviewed-on: https://go-review.googlesource.com/c/162890
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2019-02-20 18:46:31 +00:00
Ian Cottrell
f7b6a898a4 internal/lsp: remove unused range parameter from computeTextEdits
Change-Id: I3e9853b2a83d0328d10bcb75fc9f1f1cc996f14e
Reviewed-on: https://go-review.googlesource.com/c/163157
Run-TryBot: Ian Cottrell <iancottrell@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-02-20 18:40:53 +00:00
Rebecca Stambler
550322b34f internal/lsp: return an updated view after setting a file's contents
Change-Id: I71cfa1463c3f3ec3b80faf9dd57c81d6fa75c466
Reviewed-on: https://go-review.googlesource.com/c/162892
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2019-02-20 18:06:46 +00:00
Bryan C. Mills
e8c45e0433 go/analysis: allow overriding V flag without code patches
In CL 149609, a file was added to
src/cmd/vendor/golang.org/x/tools/go/analysis/internal/analysisflags/patch.go
to override the behavior of the V flag for cmd/vet.

That modification causes the behavior of cmd/vet to change when a
pristine copy of x/tools is vendored in, and module-mode vendoring
will only support pristine copies (see golang/go#30240).

Instead, allow cmd/vet to override the V flag by defining its own V
flag before it invokes unitchecker.Main.

Tested manually (by patching into cmd/vendor).

Updates golang/go#30240
Updates golang/go#30241
Updates golang/go#26924
Updates golang/go#30228

Change-Id: I10e4523e1f4ede94fbfc745012dadeefef48e927
Reviewed-on: https://go-review.googlesource.com/c/162989
Run-TryBot: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-02-20 15:01:58 +00:00
Dmitri Shuralyov
9394956cfd godoc: don't clear user-set page mode for package builtin
When rendering the documentation of the fake package builtin,
there are two PageInfoMode flags that always get set,
regardless of what the user has provided via the ?m= query parameter.
They are:

• NoFiltering
• NoTypeAssoc

This is being done to make the documention of this special package more
usable and helpful (see golang/go#6645).

This change modifies the way those flags are set, so that any additional
flags the user may have set are no longer cleared. This makes it possible,
for example, to use ?m=src to view the source, as it is for all other
packages.

Also elaborate more about this behavior in the comments.

Fixes golang/go#30300
Updates golang/go#6645

Change-Id: I77728bd2683191b97d8f58f19092f2833dfc474c
Reviewed-on: https://go-review.googlesource.com/c/162983
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-02-19 18:51:02 +00:00
Dmitri Shuralyov
d38dac729d godoc: remove unused CLI-only identifiers
This is a followup to CL 141397, which removed CLI support from the
godoc command for golang/go#25443. This change removes a few more
CLI-related fields from Presentation type, which are now unused.

It also removes the unused and no longer documented (since CL 143077)
NoHTML PageInfoMode.

Updates golang/go#25443

Change-Id: Ia4147515052889570e2f050e3c2394689d3c5d6c
Reviewed-on: https://go-review.googlesource.com/c/162982
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Agniva De Sarker <agniva.quicksilver@gmail.com>
2019-02-19 18:50:39 +00:00
Rhys Hiltner
f000d56b39 cmd/godoc: fix -url flag, add tests
This change adds a small number of integration tests for the godoc
command's -url flag, confirming that the behavior matches the local http
server tests in those cases. It fixes three bugs which prevent the -url
flag from working currently.

Fixes golang/go#30259
Fixes golang/go#30260
Fixes golang/go#30261

Change-Id: I0ca1fe81f9f186d0ca02b31674cc8654af434e92
Reviewed-on: https://go-review.googlesource.com/c/162907
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2019-02-19 13:52:30 +00:00
Dmitri Shuralyov
0a7d439b5f cmd/godoc: re-add documentation for flat presentation mode
The documentation of the "flat" presentation mode was removed
inadvertently as part of post-CLI-removal documentation cleanup
in CL 143077. The FlatDir flag still exists and is supported.
This change re-adds it to cmd/godoc documentation.

Also fix a typo in the "src" presentation mode description.

Updates golang/go#25443

Change-Id: If4705d70bc5eafee92cdfd52409aca4606a0efd7
Reviewed-on: https://go-review.googlesource.com/c/162984
Reviewed-by: Agniva De Sarker <agniva.quicksilver@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-02-19 03:57:21 +00:00
Michael Matloob
8dcb7bc8c7 all: add a go.mod file
This change adds a go.mod and go.sum file to the tools repo, following the
requirements stated in bcmills's comment here:
https://golang.org/issue/28136#issuecomment-462971974. It's
important to note that we will not be
adding versions to the repo for now.

The change was generated by running "go mod init" and "go mod tidy" using Go
1.11.5 in the top-level directory of the tools repository.

The tools repo has some extraneous dependencies, but they will be removed soon
(we expect a couple of weeks). At that point, our go.sum should shrink to a
small handful of entries.

Updates golang/go#28136

Change-Id: Ie7802d8d70094a855b112ad0507a47036cb81ba0
Reviewed-on: https://go-review.googlesource.com/c/162397
Run-TryBot: Michael Matloob <matloob@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2019-02-14 20:49:34 +00:00
Rebecca Stambler
78f9822548 internal/lsp: fix nil pointer exception on vendored packages
Make sure to use the import path in the packages cache, rather than the
package path. Also, prefetch dependencies.

Change-Id: I0de3942346aa6755dbe904f973aca51d26ba0306
Reviewed-on: https://go-review.googlesource.com/c/162577
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2019-02-14 19:54:51 +00:00
Michael Matloob
12f59dd68b refactor/importgraph: get test to pass when run in modules mode
Use packagestest to copy the code in the test directory to a GOPATH
in a temporary directory, so the test doesn't depend on accessing
the user's GOPATH.

Change-Id: I5895ad97ab478625048fdcd330ef516df9c428d3
Reviewed-on: https://go-review.googlesource.com/c/162777
Run-TryBot: Michael Matloob <matloob@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-02-14 19:27:12 +00:00
Michael Matloob
4ea155ddbd go/buildutil: get tests to pass when run from a module
These tests tried to access the user's GOPATH, which can't work if you're
running from a module! So use packagestest to set up a fake GOPATH.

Also remove a TODO that's never going to be done because we won't
be making more investments in go/build.

Change-Id: I379c74345ace91e6c4282a42ff62106bf325d0e0
Reviewed-on: https://go-review.googlesource.com/c/162757
Run-TryBot: Michael Matloob <matloob@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-02-14 18:55:18 +00:00
Daniel Martí
c161412db0 go/analysis/singlechecker: use Stderr in flag.Usage
It was using a mix of stdout and stderr. Most users won't notice, but
it's inconsistent for no apparent reason. In particular, I noticed as
some of my tool execution tests started failing.

Change-Id: I9afe5f5bed0a575d3ba20e8dc1cc593c35565cf9
Reviewed-on: https://go-review.googlesource.com/c/162717
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
2019-02-14 16:35:53 +00:00
Ian Cottrell
508f945e1a internal/lsp: change File.Read to a File.GetContent accessor
Like the previous change to the FIle interface, we treat Read as if it were an
accessor, we remember the content part but not the error part, and we may fill
it in asynchronously, so this change makes it explicit.
In the future we should probably trap the error in the read and push it back
through another channel though, it will be the root cause of later errors.

Change-Id: I3d374dd557178b4e8c5544813cd77f5c0faefe5b
Reviewed-on: https://go-review.googlesource.com/c/162403
Run-TryBot: Ian Cottrell <iancottrell@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-02-14 04:36:41 +00:00
Michael Matloob
88f95592de go/analysis/unitchecker: rewrite test in terms of packagestest
This means the test excercise modules and gopath workspaces. That will
allow this test to run once tools becomes a module...

The test still doesn't pass under Windows.

Change-Id: Ic5e46b9b92c5aac909a6ceb56f30851832fc09ac
Reviewed-on: https://go-review.googlesource.com/c/162404
Run-TryBot: Michael Matloob <matloob@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2019-02-13 22:38:15 +00:00
Rebecca Stambler
f3aee3358b internal/lsp: allow ExecuteCommandParams to be nil
The ExecuteCommandParams field is optional, so it can be set to nil.

Change-Id: If440257e6b64ce5189b0a4b39a6ed7fc867da5af
Reviewed-on: https://go-review.googlesource.com/c/162402
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2019-02-13 22:34:05 +00:00
Ian Cottrell
69a2705782 internal/lsp: remove error return values from interface "field" accessors
we don't really use them, only generate them in cases where the failure is way more fundamental, and then also fail
to remember them for the next call to the same accessor. Better to not have them.

Change-Id: I0e8abeda688f5cc2a932ed95a80d89225c399f93
Reviewed-on: https://go-review.googlesource.com/c/162399
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-02-13 21:58:50 +00:00
Rebecca Stambler
740235f6c0 internal/lsp: add back check that a package was found for a given file
Added this check in golang.org/cl/161077 and unintentionally removed it in
golang.org/cl/161497.

Change-Id: I66bd2b616f4b41c25f134f6e9457c97bbcd3f72b
Reviewed-on: https://go-review.googlesource.com/c/162398
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-02-13 19:20:42 +00:00
Ian Cottrell
dbb4d4be53 lsp/internal: fix incorrectly formatted file
Change-Id: Ibef9c7d5ce0abfa26ba98744c26b54d843227c23
Reviewed-on: https://go-review.googlesource.com/c/162077
Run-TryBot: Ian Cottrell <iancottrell@google.com>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-02-13 16:29:12 +00:00
Marcel van Lohuizen
6bedcd1097 go/analysis/passes/printf: add support for %w
Change-Id: I91bd2a1f3f65f95258fa5a5b91aca51ff0885bad
Reviewed-on: https://go-review.googlesource.com/c/162058
Run-TryBot: Marcel van Lohuizen <mpvl@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
2019-02-13 13:59:02 +00:00
Rebecca Stambler
0e66cc6fab internal/lsp/diff: fix bug that adds extra line to files on format
Small changes to handle the last line in the diff library, LSP tests,
and diff to text edits conversion.

Fixes golang/go#30137

Change-Id: Iff0e53a04c2dabf6f54eb7c738b4c0837f16efba
Reviewed-on: https://go-review.googlesource.com/c/162217
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2019-02-13 04:28:36 +00:00
Rebecca Stambler
a21eef959b internal/lsp: use parallel parse files function
This change adds a copy of the parseFiles function from go/packages for
file parsing. Also fix crash caused by lack of TypeSizes from
go/packages.Load when using LoadImports mode.

Change-Id: Ie8c3c653679ab81da45905c6839de7e63966d84c
Reviewed-on: https://go-review.googlesource.com/c/161670
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2019-02-13 04:21:09 +00:00
Rebecca Stambler
f7e1b50d22 internal/lsp/cmd: set Serve.app when running with remote
Change-Id: Idf299a0b28b77a3372db20ccb0f80512422e601a
Reviewed-on: https://go-review.googlesource.com/c/162138
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2019-02-13 01:59:56 +00:00
Dmitri Shuralyov
49fb246514 refactor/rename: re-enable TestMoves on Windows
This CL is based on the work and discussion in CL 24969 and CL 32392.
It simplifies the code further and makes trybots pass on Windows.

Also update the documentation and implementation of the subpackages
function slightly to make it more clear what it's doing.

Background

CL 24943 has made progress on fixing rename.Move behavior on Windows,
but hadn't re-enabled TestMoves at the time. CL 24969 attempted to do
so, but the tests weren't passing and it didn't get merged at the time.

Since that time, CL 65672 has fixed a bug in the subpackages function.
As a result, it's possible to simplify code in Move now.

The subpackages function returns a set of packages in the given srcDir
whose import path equals to root or has "root/" as the prefix.
After CL 65672, it correctly filters out ones that are not true
sub-packages of root. That's why it's not necessary to try to append
a trailing separator when doing the string replacement in Move now.

Given subpackages reports their import paths (always '/'-separated),
not filesystem paths, it's not necessary to use filepath.ToSlash either.

Updates golang/go#16384

Change-Id: Ia808fbaaeffe44ea1e51d7cc3ed9499bc2b438cf
Reviewed-on: https://go-review.googlesource.com/c/161777
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
2019-02-12 21:30:38 +00:00
Michael Matloob
340a1cdb50 internal/lsp: copy fact support from go/analysis/internal/checker.go
This changes the analysis code from that which was in unitchecker.go
to that in checker.go, so we can run actions that get facts for dependencies
concurrently.

Adds the rest of the traditional vet suite to the LSP.

TODO(matloob): test that facts are actually propagated between packages

Change-Id: I946082159777943af81bcf10e503fecc99da521e
Reviewed-on: https://go-review.googlesource.com/c/161671
Run-TryBot: Michael Matloob <matloob@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-02-12 19:58:15 +00:00
Michael Matloob
05d253c83e go/analysis/analysistest: change error message checked in expectation
text/scanner now uses the word "invalid" instead of "illegal".
See golang.org/cl/161199

Change-Id: I7db0ea2628760cba5c993bdec6e15e76b20b0e06
Reviewed-on: https://go-review.googlesource.com/c/162137
Run-TryBot: Michael Matloob <matloob@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-02-12 19:41:11 +00:00
Ian Cottrell
44bee7e801 internal/lsp: changing server noun to serve verb
Also adding in --remote support and using it to implement the equivalent
functionality of the external forward command
Also adding in --listen as a replacement for --port as it is more flexible,
specifically it allows localhost:port which
is helpful in environments where opening remotely accesible ports is
problematic.

Change-Id: I5de1cea7dd6f1ee46e7423f3be2a4caca6f040b2
Reviewed-on: https://go-review.googlesource.com/c/161658
Run-TryBot: Ian Cottrell <iancottrell@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-02-11 22:49:14 +00:00
Michael Matloob
657755b003 internal/lsp: fix crash caused by lack of TypeSizes from go/packages.Load
Get dummy sizes values until we can get go/packages to forward the correct
values.

Change-Id: Ie31333e9ed7c57d02e1447097567fa894ea9de7d
Reviewed-on: https://go-review.googlesource.com/c/161937
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-02-11 18:30:33 +00:00
Rebecca Stambler
3744606dbb internal/lsp: type-check packages from source
This change moves gopls from type-checking packages using the
go/packages API to type-checking from source. This is the first step in
adding caching to gopls.

Change-Id: I2a7dcfd8c9c0bfc6c35c86eadcdc6f9ce53d9be7
Reviewed-on: https://go-review.googlesource.com/c/161497
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2019-02-08 22:27:37 +00:00
Michael Matloob
a3f91d6be4 internal/lsp: add support for analyzers with dependencies on other analyzers
Steal alan's parallel analysis-graph-running code from multichecker.
Facts are still not supported.

Change-Id: I22f83375d7a314b49d4f458d6dd40c33febc795b
Reviewed-on: https://go-review.googlesource.com/c/161659
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-02-08 18:55:13 +00:00
Rebecca Stambler
44bcb96178 go/packages: fix broken tests to handle changes to packagestest
golang.org/cl/161317 set Tests to true in the packagestest go/packages
Config. Handle this in the go/packages tests.

Fixes golang/go#30115

Change-Id: I6b4c0ca3dc2d73855239f3e7122e29da6ce81657
Reviewed-on: https://go-review.googlesource.com/c/161457
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
2019-02-06 22:14:03 +00:00
Michael Matloob
a8576e2603 internal/lsp: connect basic analysis functionality
This starts hooking up the analysis framework into the LSP. It runs
the Tests analysis (which I think might be the only one that doesn't
need facts or results) and reports its diagnostics if there are
no parse or typecheck failures.

Next step: figure out how to pass through results.

Change-Id: I21702d1cf5d54da399df54437f556b9351caa864
Reviewed-on: https://go-review.googlesource.com/c/161358
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-02-06 21:48:25 +00:00
Yasuhiro Matsumoto
4892ae6946 go/packages: use strings.EqualFold in sameFile to handle case-insensitive file systems
Name of file or URI must be checked ignorecase on Windows.

Change-Id: I61507b0aa95389c5e1f421f0702ba6ad17b79177
Reviewed-on: https://go-review.googlesource.com/c/160597
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-02-06 17:56:59 +00:00
Rebecca Stambler
40960b6deb internal/lsp/cmd: fix a nil pointer and some minor clean-up
This change fixes a nil error, in addition to cleaning up a spacing
error and a typo. It also fixes the golint errors in internal/lsp/cmd.

Updates golang/go#30091

Change-Id: I24867bb878fda4e341f87d31bbec701a3814a341
Reviewed-on: https://go-review.googlesource.com/c/161220
Reviewed-by: Ian Cottrell <iancottrell@google.com>
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-02-06 04:15:39 +00:00
Rebecca Stambler
279ab8e001 internal/lsp, go/packages/packagestest: support testing test files
This change allows testdata files to be *_test.go files.

Change-Id: Ic771ea7c89ff2d2aabd1af8be56f9c7286da9053
Reviewed-on: https://go-review.googlesource.com/c/161317
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2019-02-06 04:07:32 +00:00
Rebecca Stambler
379209517f internal/lsp: add additional logging for go/packages failures
Change-Id: I8c6dae4309df1746cd8b74d280f1f360f42cc77b
Reviewed-on: https://go-review.googlesource.com/c/161218
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2019-02-05 20:13:29 +00:00
Rebecca Stambler
90c8b4f75b internal/lsp: handle escaping URIs for files in the module cache
This change makes sure to handle escaped characters, for instance, files
in the module cache contain "@" in the path. Also, return errors when a
package is not found for a file.

Updates golang/go#30027

Change-Id: I6c4f6d0f30dde55701308b89785f02b671e81cc6
Reviewed-on: https://go-review.googlesource.com/c/161077
Reviewed-by: Ian Cottrell <iancottrell@google.com>
Reviewed-by: Yasuhiro MATSUMOTO <mattn.jp@gmail.com>
2019-02-05 18:18:01 +00:00
Rebecca Stambler
069601f371 internal/lsp: use interface for diagnostics code
Since the diagnostics code can be either a string or a number, use an
empty interface.

Change-Id: Ie1a4183b5c82ef177176075828511070ae3520bd
Reviewed-on: https://go-review.googlesource.com/c/161217
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-02-05 18:07:22 +00:00
Agniva De Sarker
7f7074d5bc godoc: remove leading tabs while formatting text
Fixes golang/go#29568

Change-Id: Ia9e91bb4cf7a5916696268141ef5ec29e4372130
Reviewed-on: https://go-review.googlesource.com/c/160917
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-02-05 05:01:22 +00:00
Jonathan Amsterdam
b2f7fe607d cmd/stringer: type check using export data
Use go/packages to find and type check packages using export data.

In addition to type checking with export data, this should also enable
cmd/stringer to work correctly when using go modules.

jba: took over CL, tweaked package.Config use.

Change-Id: Ie253378b52fbd909f7194dfd09c039aab63dd8f0
Reviewed-on: https://go-review.googlesource.com/c/126535
Reviewed-by: Michael Matloob <matloob@golang.org>
Run-TryBot: Michael Matloob <matloob@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-02-04 22:01:59 +00:00
Rebecca Stambler
d810ce9e47 cmd/guru: remove Go 1.9 handling, since we no longer support 1.8
Some tests were split off for Go 1.9, when we still supported Go 1.8.
This change recombines them and removes the special handling for 1.9.

Fixes golang/go#24421

Change-Id: Ic871f4c3af4bb90b00cdd6d7b8f3253783554535
Reviewed-on: https://go-review.googlesource.com/c/161000
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
2019-02-04 19:56:32 +00:00
Rebecca Stambler
021ffbf1e9 internal/lsp: do not return nil identifiers without errors
Change-Id: I9ffc37dc07f46536a44f7173277d0374fdda1fb8
Reviewed-on: https://go-review.googlesource.com/c/160698
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2019-02-04 17:30:59 +00:00
Rebecca Stambler
8a24307720 internal/lsp/diff: fix sources listed for diff implementation
Change-Id: I36b2903f4938c4e7a3f15567e11ab31f3f7d78f7
Reviewed-on: https://go-review.googlesource.com/c/160840
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2019-02-04 17:30:30 +00:00
Andzej Maciusovic
7414d4c1f7 internal/lsp: rank types higher when completing in return of a function
Completion now ranks type names higher for func receiver, type params and type results (e.g. func (<>) foo(<>) (<>) {}).

Fixes golang/go#29152

Change-Id: Icdd18b1b344c1cd617a4f45a7b071e53c1345478
GitHub-Last-Rev: e6acb1f2d2a7e571ffcecc500e407fdefd118fed
GitHub-Pull-Request: golang/tools#73
Reviewed-on: https://go-review.googlesource.com/c/159797
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-02-02 23:51:57 +00:00
Brad Fitzpatrick
718ddee956 Revert "go/analysis/passes/atomicalign: handle pointers to struct"
This reverts CL 158999, commit 8dbcc66f33.

Reason for revert: broke the build, nobody ever ran trybots

Change-Id: I2180ed8f9281b413b2ffea086abbd09fbfc3c99e
Reviewed-on: https://go-review.googlesource.com/c/160839
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
2019-02-02 20:26:10 +00:00