This may address a test hang observed in
https://build.golang.org/log/da703ece9e1626eaeabf485e1a3a8180a6bde512.
At the very least, it should make the test much more efficient.
Change-Id: I6a41f9704c8a95276c904f0aee57c4521d642ea7
Reviewed-on: https://go-review.googlesource.com/c/tools/+/390074
Trust: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Update to v2.4.0, which brings optimizations and minor improvements.
Upstream fixed the issue with word breaks in v2.3.0,
released back in July 2021. For more, see:
https://github.com/mvdan/xurls/issues/49
In short, ASCII TLDs now require a word break in Relaxed again.
Note that non-ASCII TLDs don't require one, as that just breaks them.
So, in that sense, this is making non-ASCII TLDs work in gopls again.
Plus, we avoid wasting CPU cycles at init time by rebuilding the regexp.
Change-Id: Iddb34827b61594fa1f911143f1d7e2c67a6658c9
Reviewed-on: https://go-review.googlesource.com/c/tools/+/389814
Trust: Daniel Martí <mvdan@mvdan.cc>
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Robert Findley <rfindley@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
This CL adds support for generating method stubs for named types
that have type parameters and want to implement an interface.
See internal/lsp/testdata/stub/stub_generic_receiver.go for an example.
Note, this CL does not yet support type params on interface declarations.
Updates golang/go#37537
Change-Id: I2a2a18d364b2b489e2fbd8a74dfed88ae32d83b5
Reviewed-on: https://go-review.googlesource.com/c/tools/+/389654
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Trust: Suzy Mueller <suzmue@golang.org>
Before this change, newWorkspace would fall back to other workspace
types if there was an error parsing go.work files, or one of the
workspace modules did not exist. Instead, in those cases, newWorkspace
now successfully builds a *workspace with an error set.
This respects the user's intent when working with a go.work file so that
gopls can surface a diagnostic with the error.
Change-Id: Icfc2cad270111c03d53137fa8f1b2ee9b75093c8
Reviewed-on: https://go-review.googlesource.com/c/tools/+/389314
Trust: Michael Matloob <matloob@golang.org>
Run-TryBot: Michael Matloob <matloob@golang.org>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
Adds a type visitor to ssa that determines whether a type is parameterized or not.
Adapted from go/types/infer.go.
Updates golang/go#48525
Change-Id: I06285c6753ba8c5aab2dfe418556fdcf2b2f9437
Reviewed-on: https://go-review.googlesource.com/c/tools/+/386317
Reviewed-by: Robert Findley <rfindley@google.com>
Run-TryBot: Tim King <taking@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Trust: Tim King <taking@google.com>
Changes the Packages field named values (map[types.Object]Value) to a field named objects (map[types.Object]Member).
This is in preparation for generic functions. Generic functions are expected to be package level Members but not Values in the v0 implementation.
Updates golang/go#48525
Change-Id: I4c283fd3b715eeccad377346adc3ba718a1b741f
Reviewed-on: https://go-review.googlesource.com/c/tools/+/386814
Reviewed-by: Robert Findley <rfindley@google.com>
Run-TryBot: Tim King <taking@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Trust: Tim King <taking@google.com>
Adds a *types.Info field to ssa.Function. This field is used for building the function instead of fn.Pkg.info. This allows for building a Function after its containing Package finishes its create phase. Building an instance of a generic function from another package requires this.
Updates golang/go#48525
Change-Id: I294f71bb5d513e4076efebf05b718ec75a47312a
Reviewed-on: https://go-review.googlesource.com/c/tools/+/386634
Reviewed-by: Robert Findley <rfindley@google.com>
Run-TryBot: Tim King <taking@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Trust: Tim King <taking@google.com>
Move the BasicBlock related functions and methods into their own file.
Miscellaneous cleanup.
Updates golang/go#48525
Change-Id: If1c89cf53a4dba25d0c8b703e53c79eb27957f9c
Reviewed-on: https://go-review.googlesource.com/c/tools/+/386316
Reviewed-by: Zvonimir Pavlinovic <zpavlinovic@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Trust: Tim King <taking@google.com>
Run-TryBot: Tim King <taking@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Fixes a bug where the go mod edit -go=version file edits
are never actually applied.
Change-Id: Id055b0fad3399a00e1245556eb39073f15be09d9
Reviewed-on: https://go-review.googlesource.com/c/tools/+/389216
Trust: Suzy Mueller <suzmue@golang.org>
Run-TryBot: Suzy Mueller <suzmue@golang.org>
gopls-CI: kokoro <noreply+kokoro@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Put Program level type canonicalization on its own Mutex. With generics, canonical types are requested whenever instantiating a type. This simplifies when canonical types can be requested at the cost of maintaining two typeutil.Hashers.
Updates golang/go#48525
Change-Id: I2376a43e43f410d10a6d87158816e728aba746ca
Reviewed-on: https://go-review.googlesource.com/c/tools/+/386315
Reviewed-by: Robert Findley <rfindley@google.com>
Run-TryBot: Tim King <taking@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Trust: Tim King <taking@google.com>
This CL addresses an additional comment from CL 388994, changing the
example to move the go.work file outside of the repo.
For golang/go#51206
Change-Id: I576615f9bbcc676f3f78a959ad509b9dbab3b00e
Reviewed-on: https://go-review.googlesource.com/c/tools/+/389234
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
The existing example is no longer recommended as it can have unintended
consequences; for example, if it is run while the cursor is in an
incomplete struct, it will fill in all struct fields.
This is described more at https://github.com/neovim/nvim-lspconfig/issues/115#issuecomment-866632451
Change-Id: I3640ddb747a69c864675c0483032037a5e777d59
GitHub-Last-Rev: 2335f017eb967785da28ddb1bc48fb820d59a07e
GitHub-Pull-Request: golang/tools#371
Reviewed-on: https://go-review.googlesource.com/c/tools/+/389194
Reviewed-by: Robert Findley <rfindley@google.com>
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
Trust: Hyang-Ah Hana Kim <hyangah@gmail.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
If a call request comes it at the same time that a response becomes
ready for another call (either via an explicit Respond call or the
return from a Handle call), the map read and deletion for the response
could race with the map assignment for the new (incoming) call.
Change-Id: Ifd81dbc490486251e81c7eeae438806356f514af
Reviewed-on: https://go-review.googlesource.com/c/tools/+/388595
Trust: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Add a new subdirectory 'signature-fuzzer' to the x/tools/cmd
directory, with contents:
internal/fuzz-generator Guts of the signature fuzzer
fuzz-driver Simple driver for the fuzzer
fuzz-runner Test harness for doing iterative fuzzing
This set of tools is primarily of interest to compiler developers as
opposed to end users. The fuzzer generates random Go code with
"interesting" randomly chosen function signatures (random numbers of
parameters of randomly generated types), then emits code to call these
random functions with known inputs, as well as code that checks to
make sure parameter values were passed correctly and that returns
worked. The generator tries to include odd scenarios and corner cases
(e.g. reflect calls, recursion, blank params, zero sized types, etc)
so as to explore all the nooks and crannies of the compiler.
This fuzzer was used during the bringup of the new register ABI (as
part of Go 1.17) to identify odd corner cases and flush out bugs. It
may be useful in the future if we have to support new ABI versions or
bring up register ABIs on new architectures.
See the README.md for more details.
Change-Id: Icbc89ddd07c3909a44a005deab43720c7a0dffde
Reviewed-on: https://go-review.googlesource.com/c/tools/+/350329
Reviewed-by: Jeremy Faller <jeremy@golang.org>
Trust: Than McIntosh <thanm@google.com>
Run-TryBot: Than McIntosh <thanm@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Govim tests expect error messages to use 'any', so build gopls using the
RC.
For golang/go#51056
Change-Id: I0f8cab5d7eea3efbbd5b3f3dd9918e85831c2d50
Reviewed-on: https://go-review.googlesource.com/c/tools/+/388436
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: Jamal Carvalho <jamal@golang.org>
Adds a command to run go mod edit -go to allow
users to easily upgrade their go directive.
Doing this change also revealed that changing
the go directive does not invalidate the type check
data and there may be stale diagnostics for a package.
Updates golang/go#51086
Change-Id: I659a216059c489a88e29cd51b944c3a0274f3700
Reviewed-on: https://go-review.googlesource.com/c/tools/+/386875
Trust: Suzy Mueller <suzmue@golang.org>
Run-TryBot: Suzy Mueller <suzmue@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
`go get golang.org/x/tools/gopls@master ...` resulted in warning messages like:
go get: installing executables with 'go get' in module mode is deprecated.
To adjust and download dependencies of the current module, use 'go get -d'.
To install using requirements of the current module, use 'go install'.
To install ignoring the current module, use 'go install' with a version,
like 'go install example.com/cmd@latest'.
For more information, see https://golang.org/doc/go-get-install-deprecation
or run 'go help get' or 'go help install'.
Change-Id: I1299983604c27e333f02af875826b5dd4d170068
Reviewed-on: https://go-review.googlesource.com/c/tools/+/388074
Trust: Hyang-Ah Hana Kim <hyangah@gmail.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Removes the forced conversion of the right operand of a shift to an unsigned type. This allows for clients to correctly model the runtime panic when a signed shift count is negative.
Fixesgolang/go#51363
Change-Id: If59000eeb503fd45cdc6d4143dcc249242e7a957
Reviewed-on: https://go-review.googlesource.com/c/tools/+/387995
Trust: Tim King <taking@google.com>
Run-TryBot: Tim King <taking@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
Reviewed-by: Zvonimir Pavlinovic <zpavlinovic@google.com>
Reviewed-by: Dominik Honnef <dominik@honnef.co>
Trust: Dominik Honnef <dominik@honnef.co>
TryBot-Result: Gopher Robot <gobot@golang.org>
In test files, function definitions starting with
Test, Bench, or Fuzz can be completed almost automatically.
For the snippets the user hits tab, completes the name, hits
tab again, and the function is defined, except (of course) for its
body.
Otherwise a completion that fills in the signature is proposed.
Where appropriate, 'TestMain(m *testing.M)' is also offered as
a completion.
Fixesgolang/go#46896 and golang/go#51089
Change-Id: I46c05af0ead79c1d82ca40b2c605045e06e1a35d
Reviewed-on: https://go-review.googlesource.com/c/tools/+/385974
Run-TryBot: Peter Weinberger <pjw@google.com>
Trust: Peter Weinberger <pjw@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
gopls-CI: kokoro <noreply+kokoro@google.com>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
The go directive affects type checking errors so
it should be included in the package key.
I manually tested that this fixes the issue in golang/go#51325Fixesgolang/go#51325
Change-Id: I109859ae65e7e4d5fdefc63a0a7a838117ee02cf
Reviewed-on: https://go-review.googlesource.com/c/tools/+/387914
Trust: Suzy Mueller <suzmue@golang.org>
Run-TryBot: Suzy Mueller <suzmue@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
If available, pass the LangVersion and ModulePath provided by
go/packages to gofumpt. This allows gofumpt to apply additional
formatting rules that require this information.
Also add a regression test for gofumpt formatting.
Fixesgolang/go#51327
Change-Id: I47c8c96d595d62e1c444285ce69ce6a4e61fa74c
Reviewed-on: https://go-review.googlesource.com/c/tools/+/387634
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
Trust: Daniel Martí <mvdan@mvdan.cc>
gopls-CI: kokoro <noreply+kokoro@google.com>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
When hashing signature type parameters, we recursed into their
constraints in an attempt to improve the accuracy of the hash
(signatures are considered identical modulo type parameter renaming).
This introduces a mechanism for infinite recursion via recursive
constraints, as reported in golang/go#51314. To fix this, we can hash
just the type parameter index and rely on types.Identical for
de-duplicating map entries.
Fixesgolang/go#51314
Change-Id: Ifd7596d978b98293391bbe64f72f1da2b2a5d51c
Reviewed-on: https://go-review.googlesource.com/c/tools/+/387754
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
Reviewed-by: Tim King <taking@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
This analyzer was written at a time when any was only allowed in
constraints, and usage of any vs interface{} was more likely to be
confusing.
Any is now allowed anywhere, and so it is inconsistent to suggest it
only for constraints. However, we can't suggest any over interface{}
everywhere, as that would be incredibly noisy.
Perhaps we should remove this analyzer, but for now simply change it to
off by default.
Change-Id: Ib9726bdb835808d69827c6cd8e4a58dc5d83ad0e
Reviewed-on: https://go-review.googlesource.com/c/tools/+/387614
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>
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>
Now that there there can be multiple main modules due to workspaces in
cmd/go, update internal/imports to no longer assume that there will be
exactly one main module.
Change-Id: I9d044df612fbeaba73b8fc3dbbec0395b54ecba2
Reviewed-on: https://go-review.googlesource.com/c/tools/+/386254
Trust: Michael Matloob <matloob@golang.org>
Run-TryBot: Michael Matloob <matloob@golang.org>
Trust: Bryan Mills <bcmills@google.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Remove support for passing the -workfile flag now that the go command no
longer supports it.
Updates #51215
Change-Id: I95d73fb1a3a6d9bcfaaae5e22e44722118d12c03
Reviewed-on: https://go-review.googlesource.com/c/tools/+/386536
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
When there is a syntax or type error, we should run the analyzers that
have the RunDespiteError flag set to true, if any. The current code just
skips any analysis whatsoever.
For golang/go#51014
Change-Id: I5c3e5f3d9e2e8d791e9996b9114bb719e89daf30
Reviewed-on: https://go-review.googlesource.com/c/tools/+/383974
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Tim King <taking@google.com>
Trust: Michael Matloob <matloob@golang.org>
Run-TryBot: Zvonimir Pavlinovic <zpavlinovic@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Use the type name object as the signature source for type parametes, as
it it efficiently formatted as "type parameter <name> <constraint>".
Fixesgolang/go#51116
Change-Id: I3042ff248402dae833e3197c6ac320c2bd103c07
Reviewed-on: https://go-review.googlesource.com/c/tools/+/385018
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Clean up the relationship between HoverContext and HoverJSON so that
HoverContext is more clearly responsible for collecting comment and
signature nodes, and HoverJSON is more clearly a DTO for the hover RPC.
Change-Id: Ib32d4151a53505d227b4225be4f87754a542e980
Reviewed-on: https://go-review.googlesource.com/c/tools/+/385017
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
We should not offer links to variable or type declarations in function
scope. Improve our heuristics to check that the declaration object is
actually reachable from the package scope.
Also push down handling of private import paths, so that the
HoverJSON.importPath field can be removed.
Change-Id: I6edb3be3c37f479667c838beb49f97e7167b47a1
Reviewed-on: https://go-review.googlesource.com/c/tools/+/385016
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Hover on type specs was using the RHS of the type declaration and then
later rebuilding the declaration syntax. It was thereby dropping type
parameter lists.
Fix this by capturing the entire *TypeSpec for the signature, and
simply dropping comments from the node before formatting, so that they
are not duplicated.
Change-Id: I58724e65bd1f2aada1a5c04e4c61a059bed8357a
Reviewed-on: https://go-review.googlesource.com/c/tools/+/385015
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
The logic to resolve hover information is hard to follow, due to various
indirection building up the HoverInformation struct, and the lack of a
definition for HoverInformation.source. Incrementally refactoring to
solve these problems is a tricky; as a first step, split out that
information which is shared with completion and signature help into a
new type.
Also refactor FormatHover to be a bit more uniform.
Change-Id: Ib4f30e5f7cd085a3280c31836df3840ee3466b4d
Reviewed-on: https://go-review.googlesource.com/c/tools/+/385014
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Thread through an adjusted object position when we format an re-parsed
AST that wasn't type-checked to produce the object. Also remove some
unnecessary handling of the object type.
Fixesgolang/go#46158
Change-Id: Ic8bee2bb4cb992d577d085599213fca1deab3b4e
Reviewed-on: https://go-review.googlesource.com/c/tools/+/384697
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Receiver base types are either *Interface or *Named, never *Struct.
Absent a comment, I don't know why we had handling for *Struct, so just
delete it.
We only care about the enclosing type if it is named, so track a
*TypeName rather than an arbitrary Type.
Change-Id: I729c85b935a35da429b975327b56d81dc56773cf
Reviewed-on: https://go-review.googlesource.com/c/tools/+/384696
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
These arrays can be quite large, reducing the size of them
save lot of space reducing cache usage and file size.
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Change-Id: I446088627bc135cb47f6bee919e147b24d1ad848
Reviewed-on: https://go-review.googlesource.com/c/tools/+/374434
Reviewed-by: Keith Randall <khr@golang.org>
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
This will make GOWORK value appear in the gopls log
when initializing the workspace. This CL does not include
GOWORK in `environmentVariables` (in view.go) (yet).
Change-Id: I16224d1ac50ac8209def008966371c6be858d05a
Reviewed-on: https://go-review.googlesource.com/c/tools/+/385894
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>
Reviewed-by: Heschi Kreinick <heschi@google.com>
The function printAcceptedFuzzType was renamed to
formatAcceptedFuzzType after PS6 of CL 374495, but the rename was
missed in one spot and didn't get caught by TryBots.
Updates golang/go#50198
Change-Id: Ib51d26b8c159dbdc3beeac9c7c98f19690e82228
Reviewed-on: https://go-review.googlesource.com/c/tools/+/386314
Trust: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
Reviewed-by: Tim King <taking@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
This CL adds a quickfix CodeAction that detects "missing method"
compiler errors and suggests adding method stubs to the concrete
type that would implement the interface. There are many ways that
a user might indicate a concrete type is meant to be used as an interface.
This PR detects two types of those errors: variable declaration and function returns.
For variable declarations, things like the following should be detected:
1. var _ SomeInterface = SomeType{}
2. var _ = SomeInterface(SomeType{})
3. var _ SomeInterface = (*SomeType)(nil)
For function returns, the following example is the primary detection:
func newIface() SomeInterface {
return &SomeType{}
}
More detections can be added in the future of course.
Fixesgolang/go#37537
Change-Id: Ibb7784622184c9885eff2ccc786767682876b4d3
Reviewed-on: https://go-review.googlesource.com/c/tools/+/274372
Reviewed-by: Heschi Kreinick <heschi@google.com>
Reviewed-by: 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>
This will validate that first letter after FuzzFoo() should be uppercase
Also, following validation will be performed for f.Fuzz() calls :
1. f.Fuzz() should call a function and it should be of type (*testing.F).Fuzz().
2. The called function in f.Fuzz(func(){}) should not return result.
3. First argument of func() should be of type *testing.T
4. Second argument onwards should be of type []byte, string, bool, byte,
rune, float32, float64, int, int8, int16, int32, int64, uint, uint8, uint16,
uint32, uint64
For golang/go#50198
Change-Id: I540daf635f0fe03d954b010b9b5f8616fd5df47a
Reviewed-on: https://go-review.googlesource.com/c/tools/+/374495
Reviewed-by: Robert Findley <rfindley@google.com>
Trust: Peter Weinberger <pjw@google.com>
Initializes the Instances field during BuildPackage.
Updates golang/go#48525
Change-Id: I4d60d644443733930528e2109db75589511de6f4
Reviewed-on: https://go-review.googlesource.com/c/tools/+/385775
Run-TryBot: Tim King <taking@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
Trust: Tim King <taking@google.com>
Initialize the Instances field of PackageInfo.Info during importing.
Needed for go/ssa and similar users.
Updates golang/go#48525
Change-Id: Ibacf925e677ec6e90068b90a4f381d96c22338cc
Reviewed-on: https://go-review.googlesource.com/c/tools/+/385774
Run-TryBot: Tim King <taking@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
Wired through support for calling x/mod's go.work formatter on go.work
files into LSP. Tested it by hand in editor using the "Format Document"
command. Added a test case to workspace_test regtest, though I'm not
totally sure the test is correct.
For golang/go#50930
Change-Id: Ied052ded514bb36f561737698f0e2d7b488158e7
Reviewed-on: https://go-review.googlesource.com/c/tools/+/383774
Trust: Michael Matloob <matloob@golang.org>
Run-TryBot: Michael Matloob <matloob@golang.org>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
When a prepare rename request is issued on an package
import with no alias, the range returned by prepare
rename has length 0. This by itself does not provide
enough information to the client about what the original
name of the import statement. By returning a range and
a placeholder, this allows the client to correctly present
the information about what is being renamed to the user.
Change-Id: I191fdc666616d1ddf718d2a0b1461b9b645af879
Reviewed-on: https://go-review.googlesource.com/c/tools/+/360836
Trust: Suzy Mueller <suzmue@golang.org>
Run-TryBot: Suzy Mueller <suzmue@golang.org>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Peter Weinberger <pjw@google.com>
LinkifyText should not generate links to global declarations for
identifiers that are type parameters.
Because the syntactic resolver does not record the declaration for type
parameters declared in the method receiver (see
https://golang.org/issue/50956) a name lookup is used as a workaround.
This is fine here because it is only applied to undeclared indentifiers
and LinkifyText is only ever called on a single declaration at a time,
not on a full AST.
Updates golang/go#50717
Change-Id: I32f2203ce80c060ee18ca8b964a2d5fd80f41957
Reviewed-on: https://go-review.googlesource.com/c/tools/+/382714
Reviewed-by: Robert Findley <rfindley@google.com>
Run-TryBot: Alessandro Arzilli <alessandro.arzilli@gmail.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Trust: Peter Weinberger <pjw@google.com>