Use printer.CommentedNode to preserve comments in function and method
extraction.
Fixesgolang/go#50851
Change-Id: I7d8aa2683c980e613592f64646f8077952ea61be
Reviewed-on: https://go-review.googlesource.com/c/tools/+/629376
Reviewed-by: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
When substituting an argument that has been synthetically packed into a
composite literal expression, into the varadic argument of a call, we
can undo the variadic elimination and unpack the arguments into the
call.
Fixesgolang/go#63717Fixesgolang/go#69441
Change-Id: I8a48664b2e6486ca492e03e233b8600473e9d1a9
Reviewed-on: https://go-review.googlesource.com/c/tools/+/629136
Reviewed-by: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
go/types now (correctly) produces a diagnostic for this code.
For golang/go#59944
Change-Id: I858acbf4199171f6e6c98eb1286d037e89462018
Reviewed-on: https://go-review.googlesource.com/c/tools/+/630117
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
The hoverJSON.LinkPath field was incorrectly documented, and
the gopls links formed from it were invalid when a module
version was present. This CL fixes the URL logic.
The existing test covered the behavior, but the assertion
concealed a mistake.
Fixesgolang/go#70453
Change-Id: If9a7d3e65dabff50c9f528d82df9de67a71c41d1
Reviewed-on: https://go-review.googlesource.com/c/tools/+/630077
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Refactors the ZeroExpr and ZeroString functions to provide more
consistent and correct handling of zero values for input types.
- Refactor: Unify similar switch case statements in both functions with
exception of types.Tuple. ZeroExpr panic due to the lack of a valid
ast.Expr representation.
- Fixing an issue where ZeroExpr returned nil for types.Array instead of
a composite literal.
- Adding support for type parameters in ZeroExpr, similar to ZeroString.
- Consolidating tests for both functions into TestZeroValue.
Change-Id: Ic77ae17ea091cf51bd4d4642186fe13093e0d461
Reviewed-on: https://go-review.googlesource.com/c/tools/+/627604
Reviewed-by: Tim King <taking@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Auto-Submit: Hongxiang Jiang <hxjiang@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
We are overwhelmed by contributions. This change updates
our expectations about CLs in an attempt to move more of
the discussion of the design and implementation plan into
the issue tracker. It also clarifies that we expect
review comments to be addressed.
Change-Id: Ibccd268d4f7d9b6daf256ac7c60b7fbd821e2a69
Reviewed-on: https://go-review.googlesource.com/c/tools/+/629755
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
This change removes the undeclaredname analyzer,
and instead computes it directly from the
protocol.QuickFix code action producer,
follow the same structure in CL 617035.
Also:
- include return types for undeclared function
- add basic return type test in missingfunction.txt,
the major functionality should be the same as
fromcall_returns.txt
- add more cases in TypesFromContext, and
corresponding tests.
Fixesgolang/go#47558
Change-Id: Ic79cf2f07a3baee60631bf0b8f5c2b9f4f4393d0
GitHub-Last-Rev: 33b78d7997
GitHub-Pull-Request: golang/tools#538
Reviewed-on: https://go-review.googlesource.com/c/tools/+/623156
Reviewed-by: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Findley <rfindley@google.com>
When inlining, a removed argument does not contain the last use of a
name if that name is also used by another arg that is referenced by the
callee. Implementing this logic improved a test case for
golang/go#65217.
For golang/go#65217
Change-Id: I486306f4ed57d759d5ab65bb390db5e81332d3ef
Reviewed-on: https://go-review.googlesource.com/c/tools/+/629295
Auto-Submit: Robert Findley <rfindley@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Address a TODO to consolidate the three codeaction marks into one, by
using named arguments to provide an optional end location and one of
edit, result, or err.
Along the way, I accidentally nuked my golden files after doing quite a
lot of manual editing of the test cases. To restore them, implement a
heuristic I've wanted for a while: when running with -update, add new
golden files immediately after the first reference to them among test
files. This is the convention we've been using, but previously we'd have
to position the golden files manually.
Change-Id: Ie78f759045aa0c07817d4eb21672be63e51c5067
Reviewed-on: https://go-review.googlesource.com/c/tools/+/627136
Reviewed-by: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Gopls previously reported a bug when encountering a dynamic method
reference. Instead, we should just skip this reference when inlining all
calls.
Fixesgolang/go#69896
Change-Id: Id6971e2a3eb79a94e76eecbfcefc44bec9040b8e
Reviewed-on: https://go-review.googlesource.com/c/tools/+/628376
Auto-Submit: Robert Findley <rfindley@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
The most likely cause of an inconsistent view of a dependency is a
mismatching test variant. Refine the bug report to identify this case.
For golang/go#63822
Change-Id: I1334501be1ea55a43a49557ad2cb1d03178268cc
Reviewed-on: https://go-review.googlesource.com/c/tools/+/628495
Reviewed-by: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
It is not a bug for go/packages to return no packages for standalone
files, if they use cgo and cgo is disabled. There may also be other
scenarios where standalone packages are not produced. In any case,
downgrade the bug report to a normal error.
Also, fix the failing test to require cgo.
Fixesgolang/go#70363Fixesgolang/go#70362
Change-Id: I2b8a8b3947e4d7ff6482279540638e13dc9de2b4
Reviewed-on: https://go-review.googlesource.com/c/tools/+/628017
Reviewed-by: Tim King <taking@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
It turns out that in the jsonrcp2 package, call responses are
asynchronous to other notifications. Therefore, we must synchronize
tests using progress notifications.
Introduce a DelayMessages test option to reproduce these types of races.
(It worked for reproducing golang/go#70342.)
Fixesgolang/go#70342
Change-Id: I4cfcd7675335694a47eaf1a2547be0301fc244c9
Reviewed-on: https://go-review.googlesource.com/c/tools/+/627696
Reviewed-by: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Although the LSP specifies that diagnostic data should be transmitted
unmodified to codeAction requests, we can't control whether clients
abide by this rule. Therefore, a failure to extract fixes should be
treated as a user-facing error, not a bug.
Fixesgolang/go#68819
Change-Id: I57e629cf381ee1112d98d22e728449995679b05f
Reviewed-on: https://go-review.googlesource.com/c/tools/+/628237
Reviewed-by: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
In the partial rollback CL 627556, I failed to remove the call to
jsonrpc2.Async in RunGoVulncheck, which is now (once again) async to
request handling. This introduces a race, leading to a panic if the
handler responds before the call to Async.
Fixesgolang/go#70355
Change-Id: I8b33599a3f62b82dc6acf9d9b3616194c0372b9c
Reviewed-on: https://go-review.googlesource.com/c/tools/+/628236
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
As suggested on CL 626715, using a named bool clarifies call sites.
Change-Id: Ie36f406dcca382c7edc277895826265ae9040ee2
Reviewed-on: https://go-review.googlesource.com/c/tools/+/628235
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
To simplify many callsites where we called filepath.Dir on uri.Path(),
introduce the DocumentURI.DirPath helper method. This clarified many
call sites, and could make it easier to optimize URI manipulation in the
future.
Change-Id: Icc64155b6bba631f9df5da5a05e3126c7cb7954b
Reviewed-on: https://go-review.googlesource.com/c/tools/+/626716
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
The Snapshot.GoCommandInvocation API is a source of confusion, because
it passes in a gocommand.Invocation, performs arbitrary mutation, and
then passes it back to the caller (which may perform mutation on top).
Aside from the readability problems of this indirectness, this API can
lead to real bugs, for example if one of the mutations is incompatible
with another.
Furthermore, the fact that the GoCommandInvocation is the golden source
of information about the Go command environment leads to awkwardness and
redundant work. For example, to get the packages.Config we called
Snapshot.GoCommandInvocation, just to read env, working dir, and build
flags (and the now irrelevant ModFile and ModFlag). But
GoCommandInvocation wrote overlays, so we'd end up writing overlays
twice: once within the gopls layer, and then again in the go/packages go
list driver.
Simplify as follows:
- Pass in dir, verb, args, and env to GoCommandInvocation, to avoid
passing around and mutating an Invocation.
- Extract the View.Env, which is a useful concept, and apply invocation
env on top. Surveying existing use cases that this was correct, as all
call sites expected their env not to be overwritten.
- Move Snapshot.config to load.go, where it belongs, and simplify not to
depend on GoCommandInvocation.
Also add an additional test case for BenchmarkReload.
Change-Id: I8ae7a13a033360e0e7b0b24ff718b5a22123e99c
Reviewed-on: https://go-review.googlesource.com/c/tools/+/626715
Reviewed-by: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Robert Findley <rfindley@google.com>
This analyzer detects failure to check the result of a call to
yield (which can cause a range loop to run beyond the sequence,
leading to a panic).
It is not always a mistake to ignore the
result of a call to yield; it depends on whether control can
reach another call to yield without checking that the first
call returned true. Consequently, this analyzer uses SSA
for control flow analysis.
We plan to add this analyzer to gopls before we promote it to vet.
+ test, relnote
Fixesgolang/go#65795
Change-Id: I75fa272e2f546be0c2acb10a1978c82bc19db5bd
Reviewed-on: https://go-review.googlesource.com/c/tools/+/609617
Auto-Submit: Alan Donovan <adonovan@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Commit-Queue: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Previously, we were using the first CompiledGoFiles to disambiguate the
ID of command-line-arguments packages, but in the presence of cgo
preprocessing there can actually be multiple CompiledGoFiles, leading
to the bug report of golang/go#64557. Fix this by using GoFiles instead.
Fixesgolang/go#64557
Change-Id: I3eff976d07da32db1f26ced69228af41a388d9a1
Reviewed-on: https://go-review.googlesource.com/c/tools/+/627776
Reviewed-by: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Robert Findley <rfindley@google.com>
Use field names or type names for result variables names, if available.
Otherwise, use the same conventions for var naming as completion. If all
else fails, use 'result' rather than 'returnValue'.
For golang/go#66289
Change-Id: Ife1d5435f00d2c4930fad48e7373e987668139ef
Reviewed-on: https://go-review.googlesource.com/c/tools/+/627775
Auto-Submit: Robert Findley <rfindley@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Hongxiang Jiang <hxjiang@golang.org>
- Read and determine whether the first input parameter of function
or constructor is a context.Context through package name and name
comparison.
- Call the function or constructor with context.Background() but
honor is there is any renaming in foo.go or foo_test.go.
- Fix the issue where the constructor param is added to function
or method call.
For golang/vscode-go#1594
Change-Id: Ic1d145e65bc4b7cb34f637bab8ebdeccd36a33f9
Reviewed-on: https://go-review.googlesource.com/c/tools/+/627355
Reviewed-by: Alan Donovan <adonovan@google.com>
Auto-Submit: Hongxiang Jiang <hxjiang@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
- Unnamed/blank parameters are now assigned zero values, as
they are not referenced within the function body.
- The `zeroString` function has been moved from `go/ssa` to
`internal/typesinternal` for better organization.
- Honor the input parameter name from the function signature.
- Input parameters from both consutrctor and target functions
are flattened into the test case struct. Potential field
name duplication is handled by introducing prefixes.
For golang/vscode-go#1594
Change-Id: I8b56d8f3e0f0432d4f9fe269cc7ba86ea46decfc
Reviewed-on: https://go-review.googlesource.com/c/tools/+/626537
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Auto-Submit: Hongxiang Jiang <hxjiang@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
With multiple return statements, a slice append would overwrite the
return values of earlier returns. Fix by using slices.Concat.
For golang/go#66289
Change-Id: Ib23bcb9ff297aa1ce9511c7ae54e692b14facca7
Reviewed-on: https://go-review.googlesource.com/c/tools/+/627537
Reviewed-by: Hongxiang Jiang <hxjiang@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Don't unconditionally call window/showDocument; check the client
capability. In the case of opening a browser window, use showMessage if
showDocument is unsupported.
Also somewhat clean up the way that we check for shown documents.
Fixesgolang/go#68904
Change-Id: I29b281b615185f2bbda2f00e7c17575678177cd0
Reviewed-on: https://go-review.googlesource.com/c/tools/+/626616
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
- Gopls will honor any renaming of package "testing" if any.
- Gopls will collect all the package that have not been imported
in foo_test.go and modify the foo_test.go imports.
For golang/vscode-go#1594
Change-Id: Id6b87b6417a26f8e925582317e91fb4ebff4a0e7
Reviewed-on: https://go-review.googlesource.com/c/tools/+/620697
Reviewed-by: Robert Findley <rfindley@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
As described in golang/vscode-go#3572 this CL reverts the behavior of
the gopls.run_govulncheck command to be asynchronous. Instead, we
introduce a new gopls.vulncheck command to run synchronously. We also
introduce a new "vulncheck" codelens setting to control the availability
of codelenses for this new command.
For expedience, the command handler is simply copied rather than
refactored, and minimal tests are added/modified to test the new
command. Hopefully we can migrate everything to the new command soon,
and delete the old command.
For golang/vscode-go#3572
Change-Id: Ib3cffd5fd038813680087fa1916127663f377581
Reviewed-on: https://go-review.googlesource.com/c/tools/+/627556
Reviewed-by: Alan Donovan <adonovan@google.com>
Auto-Submit: Robert Findley <rfindley@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Avoid a crash where types.Info.TyepOf(n) is assumed to be a non-nil
Struct for a StructType expr: this is not guaranteed in the presence of
type errors.
Unfortunately, I was not able to reproduce the crash after ~20m of
trying. Nevertheless, the existing code is making invalid assumptions.
Fixesgolang/go#69150
Change-Id: I48abe9c134722db5c43f1c7c382b59e7632e367f
Reviewed-on: https://go-review.googlesource.com/c/tools/+/627135
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
This CL splits the various fallible checks that may have
been responsible for the crash report in golang/go#69362 onto
separate lines so that we can confirm whether a nil
map entry is indeed the cause. (I am almost certain that
it is, but I still can't explain it.)
Updates golang/go#69362
Change-Id: I0469e285bda65c21e80a348af04ea0e69f6a31c0
Reviewed-on: https://go-review.googlesource.com/c/tools/+/627015
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Gopls loops over all the function and find the ones qualifies based
on its signature.
- When a qualifying constructor is found, the test skeleton uses the
constructor to initialize the receiver and call the method.
- When no constructor is found, gopls generates a test skeleton with
a variable declaration using the receiver type (e.g., "var t T") and
includes a TODO comment to remind users to implement receiver variable
initialization.
For golang/vscode-go#1594
Change-Id: I2a703bbd099f03fd1bf85e516f86484805b4a0ae
Reviewed-on: https://go-review.googlesource.com/c/tools/+/620696
Auto-Submit: Hongxiang Jiang <hxjiang@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Previously there were two competing mechanisms for annotating
identifiers: the syntactic traversal and type information.
This meant that identifiers in different grammatical places
were annotated differently.
This change annotates identifiers using type information exclusively.
In addition to making things consistent, it also means that
types are reported independently (using modifiers) to symbol kind,
so, for example, a "var x func()" is a Variable with modifier
Signature, indicating that its type is a function.
Also, the rules for "defaultLibrary", "readonly", and so on
are more simply and consistently enforced.
The "deprecated" modifier is however lost as a consequence,
as it relied on the syntax.
+ Tests for both issues.
Also, use an enum for all the Modifiers.
Also, document the complete current set of token types
and modifiers that gopls returns.
Fixesgolang/go#66809Fixesgolang/go#70251
Change-Id: I15e59d10f5a9269bc6be87f30e3502a9054d88e7
Reviewed-on: https://go-review.googlesource.com/c/tools/+/626279
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Peter Weinberger <pjw@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
We were on 3.17.6-next.2. This CL brings us up to next.9.
Aside from extending the Client and Server types, the change is
backwards compatible. There are additional fields in
ApplyWorkspaceEditParams, CodeLensClientCapabilities,
DiagnosticClientCapabilities, WorkspaceClientCapabilities,
WorkspaceOptions.
There are new types
ClientCodeLensResolveOptions, DiagnosticCapabilities,
SnippetTextEdit, TextDocumentContentClientCapabilities,
TextDocumentContentOptions, TextDocumentContentParams,
TextDocumentContentRefreshParams,TextDocumentContentRegistrationOptions,
WorkspaceEditMetadata.
There is a new SemanticTokenType "label" (LabelType).
Change-Id: I1a7c79252d4726ab4d95bca6c1244a02a7bb62da
Reviewed-on: https://go-review.googlesource.com/c/tools/+/626095
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Findley <rfindley@google.com>
For the transition of vscode go extension users who explicitly trigger
prompting using the command, make the command no-op if the telemetry
prompt setting is already true.
For golang/go#67821
Change-Id: I648c5a8e4449eeb15fb28c71879c967975363a79
Reviewed-on: https://go-review.googlesource.com/c/tools/+/589836
Auto-Submit: Hyang-Ah Hana Kim <hyangah@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Add a new Dir field, and export ForTest, per golang/go#38445. The
needInternalForTest mode bit is promoted to NeedForTest, but no mode bit
is added for Dir as it is logically related to NeedFiles.
A test is added for the new fields using a simpler txtar-based setup,
since I did not have time to page in the quite heavyweight packagestest
framework.
For golang/go#38445
Change-Id: I92026462f7ed7e237db1f4e50a3bbf2936802fbb
Reviewed-on: https://go-review.googlesource.com/c/tools/+/626495
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Simplify the API of ComputeOneImportFixEdits (renamed to
ComputeImportFixEdits), so that it can be used in more scenarios.
Change-Id: I4c4adb5f38947074dfb005e0c745d1a623bd3fd8
Reviewed-on: https://go-review.googlesource.com/c/tools/+/626280
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Hongxiang Jiang <hxjiang@golang.org>
Auto-Submit: Robert Findley <rfindley@google.com>
When hovering over a package name in a package declaration, show
language version and GODEBUG values that differ from the toolchain
default. Also, for consistency with other hover content, show the
package declaration as the 'signature' of both a package name and an
import.
Finally, to help differentiate this information, introduce hlines in
the hover output between logical sections. This is similar to what is
done by other LSP servers such as tsserver.
Fixesgolang/go#68900
Change-Id: I5013bb9fb4086c71cc3565fd67993764cad69237
Reviewed-on: https://go-review.googlesource.com/c/tools/+/626276
Reviewed-by: Alan Donovan <adonovan@google.com>
Auto-Submit: Robert Findley <rfindley@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Change-Id: I691a03d5d48bee2a38a074d623c192cbb7ff3bd6
Reviewed-on: https://go-review.googlesource.com/c/tools/+/626415
Auto-Submit: Alan Donovan <adonovan@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
It's possible that we may encounter the path inconsistency of
golang/go#67288 due to unclean or relative paths. Guard against this
with a new bug report.
For golang/go#67288
Change-Id: I37ac1f74334bcb9e955d75e436f74398c73f0acb
Reviewed-on: https://go-review.googlesource.com/c/tools/+/626015
Reviewed-by: Alan Donovan <adonovan@google.com>
Auto-Submit: Robert Findley <rfindley@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Avoid assigning end positions to type errors that are within the current
token (such as could happen in an import path). To test this, introduce
our first named argument in the marker tests: 'exact' for the @diag
marker.
Also, attempt to document the heuristic of TypeErrorEndPos.
Fixesgolang/go#69505
Change-Id: If3cf82f241dd354d834a7dcbf24b7b3c59246911
Reviewed-on: https://go-review.googlesource.com/c/tools/+/625916
Auto-Submit: Robert Findley <rfindley@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
The only remaining uses of go/expect are from packagestest.
Updates golang/go#70229
Change-Id: I5a8c835b761381747fbd3f936d261ed773b536e3
Reviewed-on: https://go-review.googlesource.com/c/tools/+/625919
Auto-Submit: Alan Donovan <adonovan@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
In CL 625496, countertest.ReadCounter was updated to read using mmap,
avoiding filesystem races that are causing flaky gopls tests.
Fixesgolang/go#68659Fixesgolang/go#69132
Change-Id: I4a7a5b50a784f35a911e346a988966fb79dcf279
Reviewed-on: https://go-review.googlesource.com/c/tools/+/625915
Auto-Submit: Robert Findley <rfindley@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
This change makes it such that tests must set GOPLS_CONFIG_DIR if they
want to exercise behavior related to the telemetry prompt. Tests should
not interact with os.UserConfigDir.
Change-Id: I9f6dfdea2408f75085855a82fc50fad20cda82e3
Reviewed-on: https://go-review.googlesource.com/c/tools/+/625795
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Auto-Submit: Robert Findley <rfindley@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
With GO111MODULE=on in the test environment, the GOPATH subtest of
TestZeroConfigAlgorithm was failing, since GO111MODULE=on invalidated
our detection of a GOPATH workspace. Fix the test environment.
Fixesgolang/go#70196
Change-Id: Ia80a5a63d93842aef4b67ca419e1d27eb11573c9
Reviewed-on: https://go-review.googlesource.com/c/tools/+/625515
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Hongxiang Jiang <hxjiang@golang.org>
Test case names displayed in subtest names instead of test
failure messages.
For golang/vscode-go#1594
Change-Id: Iab207cd9af0af99a036dc69a8b2230f12bf876fb
Reviewed-on: https://go-review.googlesource.com/c/tools/+/621816
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Findley <rfindley@google.com>
This commit improves the handling of test cases for functions
that return an error as their last return value.
- A boolean field called "wantErr" is added to the test case
struct to indicate whether an error is expected.
- The error return value is now handled before comparing other
return values, ensuring correct error handling in test cases.
For golang/vscode-go#1594
Change-Id: Ib48f6b85b2fdad96cb7fb563b8bdbf17d692f569
Reviewed-on: https://go-review.googlesource.com/c/tools/+/623997
Reviewed-by: Robert Findley <rfindley@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Add an additional log message to help diagnose the problem encountered
by a user in golang/go#70196.
For golang/go#70196
Change-Id: I8347d842d5a9327fa6797229bf64dc4407f7aa61
Reviewed-on: https://go-review.googlesource.com/c/tools/+/625415
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Hongxiang Jiang <hxjiang@golang.org>
Auto-Submit: Robert Findley <rfindley@google.com>
This commit improves qualifier by consolidating imports from both the
main file (x.go) and its corresponding test file (x_test.go).
An imports map is used to track all import paths and their local
renames. Imports from x_test.go are prioritized over x.go as gopls
is generating test in x_test.go.
This ensures that the generated qualifier correctly reflects any
necessary renames, improving accuracy and consistency.
For golang/vscode-go#1594
Change-Id: I457d5f22f7de4fe86006b57487f243494c8e7f6f
Reviewed-on: https://go-review.googlesource.com/c/tools/+/622320
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Auto-Submit: Hongxiang Jiang <hxjiang@golang.org>