Commit Graph

6210 Commits

Author SHA1 Message Date
Bryan C. Mills 3fca6a08d7 cmd/gorename: log 'go build' output on failure
For golang/go#50043

Change-Id: I90d1e85c59d6f9c9ad30edf0180cb876c2564534
Reviewed-on: https://go-review.googlesource.com/c/tools/+/370254
Trust: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2021-12-08 16:15:56 +00:00
Akhil cadd57e399 docs: updated nvim-lspconfig link
This PR updates the link of nvim-lspconfig doc for gopls.

Change-Id: I9f64ca9c310af8a6c6392245c88eea666edf4657
GitHub-Last-Rev: 9774e504c77d7b0d00f932dd5af85563498a21b2
GitHub-Pull-Request: golang/tools#351
Reviewed-on: https://go-review.googlesource.com/c/tools/+/367254
Reviewed-by: Robert Findley <rfindley@google.com>
Trust: Robert Findley <rfindley@google.com>
Trust: Hyang-Ah Hana Kim <hyangah@gmail.com>
Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2021-12-08 15:21:23 +00:00
Russ Cox fd2bfb79a1 go/analysis/passes/stdmethods: recognize any as alias for interface{}, for errors.As check
Now that any is an alias for interface{}, we need to recognize both

	func (T) As(any) bool
	func (T) As(interface{}) bool

as satisfying errors.As.

For golang/go#33232.

Change-Id: Ie5a992c37da8020e80367528bc23370227a70f75
Reviewed-on: https://go-review.googlesource.com/c/tools/+/369954
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
gopls-CI: kokoro <noreply+kokoro@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
2021-12-07 22:06:08 +00:00
pjw 68cbf4169f internal/lsp/template: add missed hover cases
Templates were reporting 'oops' when hovering over a string.

Fixes: golang/go#50031

Change-Id: I9e256b1f7d193bf090590c1ec71e85fc8493d7f7
Reviewed-on: https://go-review.googlesource.com/c/tools/+/369956
Run-TryBot: Peter Weinberger <pjw@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Trust: Peter Weinberger <pjw@google.com>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2021-12-07 22:04:29 +00:00
Russ Cox d3358c1fb7 go/internal/gcimporter: fix test for Go 1.18 any
In Go 1.18 context uses any, not interface{}.
Fix the test in a way that should work for both older and newer versions.

For golang/go#49884.

Change-Id: Ib8690876c6a9364b98f9c7ba739b953a8d7565d4
Reviewed-on: https://go-review.googlesource.com/c/tools/+/369955
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2021-12-07 20:13:17 +00:00
Shoshin Nikita feb39d0cd7 internal/lsp/source: don't format generated files
Fixes golang/go#49555

Change-Id: I53e3c0d34be6a545386d6766371fbeda8a2b2ffb
GitHub-Last-Rev: 516168765671c8135523fcf801f50455b352bdab
GitHub-Pull-Request: golang/tools#349
Reviewed-on: https://go-review.googlesource.com/c/tools/+/365295
Reviewed-by: Robert Findley <rfindley@google.com>
Trust: Robert Findley <rfindley@google.com>
Trust: Hyang-Ah Hana Kim <hyangah@gmail.com>
Run-TryBot: Robert Findley <rfindley@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2021-12-06 16:11:25 +00:00
Robert Findley c882a49eac gopls/doc: fix rendering of example for the infertypeargs analyzer
Fixes golang/go#49774

Change-Id: I10d2ebd9d831325e0ede73cf11ff30b2adfb744d
Reviewed-on: https://go-review.googlesource.com/c/tools/+/367844
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>
2021-12-03 18:55:11 +00:00
Robert Findley f64c0f46fa internal/lsp/analysis/fillreturns: update fillreturns for new type errs
The error messages produced by go/types related to an incorrect number
of return values have changed, and have been repositioned. Update the
fillreturns analyzer to handle the Go 1.18 form of these errors.

Ideally we'd use error codes here, but can't because they are not
forwarded by go/packages. Added a TODO to revisit when error codes are
exposed.

Change-Id: I4c594fd2fd1cb7423f37ff9c6a57e9490dcbc2a4
Reviewed-on: https://go-review.googlesource.com/c/tools/+/367714
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: Suzy Mueller <suzmue@golang.org>
2021-12-03 18:55:02 +00:00
Bryan C. Mills e212aff8fd internal/memoize: do not allow (*Generation).Acquire to fail
The Acquire method is nearly instantaneous; it only potentially blocks
on a small, constant sequence of cache misses, so there is no need to
avoid blocking in it when a Context is cancelled.

An early return when the passed-in Context is canceled was added in CL
242838 to avoid incrementing the Generation's WaitGroup after its
destruction has begun; however, that early return also bypasses the
WaitGroup accounting that blocks Destroy while the generation is still
in use. Instead, we need the invariant that Acquire is not called in
the first place after Destroy, which we can ensure by nilling out
the View's snapshot when we begin destroying it.

I was not able to reproduce golang/go#48774 locally, but I believe
that this CL will fix it. (It may, however, expose other races or
deadlocks that may have been masked by the early return, which we can
then fix separately.)

Fixes golang/go#48774

Change-Id: Iac36fceb06485f849da5ba0250b44b55f937c44b
Reviewed-on: https://go-review.googlesource.com/c/tools/+/367675
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
2021-12-02 03:25:35 +00:00
Robert Findley 2ac48c609c go/types/typeutil: add support for mapping generic types
Add support to the typeutil package for hashing the new types produced
when type-checking generic code.

Change-Id: I05a213baee80c53c673442f3c28fddb26ad0b03f
Reviewed-on: https://go-review.googlesource.com/c/tools/+/366614
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Tim King <taking@google.com>
2021-12-02 03:14:37 +00:00
Robert Findley df48029e9b go/internal/gcimporter: allow reusing empty interfaces on the RHS of
type decls

This is a port of CL 367851 to x/tools. The test set-up is slightly
different; I added a TODO to converge.

Updates golang/go#49888

Change-Id: I31a63c1fc8f9a78526d8eea05fd01dae35770b5f
Reviewed-on: https://go-review.googlesource.com/c/tools/+/368354
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2021-12-01 22:01:30 +00:00
Peter Weinberger d99d6faea5 internal/lsp/protocol: fix whitespace in comments
There's one case when doing something about newlines in comments is
necessary, but the existing code removed newlines from comments in
several other places. The new code fixes that and a few other
leftovers.

Change-Id: Ia7905f07584ea1774f4fde786bdd5ee732acc818
Reviewed-on: https://go-review.googlesource.com/c/tools/+/368214
Run-TryBot: Peter Weinberger <pjw@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
Trust: Peter Weinberger <pjw@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
2021-12-01 19:09:57 +00:00
Bryan C. Mills 3c63f30840 gopls/internal/regtest/misc: temporarily skip TestGenerateProgress
For golang/go#49901

Change-Id: Id41c6437fadf1c539488662fc0ca5bc746b8a498
Reviewed-on: https://go-review.googlesource.com/c/tools/+/368216
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
2021-12-01 18:47:44 +00:00
pjw 615f9a6b81 internal/lsp/protocol: bring the LSP stubs up to date
There are no changes, other than generated code, to gopls. The vscode
typescript implementation includes 3 new and undocumented RPCs:
InlineValues, InlineValuesRefresh, and ResolveWorkspaceSymbol.

There are some places that need work, marked by //PJW: comments in
code.ts.

Change-Id: I20e4c6792ae37323bb9c887ffefbe81930ef62fe
Reviewed-on: https://go-review.googlesource.com/c/tools/+/367845
Trust: Peter Weinberger <pjw@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
2021-12-01 15:05:46 +00:00
Bryan C. Mills 1fd30d290b refactor/importgraph: set env from packagestest.Export and check errors from Build
This test was written for GOPATH mode, and subsequently updated to use
packagestest at a time when GO111MODULE defaulted to "auto" (in this
case, off). As a result, the test was failing to set environment
variables relevant to the test, such as GO111MODULE=off.

The missing environment was causing errors that were subsequently
masked by a missing error check: the errors returned by
importgraph.Build were only read in an "if false" block.

This CL adds the missing environment variables and error checks. Using
the correct environment may or may not fix the observed test failures.

For golang/go#37823

Change-Id: I75844e6fdf47222aa4f953c8c4fbcc93cec606c9
Reviewed-on: https://go-review.googlesource.com/c/tools/+/367846
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
2021-11-30 22:42:17 +00:00
Bryan C. Mills 2c9b078fb4 internal/memoize: record the caller of Destroy
The hypothesis for golang/go#48774 is that the generation is being destroyed by
a call to (*View).shutdown. This change adds a bit of logging to
confirm that hypothesis.

For golang/go#48774

Change-Id: I34be2e16a0dcab4cea7e9b704b56f4cf0abb0c71
Reviewed-on: https://go-review.googlesource.com/c/tools/+/367674
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2021-11-30 16:43:31 +00:00
Robert Griesemer 6e52f51f5b x/tools: temporarily skip a couple of tests
Skip tests so we can get CL 367196 submitted. After that
reenable tests (and adjust as needed).

Change-Id: Id0a6d6b873a0760ae438f6f0cb147c20d00b1ca6
Reviewed-on: https://go-review.googlesource.com/c/tools/+/367574
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
gopls-CI: kokoro <noreply+kokoro@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
2021-11-29 20:12:13 +00:00
pjw a618923903 internal/lsp/template: fix error that causes crashes
When LSP asks for a completion it sends a position, which is the
position of the first character after the cursor. The old code
mistakenly thought it was the position of the last character seen,
and sometimes produced an impossible slice to parse.

The example at line 29 of completion_test.go used to cause a panic.

Fixes: golang/go#49600

Change-Id: I772fe38a1a12d3876ef866819e6a878b297bb92f
Reviewed-on: https://go-review.googlesource.com/c/tools/+/366036
Run-TryBot: Peter Weinberger <pjw@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Peter Weinberger <pjw@google.com>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2021-11-29 15:05:11 +00:00
Dmitri Shuralyov cb80a01bd3 cmd/godoc: remove extra // characters from deprecation notice
The comment is already inside a /* */ block, so no need for //.

Updates golang/go#49212.

Change-Id: I6d50cedab363ed312d85e66797cbc4f652e56dab
Reviewed-on: https://go-review.googlesource.com/c/tools/+/367014
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Dmitri Shuralyov <dmitshur@golang.org>
2021-11-24 23:04:05 +00:00
Zvonimir Pavlinovic 7cf1f382d2 go/ssa: remove deprecated FindTests and CreateTestMainPackage
For golang/go#48547

Change-Id: I1337b99c90ce81b58dfaa93e49c6dcb884330b22
Reviewed-on: https://go-review.googlesource.com/c/tools/+/363659
Run-TryBot: Zvonimir Pavlinovic <zpavlinovic@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Trust: Zvonimir Pavlinovic <zpavlinovic@google.com>
2021-11-23 18:15:15 +00:00
Peter Weinberger 1e71a25a93 gopls: template suffix flags and documentation
Adds 'templateExtensions' (with default ["tmpl", "gotmpl"]) to control
which files gopls considers template files.

Adds template support documentation to features.md.

Fixes golang/go#36911

Change-Id: If0920912bf3748d1c231b3b29e7a008da186bede
Reviewed-on: https://go-review.googlesource.com/c/tools/+/363360
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>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2021-11-23 16:39:20 +00:00
Hana c2c92fd21d go/callgraph/vta/internal/trie: fix build with go1.12
- Convert shift count to unsigned to make go1.12 happy.

https://github.com/golang/proposal/blob/master/design/19113-signed-shift-counts.md

- Require go1.13+ for tests that use the new language features introduced
in go1.13.

https://golang.org/doc/go1.13#language

Change-Id: I30dc5ee44ccf1a76ce30f352751316efdebc5929
Reviewed-on: https://go-review.googlesource.com/c/tools/+/365634
Trust: Hyang-Ah Hana Kim <hyangah@gmail.com>
Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Tim King <taking@google.com>
2021-11-22 21:22:40 +00:00
Robert Findley d0c72119bb internal/lsp/cache: fix resolution of the go directive in multi-module
workspaces

Go versions are not valid semver, so we were always resolving Go 1.12 in
the workspace module. This matters with lazy module loading.

Fixes golang/go#49668
Updates golang/go#49105
Fixes golang/go#48364

Change-Id: Iae4f5f6e17df4be1f4d6ee9d3f439efa3cf658d3
Reviewed-on: https://go-review.googlesource.com/c/tools/+/365737
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
2021-11-19 19:11:45 +00:00
Robert Findley 43b469a3a9 go/analysis/passes/printf: update logic now that type parameters are
interfaces

Now that the underlying of type parameters is their constraint
interface, a couple places in the printf analyzer need to be updated:
 - We need to explicitly exclude type parameters when looking at
   interfaces in isFormatter.
 - We need to consider at the element type, not its underlying, when
   looking at pointers to type parameters

Change-Id: I8c6843e001a98d45ff0f30df305e3536335f567e
Reviewed-on: https://go-review.googlesource.com/c/tools/+/364678
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2021-11-17 19:16:04 +00:00
Bryan C. Mills 771dabf433 gopls/internal/regtest/misc: skip TestInconsistentVendoring on Windows
This test is probably detecting a real bug that exclusively affects
Windows. To avoid masking other bugs, let's skip the test on that
platform until the bug is fixed.

For golang/go#49646

Change-Id: I38c615d47454ecfd72b416fff2018973b3ae9259
Reviewed-on: https://go-review.googlesource.com/c/tools/+/364676
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2021-11-17 17:12:49 +00:00
Robert Findley 7d6c71f28a internal/lsp/source/completion: avoid invalid AST in enclosingSignature
Guard against the panic in golang/go#49397, though it should not be
possible with well-formed AST.

Updates golang/go#49397

Change-Id: I3428504a4cfd361c1f51316d8c9aeee4aa9d7f42
Reviewed-on: https://go-review.googlesource.com/c/tools/+/364675
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
2021-11-17 17:03:06 +00:00
Zvonimir Pavlinovic 8122e49f73 go/pointer: remove use of deprecated ssa.CreateTestMainPackage
For golang/go#48547

Change-Id: Ief1c4fb6302437a8736d52e87541f8229b02289a
Reviewed-on: https://go-review.googlesource.com/c/tools/+/363657
Run-TryBot: Zvonimir Pavlinovic <zpavlinovic@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Trust: Zvonimir Pavlinovic <zpavlinovic@google.com>
2021-11-16 19:18:26 +00:00
Robert Findley 1a3081d393 all: prepare for formatting any as 'any' in type strings
Make a couple of small changes to support keeping track of the
predeclared any by pointer identity, and formatting it as 'any'. This
should allow x/tools trybots to pass on CL 363974.

Updates golang/go#49583

Change-Id: I79cffee6adbf000a7251dbea4091fdd7b8fdcf0a
Reviewed-on: https://go-review.googlesource.com/c/tools/+/364194
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2021-11-16 14:26:19 +00:00
Robert Findley 4adea5033c internal/typeparams: normalize the underlying constraint interface
A call to Underlying() was missing from the computation of a type
parameter's structural terms, resulting in incorrect results for type
parameters with defined constraints. This wasn't caught because all
analyzer tests use inlined interfaces out of convenience, and the
fallback behavior for vet analyzers using this API is to fail silently.

Fix this, and add tests that would have failed. Also update the
normalization tests to use the StructuralTerms API, and delete the
earlier NormalizeInterface API. StructuralTerms has proven to be more
useful.

For clarity, change the StructuralTerms function to accept a *TypeParam
rather than arbitrary Type, and significantly revamp its docstring.

Updates golang/go#49597

Change-Id: I8b863604655b44b943e6afbd5d22a66f44260d10
Reviewed-on: https://go-review.googlesource.com/c/tools/+/363982
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Tim King <taking@google.com>
2021-11-16 01:10:28 +00:00
Robert Findley 43923818a8 go/analysis/passes/unsafeptr: add tests using generics
Unlike with some other analyzers, it did not seem worthwhile to consider
a type parameter's type set when looking for incorrect conversions to
unsafe.Pointer. There's probably no reason to have a type parameter with
uintptr structural type.

Add some sanity-check tests for the behavior of this analyzer with
respect to generic code.

Updates golang/go#48704

Change-Id: Ibc3180c6eba9c2c88ea2220b1c84cd27971a6700
Reviewed-on: https://go-review.googlesource.com/c/tools/+/360174
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2021-11-15 21:31:47 +00:00
Zvonimir Pavlinovic 49ce184b43 cmd/guru: remove use of deprecated ssa.CreateTestMainPackage
For golang/go#48547

Change-Id: I71f061e55d52c45346d34d05ade9c82e9856d6e7
Reviewed-on: https://go-review.googlesource.com/c/tools/+/363655
Run-TryBot: Zvonimir Pavlinovic <zpavlinovic@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
Trust: Zvonimir Pavlinovic <zpavlinovic@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
2021-11-12 22:28:40 +00:00
Bryan C. Mills fda06c1e04 gopls/internal/regtest/diagnostics: skip Test_Issue38211
This test has a high failure rate on the builders. Adding a skip until
it is fixed so that we will more easily notice other regressions.

For golang/go#44098

Change-Id: I8dcd6b205a5a7876d2a16c54f3c19c1bb0397843
Reviewed-on: https://go-review.googlesource.com/c/tools/+/363614
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
2021-11-12 15:49:44 +00:00
Hana c116b727ec internal/lsp/lsprpc: increase timeout for TestEnvForwarding
Some slow builders need more time to get ready.

Updates golang/go#49503

Change-Id: I9225ef43b1fdeb5195467331c7b779fb11dd0e7e
Reviewed-on: https://go-review.googlesource.com/c/tools/+/362976
Trust: Hyang-Ah Hana Kim <hyangah@gmail.com>
Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
2021-11-11 03:25:14 +00:00
pjw fc3ed20887 internal/lsp: enable template processing and add templateFiles option
Move template processing out of experimental and enable it. Users
can set the option 'templateSupport' to false to disable it.
Also, add a new flag 'templateExtensions', defaulting to ['tmpl','gotmpl']
to let the user provide a list of extensions of files
to be considered as template files.

Change-Id: I724387738c1632256999cda304d6cf9fa48ed91d
Reviewed-on: https://go-review.googlesource.com/c/tools/+/362241
Run-TryBot: Peter Weinberger <pjw@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Peter Weinberger <pjw@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
2021-11-10 16:35:53 +00:00
Zvonimir Pavlinovic e900012391 go/callgraph/vta: represent type sets using tries
Change-Id: Iabd1f01d2941a34f66e8ad9940b091a48f1f3a41
Reviewed-on: https://go-review.googlesource.com/c/tools/+/361400
Trust: Zvonimir Pavlinovic <zpavlinovic@google.com>
Run-TryBot: Zvonimir Pavlinovic <zpavlinovic@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Tim King <taking@google.com>
Reviewed-by: Guodong Li <guodongli@google.com>
2021-11-09 16:49:01 +00:00
Suzy Mueller 5e46725290 internal/lsp: return all code action kinds with context.only prefix
When context.Only is passed in the codeAction request, all code actions
that have a matching prefix should be returned. For example:

context.Only: "refactor"
want: "refactor.extract", "refactor.rewrite"

Fixes golang/go#49263

Change-Id: I4bcea4a0b0097f3187f3d7055cbb73b518008107
Reviewed-on: https://go-review.googlesource.com/c/tools/+/361834
Trust: Suzy Mueller <suzmue@golang.org>
Run-TryBot: Suzy Mueller <suzmue@golang.org>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2021-11-09 16:15:23 +00:00
Than McIntosh fafc446eff go/internal/gccgoimporter: skip obj importer test on AIX
Skip the obj importer test when running on AIX. For this test to
work properly on AIX, we need to port CL 152720 (or something like
it) here from the main repo.

Updtes golang/go/#49445.
Updates golang/go#29113.

Change-Id: If75a452950a5dcad4afa18d973f3c94b6065f724
Reviewed-on: https://go-review.googlesource.com/c/tools/+/362434
Trust: Than McIntosh <thanm@google.com>
Run-TryBot: Than McIntosh <thanm@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
2021-11-09 01:45:54 +00:00
Than McIntosh a5321bfa33 go/internal/gccgoimporter: skip installation test on AIX
Skip the installation test when running on AIX. For this test to
work properly on AIX, we need to port CL 152720 (or something like
it) here from the main repo.

Fixes golang/go/#49445.
Updates golang/go#29113.

Change-Id: Idf1f9d717aa835b80cffa4e3ab34ae578a809860
Reviewed-on: https://go-review.googlesource.com/c/tools/+/362248
gopls-CI: kokoro <noreply+kokoro@google.com>
Trust: Than McIntosh <thanm@google.com>
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2021-11-08 21:20:25 +00:00
Than McIntosh 0edd7b89b2 go/internal/gccgoimporter: fix up gccgo installation test
Change the TestInstallationImporter testpoint to query type
information for sort.Search instead of sort.Ints. The latter function
changed recently (1.16 timeframe), parameter "a" is now "x". A better
candidate for this sort of query is sort.Search, which has been stable
or a while.

This is a copy of CL 294290 from the main repo.

Updates golang/go#44425.

Change-Id: Ibc79602cafc46c20be4b085f9a92977b06f9d658
Reviewed-on: https://go-review.googlesource.com/c/tools/+/362247
Trust: Than McIntosh <thanm@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2021-11-08 21:20:16 +00:00
Than McIntosh e93be81b8f go/internal/gccgoimporter: use t.TempDir() in tests
Use t.TempDir() instead of os.MkdirTemp().

This is a copy of CL 309356 from the main repo.

Updates golang/go#45402.

Change-Id: Ia555a701e4de568871a765ee551e65a5c998cde9
Reviewed-on: https://go-review.googlesource.com/c/tools/+/362246
Trust: Than McIntosh <thanm@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2021-11-08 21:19:57 +00:00
Than McIntosh 17472e004f go/internal/gccgoimporter: change all .gox files to text
Avoid problems with distro scanning by not using files that look like
object files.

This is a copy of CL 352450 from the main repo.

Updates golang/go#48548.

Change-Id: I519d0aa73fa46470d1a41ce29a1da046a9f57f3b
Reviewed-on: https://go-review.googlesource.com/c/tools/+/362245
Trust: Than McIntosh <thanm@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-11-08 21:19:47 +00:00
pjw c8e8de6f40 go/ssa: correct names of examples
In a couple of places the documentation had the wrong names for
examples.

Change-Id: If321643d2bc22e2d1bd27203f0e8dbf3ef66beba
Reviewed-on: https://go-review.googlesource.com/c/tools/+/362154
Trust: Peter Weinberger <pjw@google.com>
Trust: Zvonimir Pavlinovic <zpavlinovic@google.com>
Reviewed-by: Zvonimir Pavlinovic <zpavlinovic@google.com>
2021-11-08 20:46:37 +00:00
Bryan C. Mills b766c284d5 internal/jsonrpc2: make Serve wait for all connections to close
Also eliminate a goroutine leak in case of connection timeout.

Change-Id: I82c1a8352658353ef5d0ba4e7ce9e617ce7b42a3
Reviewed-on: https://go-review.googlesource.com/c/tools/+/236750
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2021-11-08 20:32:21 +00:00
Zvonimir Pavlinovic 2cdcc60405 cmd: avoid printing redundant newlines
For golang/go#49350

Change-Id: Ic566112ff8a8707998b461d2b99fca852f2972f8
Reviewed-on: https://go-review.googlesource.com/c/tools/+/361716
Run-TryBot: Zvonimir Pavlinovic <zpavlinovic@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Zvonimir Pavlinovic <zpavlinovic@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2021-11-08 18:39:25 +00:00
Robert Findley 0c60b7c5c2 go/analysis/passes/printf: add test for generic printf wrappers
Add test cases to verify that generic functions and methods are detected
as printf wrappers.

Change-Id: I110a415673976d01b5baae6e2a82d296c2f7d2bf
Reviewed-on: https://go-review.googlesource.com/c/tools/+/360155
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Tim King <taking@google.com>
2021-11-06 00:08:44 +00:00
Robert Findley ddcef59bac go/analysis/passes/printf: warn about verbs that don’t match a type
parameter’s type set

Pending the acceptance of golang/go#49038, this CL updates the printf
analyzer to warn if any elements of a type parameter's type set do not
match the printf verb being considered. Since this may be a source of
confusion, it also refactors slightly to allow providing a reason why a
match failed.

Updates golang/go#48704
Updates golang/go#49038

Change-Id: I92d4d58dd0e9218ae9d522bf2a2999f4c6f9fd84
Reviewed-on: https://go-review.googlesource.com/c/tools/+/351832
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
Reviewed-by: Tim King <taking@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
2021-11-06 00:08:25 +00:00
Tim King b8b8e7f4c0 analysis/internal/facts: Updating facts for generics.
Updates importMap() to consider generics.

For golang/go#48704

Change-Id: Ic5dafc644c4e81a64df338a165ee8e20627c6113
Reviewed-on: https://go-review.googlesource.com/c/tools/+/360295
Run-TryBot: Tim King <taking@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
Trust: Tim King <taking@google.com>
2021-11-05 23:32:57 +00:00
Robert Findley 4ab7496d90 go/analysis/passes/copylock: avoid infinite recursion via type params
We should not infinitely expand type parameters looking for a lock path.

Fixes golang/go#49384

Change-Id: I8e1c952d468908aeb16751dddd6c05bb07f3c95c
Reviewed-on: https://go-review.googlesource.com/c/tools/+/361456
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Tim King <taking@google.com>
2021-11-05 18:05:53 +00:00
Zvonimir Pavlinovic 1c6f3cc33f go/analysis/passes/ctrlfow: rely on typeutil.StaticCallee
typeutil.StaticCallee now supports generic functions, so that can be
used instead of ctrlflow computing static callee for generics on its own.

Change-Id: I38aaf2d91bf1b7f4d0bf5ba6a6684271c1569464
Reviewed-on: https://go-review.googlesource.com/c/tools/+/361406
Run-TryBot: Zvonimir Pavlinovic <zpavlinovic@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
Trust: Zvonimir Pavlinovic <zpavlinovic@google.com>
2021-11-05 17:08:36 +00:00
Robert Findley 1ae27d3d3d internal/lsp/cache: don't offset invalid positions
The zero value of token.Pos is special: it determines IsValid(), which
has semantic significance in many places.

offsetPositions, which adjusts positions after AST mangling, was
adjusting all positions -- including invalid positions. As a result it
was making invalid positions valid, leaving a nonsensical AST.

Fix it to skip invalid positions.

Change-Id: I844f243f9a4a3f98ace32fe30e934410d11142dd
Reviewed-on: https://go-review.googlesource.com/c/tools/+/361614
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Suzy Mueller <suzmue@golang.org>
2021-11-05 15:19:55 +00:00