The JSON-RPC 2.0 protocol requires that responses objects
have either a "result" or an "error", but not both.
In Go, this corresponds to a non-nil result interface value or a
non-nil error.
However, the generated wrappers for the LSP protocol were passing
non-nil values for both in case of error, due to passing typed-nil
pointers as (non-nil) interfaces (see
https://go.dev/doc/faq#nil_error).
This change fixes the generator to explicitly pass only one or the
other, and re-runs the generator at the existing commit.
For golang/go#49387
For golang/go#46520
Change-Id: I582b52820bdac15d9f947e8d6c1e9daa70c53e40
Reviewed-on: https://go-review.googlesource.com/c/tools/+/388600
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>
The documentation for jsonrpc2.Replier states that
“[i]f err is set then result will be ignored.”
jsonrpc2_v2 documents no such affordance, and the JSON-RPC 2.0
protocol explicitly requires that the result “MUST NOT exist if there
was an error invoking the method.”
Although CL 388600 already avoids returning values in case of error
(which may also help with escape analysis and/or allocation
efficiency), it seems simplest and least confusing to make the
semantic difference between the jsonrpc2.Handler and
jsonrpc2_v2.Handler explicit in the code.
For golang/go#46520.
Change-Id: If13eb842505d42cbc51c01f5f5e699a549a3a28b
Reviewed-on: https://go-review.googlesource.com/c/tools/+/400054
Run-TryBot: Bryan Mills <bcmills@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Gofmt to update doc comments to the new formatting.
(There are so many files in x/tools I am breaking up the
gofmt'ing into multiple CLs. This is the leftovers.)
For golang/go#51082.
Change-Id: Id9d440cde9de7093d2ffe06cbaa7098993823d6b
Reviewed-on: https://go-review.googlesource.com/c/tools/+/399363
Run-TryBot: Russ Cox <rsc@golang.org>
Auto-Submit: Russ Cox <rsc@golang.org>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Gofmt to update doc comments to the new formatting.
(There are so many files in x/tools I am breaking up the
gofmt'ing into multiple CLs.)
For golang/go#51082.
Change-Id: Ife11502fe1e59a04d53dba9edccd3043e57f9ae8
Reviewed-on: https://go-review.googlesource.com/c/tools/+/399358
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Russ Cox <rsc@golang.org>
gopls-CI: kokoro <noreply+kokoro@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Running go mod vendor can result in vendor/modules.txt being transiently
deleted while it is being updated. On Windows this introduces potential
problems with file locking, if modules.txt is being read by another go
process, such as an ongoing package load.
Change the command to use RunGoCommandPiped, which executes serially
within the gopls process.
For golang/go#49646
Change-Id: If2d1fe5431122ba05014051a0e9c303cf7ee9cb2
Reviewed-on: https://go-review.googlesource.com/c/tools/+/399714
Run-TryBot: Robert Findley <rfindley@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
When polling for on-disk file changes, we must detect changes even if
there is no change in the file since the last polling.
The reason for this is that there could have been intermediate changes
to the file that affected our calculations, and those calculations must
be invalidated.
For golang/go#51930
Change-Id: I92f5c34f982970d8386fddfaa22b82ba471e22e7
Reviewed-on: https://go-review.googlesource.com/c/tools/+/399625
Run-TryBot: Robert Findley <rfindley@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Upgrade staticcheck to v0.3.0 to pick up support for generics. Since
this version only supports Go 1.17+, increase the version at which we
install staticcheck to 1.17 (from 1.15). This change is likely to cause
confusion for users on Go 1.16, so show a warning when setting
the "staticcheck" option to an unsupported value. Slightly refactor our
setting of options along the way.
Fixesgolang/go#52159
Change-Id: Id9b4cee340e31988c64ca712d98573343aaf5848
Reviewed-on: https://go-review.googlesource.com/c/tools/+/396974
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
Trust: Peter Weinberger <pjw@google.com>
Reviewed-by: Peter Weinberger <pjw@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
Fixes: golang.org/#52024
Change-Id: Ib79a839f9bdeaef1250925add69dea3ae32e1cae
Reviewed-on: https://go-review.googlesource.com/c/tools/+/397479
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Trust: Hyang-Ah Hana Kim <hyangah@gmail.com>
Trust: Peter Weinberger <pjw@google.com>
This is a minimal fix for the reported panic. The existing code
used FileSet.Position() where it should have used FileSet.PositionFor(, false).
gopls does this in lots of places; each use of Position() needs to
be thought about.
x/tools/go/ast/astutil/import.go:273,274 is another example.
Fixes: golang/go#51916
Change-Id: I42de6affca2c97c09efb7974a9e44322556b3ffd
Reviewed-on: https://go-review.googlesource.com/c/tools/+/398395
Run-TryBot: Peter Weinberger <pjw@google.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
Trust: Peter Weinberger <pjw@google.com>
The directory for the vulncheck command is passed
as an argument. Use the specified directory
in the configuration.
Change-Id: I1824b308701fd30548efa8bec7452de1fdf76bb9
Reviewed-on: https://go-review.googlesource.com/c/tools/+/398394
Trust: Suzy Mueller <suzmue@golang.org>
Run-TryBot: Suzy Mueller <suzmue@golang.org>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Trust: Hyang-Ah Hana Kim <hyangah@gmail.com>
Change-Id: I13cf73d7e043dda1a06c28bb09e413a76a68df1f
Reviewed-on: https://go-review.googlesource.com/c/tools/+/391934
Reviewed-by: 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>
Trust: Hyang-Ah Hana Kim <hyangah@gmail.com>
Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
When using gopls remote, existing go env vars are injected in the
initialize message. Setting GOWORK explicitly will impact cmd/go
invocations, for example "go list" during package load. The reason it
impacts is that gopls manually sets PWD to fix paths returned by cmd/go
if the working directory is inside a symlinked directory.
By only propagate GOWORK when it is explicitly set we will ensure that
the behavior is the same when running with or without remote.
See golang/go#51823.
Fixesgolang/go#51825
Change-Id: I6280aa7d8208e5aee269f19356668c7713e9f0a4
Reviewed-on: https://go-review.googlesource.com/c/tools/+/394054
Trust: Pontus Leitzler <leitzler@gmail.com>
Run-TryBot: Pontus Leitzler <leitzler@gmail.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
Current implementation returns incorrect result when some of the items are skipped, because positions could be relative to a skipped item. Instead, each position must be relative to the previous item added to the result.
Change-Id: I3c1a68d37bf0c9cfc1bccfe6f76c25b536224293
GitHub-Last-Rev: 6eedc7cbcc27f47ed5742b340f4438291ab70863
GitHub-Pull-Request: golang/tools#376
Reviewed-on: https://go-review.googlesource.com/c/tools/+/396715
Run-TryBot: Peter Weinberger <pjw@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Peter Weinberger <pjw@google.com>
Trust: Peter Weinberger <pjw@google.com>
Trust: Suzy Mueller <suzmue@golang.org>
internal/gopathwalk.walk remove an unnecessary call to os.Lstat when
checking if a symlink should be traversed. And remove a call to
filepath.EvalSymlinks that should be unnecessary as we are using
os.Stat to compare files.
Change-Id: Ie5ad1cb99cbd6d62f08f2b482a3e84b6fe41114d
Reviewed-on: https://go-review.googlesource.com/c/tools/+/392095
Reviewed-by: Heschi Kreinick <heschi@google.com>
Run-TryBot: Heschi Kreinick <heschi@google.com>
Auto-Submit: Heschi Kreinick <heschi@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Trust: Ian Lance Taylor <iant@golang.org>
beginFileRequest returns a nil error when file request url is
not a valid file url format. This is reported with a separate 'ok'
boolean return value.
This bug caused custom gopls commands to return success with
an empty result, instead of reporting the problem as an error.
Change-Id: I8eed39368087fa9928bcc68853225ea432f500d2
Reviewed-on: https://go-review.googlesource.com/c/tools/+/395814
Trust: Hyang-Ah Hana Kim <hyangah@gmail.com>
Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
Reviewed-by: Jamal Carvalho <jamal@golang.org>
gopls-CI: kokoro <noreply+kokoro@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
We do a lot of gymnastics to format var types, working around the lack
of alias tracking in go/types. As part of this, we clone and qualify
expressions. In this case, we were not qualifying identifiers that were
contained within fields or field lists.
Fix this by updating our expression traversal to include *ast.Field and
*ast.FieldList.
Fixesgolang/go#50539
Change-Id: I6531c6a51aa402bd784778b8bedaa3dccee75af0
Reviewed-on: https://go-review.googlesource.com/c/tools/+/395678
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: Gopher Robot <gobot@golang.org>
Different naming style for Vuln type is unnecessary.
And, we can safely assume that ID is not empty.
Change-Id: Ifd43b671c814796af0110bad05642187bb1ea655
Reviewed-on: https://go-review.googlesource.com/c/tools/+/395677
Trust: Hyang-Ah Hana Kim <hyangah@gmail.com>
Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
Reviewed-by: Robert Findley <rfindley@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Usage: gopls vulncheck <package_pattern>
It prints json-encoded command.VulncheckResult in stdout.
Change-Id: I752b3f06d7c6b2c7de68bd1221283205955c383f
Reviewed-on: https://go-review.googlesource.com/c/tools/+/395676
Trust: Hyang-Ah Hana Kim <hyangah@gmail.com>
Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
Reviewed-by: Robert Findley <rfindley@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Change-Id: Iaad847631b9d5ee40558fcf9d51f4dfa99600e6b
GitHub-Last-Rev: 6fcb64f8d9a093e7bd949e5d28bd1176c27005c0
GitHub-Pull-Request: golang/tools#372
Reviewed-on: https://go-review.googlesource.com/c/tools/+/389595
Run-TryBot: Ian Lance Taylor <iant@golang.org>
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: Ian Lance Taylor <iant@golang.org>
Trust: Hyang-Ah Hana Kim <hyangah@gmail.com>
Avoid a panic when a directoryFilters entry is empty.
Fixesgolang/go#51843
Change-Id: I50948894ce60d83441c3fc698c2e7d80d1d2b50e
Reviewed-on: https://go-review.googlesource.com/c/tools/+/395675
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>
Make builtin hover consistent with signatureHelp by reusing the
BuiltinSignature function. To simplify this, just precompute the builtin
signature. In later CLs we can pre-compute all signatures and eliminate
the signatureSource indirection.
Fixesgolang/go#51811
Change-Id: I1babe64ba41f636bf455074a23ad6dac5539fb89
Reviewed-on: https://go-review.googlesource.com/c/tools/+/395294
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>
This is a command that runs govulncheck-like analysis.
This is highly experimental and can change any time,
so we mark it with the "Exp" suffix. Once the interface
becomes stable, we will rename this command.
It returns VulncheckResult that can be encoded as
a JSON message. The result includes all potentially
affecting vulnerabilities, and sample traces.
This feature is currently available only when gopls
is compiled with go1.18. Otherwise, the command will
return an error.
Updates golang/go#50577
Updates golang/vscode-go#2096
Change-Id: Ia37b0555f7bf98760292c9f68e50fb70dd494522
Reviewed-on: https://go-review.googlesource.com/c/tools/+/395576
Trust: Hyang-Ah Hana Kim <hyangah@gmail.com>
Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
And move types defined in gopls/internal/vulncheck
to internal/lsp/command so VulncheckResult can use them.
Another approach considered is to encode Vuln as a
json raw message. However, presenting the data structure
in gopls api documentation is too nice to give up.
Updates golang/vscode-go#2096
Updates golang/go#50577
Change-Id: I8587d19f9c47cf786dacaae8cfe1727c77cda711
Reviewed-on: https://go-review.googlesource.com/c/tools/+/395575
Trust: Hyang-Ah Hana Kim <hyangah@gmail.com>
Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Make the change from CL 334209 in the source.
Change-Id: I923d857b77552d6c8d100ce97b6b86f29fbc4934
Reviewed-on: https://go-review.googlesource.com/c/tools/+/393857
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>
For example:
func foo[A int | float64](a A) A { return a }
var _ int = fo<>
Previously at <> we would complete to "int(foo[A int|float64](a A))".
We added the int() type conversion because the returned type param A
was convertible to the expected "int" (i.e. both "int" and "float64"
can be converted). This is a premature suggestion, though, so fix by
suppressing such type conversions for type parameters.
Fixesgolang/go#51780.
Change-Id: I63e3bd401a4d9927b9261659812c521c02e33d94
Reviewed-on: https://go-review.googlesource.com/c/tools/+/394016
Run-TryBot: Muir Manders <muir@mnd.rs>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
Trust: Hyang-Ah Hana Kim <hyangah@gmail.com>
In this example:
func foo[A []int | []float64]() {}
foo[<>]
When completing at <> you were getting the creative candidate
"[]int | []float64". This came from some code that makes the expected
type available as a candidate if it wouldn't otherwise be found by a
lexical search. I tweaked the code in this case to instead look at
each structural type in the type constraint rather than the constraint
as a whole. In the above example you now get the candidates "[]int"
and "[]float64".
Change-Id: Ib8e422df3009cb4253ec66005b4a53851564c4e1
Reviewed-on: https://go-review.googlesource.com/c/tools/+/394015
Run-TryBot: Muir Manders <muir@mnd.rs>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
Trust: Hyang-Ah Hana Kim <hyangah@gmail.com>
Now when instantiating a generic function, we prefer type names that
are assignable to the corresponding constraint. For example:
func foo[A int|string]() {}
foo[<>]()
At <> we prefer the type names "int" and "string". Previously we had
no preference at all.
Updates golang/go#51782.
Change-Id: I7ed39ffa2bc4c63e9d320f47a58e139251712bb3
Reviewed-on: https://go-review.googlesource.com/c/tools/+/394014
Run-TryBot: Muir Manders <muir@mnd.rs>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
Trust: Hyang-Ah Hana Kim <hyangah@gmail.com>
If a go.mod file is updated, the packages
in that module may have updated type check
errors since the go version can affect errors.
Fixesgolang/go#51732
Change-Id: I3a8cd8b9ab267336ccc5c841a14c5ec5f6c986e5
Reviewed-on: https://go-review.googlesource.com/c/tools/+/393534
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>
Change-Id: Id2a88b9826598de539aeea5c3983df279aa0c6c6
Reviewed-on: https://go-review.googlesource.com/c/tools/+/392657
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: Robert Findley <rfindley@google.com>
Change-Id: I7bafb1555ab7d35b9c49138c915b6c6c781e92c6
Reviewed-on: https://go-review.googlesource.com/c/tools/+/392656
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: Robert Findley <rfindley@google.com>
There are also new InlineValue RPCs.
Change-Id: I4ba6d4c112760a5c5a199287843c61071a7f59a2
Reviewed-on: https://go-review.googlesource.com/c/tools/+/390334
Trust: Peter Weinberger <pjw@google.com>
Run-TryBot: Peter Weinberger <pjw@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
Reviewed-by: Dan Kortschak <dan@kortschak.io>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
With generics, instantiated object may have differing pointer
identities. Fix references/rename requests for instantiated
methods/fields by using a canonical object identity of (pos, pkg, name).
Fixesgolang/go#51672
Change-Id: I0021ca562b8a74dadb616cf6864cb0bdd0165cc3
Reviewed-on: https://go-review.googlesource.com/c/tools/+/392480
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: Gopher Robot <gobot@golang.org>
This fixes the regexp used to extract the import path from a line of code
when inserting newlines to split a sequence of imports into groups.
By using a non-greedy match, the regexp now functions correctly in the
face of an extra quote after the import path (such as when there is a
trailing comment that includes a quote).
Fixesgolang/go#51671
Change-Id: Id7fd0b1d794f989d8f3d47336c5b5454cddd6237
GitHub-Last-Rev: b934371fa6d9ded902deac2268658b4485d9ce70
GitHub-Pull-Request: golang/tools#365
Reviewed-on: https://go-review.googlesource.com/c/tools/+/386914
Reviewed-by: Heschi Kreinick <heschi@google.com>
Trust: Dmitri Shuralyov <dmitshur@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
to avoid losing workFile information when that happens. This fixes an
issue where diagnostics, hover, etc didn't show up after the initial
load when some changes were made to go.work files.
Change-Id: I42e2dcfd94a5b4726856ab0a4d8dfc9c1efc48b1
Reviewed-on: https://go-review.googlesource.com/c/tools/+/391257
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>
Commands will fail with -mod=mod when GOWORK is set. Explicitly set it
to off.
Fixesgolang/go#48941
Change-Id: I39f9d95526ca6f3b0414ff273cecd443d69afa61
Reviewed-on: https://go-review.googlesource.com/c/tools/+/391518
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>
The argument to f.Fuzz is determined, up to the names of arguments,
by the types of the arguments to f.Add. Inside the function argument
of f.Fuzz, only f.Name and f.Failed are allowed.
(The fset passed to fuzz was for debugging. When the change seems solid
it can be removed.)
Fixesgolang/go#51089
Change-Id: Icf8b8cdfd29e499bcc605a358ca9edaef5baa835
Reviewed-on: https://go-review.googlesource.com/c/tools/+/387615
Reviewed-by: Robert Findley <rfindley@google.com>
Trust: Peter Weinberger <pjw@google.com>
Run-TryBot: Peter Weinberger <pjw@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
If a go.work file is present, we activate the workspace mode regardless
of the experimentalWorkspaceModule setting.
Fixing this also revealed a long-standing bug in traversing parent
directories. Amazingly I have no recollection of this bug being
reported, but it is far more likely to be hit with go.work files, when
users regularly open nested subdirectories.
Fixesgolang/go#51477
Change-Id: I310a11b14f3bbc18fdd604c5c0ec33d7ee8f1174
Reviewed-on: https://go-review.googlesource.com/c/tools/+/389300
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>
Show the module path of the module being used.
For golang/go#50930
Change-Id: I90a67e12182ffb457876b1fbc95aeb56ff632878
Reviewed-on: https://go-review.googlesource.com/c/tools/+/389301
Trust: Michael Matloob <matloob@golang.org>
Run-TryBot: Michael Matloob <matloob@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Report diagnostics on use lines where the directory doesn't have a
go.mod file, and on syntax errors in go.work.
For golang/go#50930
Change-Id: Idab36b43d86c4842f8eecd5c071ce0587e6f27b3
Reviewed-on: https://go-review.googlesource.com/c/tools/+/389317
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>
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>