extension/test/gopls: fix test after go1.27 upgrade golangci-lint v2 with the previously pinned version does not work with the go1.27.0. Replaced the pinned version with latest. Before 1.27 (e.g. go1.26.6): > go1.26.6 list "" example.com/mod1 After 1.27 (e.g. go1.27.0): > go1.27.0 list "" go: invalid package: "" The test failure: - the vscode-go test executes the gopls command with customized arguments with "pattern" set to empty. - the gopls receives the command execution request and execute the command with "pattern" set to empty. - the emtpy pattern is no longer allowed in go1.27. In production, the vscode-go will execute the gopls command with arguments prepared by the gopls "./...". So no production impact. See: https://go.googlesource.com/tools/+/refs/heads/master/gopls/internal/mod/code_lens.go#196 TODO, vscode-go should avoid execute gopls command with customized arguments. Instead, call code lens provider and execute the command embedded inside the codelens returned from the gopls. Updates golang/go#37300 Change-Id: Ib47762a50f576418359ec8029e2a793bd5f369a1 Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/818780 LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
diff --git a/extension/test/gopls/vulncheck.test.ts b/extension/test/gopls/vulncheck.test.ts index 773b0b0..40a3654 100644 --- a/extension/test/gopls/vulncheck.test.ts +++ b/extension/test/gopls/vulncheck.test.ts
@@ -95,18 +95,24 @@ assert(output.toString().includes('No vulnerabilities found')); }); + // TODO(hxjiang): avoid execute the command directly through the language + // client. Call code lens provider instead. async function testRunGovulncheck(workspaceDir: string, command: string) { const languageClient = env.languageClient!; const document = await vscode.workspace.openTextDocument(vscode.Uri.file(path.join(workspaceDir, 'go.mod'))); const uri = languageClient.code2ProtocolConverter.asTextDocumentIdentifier(document).uri; - languageClient.middleware!.executeCommand!(command, [{ URI: uri }], async (cmd: string, args: any[]) => { - const params: ExecuteCommandParams = { - command: cmd, - arguments: args - }; - return await languageClient?.sendRequest(ExecuteCommandRequest.type, params); - }); + languageClient.middleware!.executeCommand!( + command, + [{ URI: uri, Pattern: './...' }], + async (cmd: string, args: any[]) => { + const params: ExecuteCommandParams = { + command: cmd, + arguments: args + }; + return await languageClient?.sendRequest(ExecuteCommandRequest.type, params); + } + ); const msg = 'vulnerabilities found'; const timeoutMS = 10000; await new Promise<void>((resolve, reject) => {
diff --git a/extension/tools/installtools/main.go b/extension/tools/installtools/main.go index 74ea77f..3ee2834 100644 --- a/extension/tools/installtools/main.go +++ b/extension/tools/installtools/main.go
@@ -36,7 +36,7 @@ {"github.com/haya14busa/goplay/cmd/goplay", "", false, ""}, {"honnef.co/go/tools/cmd/staticcheck", "", false, ""}, // For regression test: golang/vscode-go#3511 - {"github.com/golangci/golangci-lint/v2/cmd/golangci-lint", "golangci-lint-v2", false, "v2.12.2"}, + {"github.com/golangci/golangci-lint/v2/cmd/golangci-lint", "golangci-lint-v2", false, ""}, {"github.com/go-delve/delve/cmd/dlv", "", false, ""}, // TODO(hxjiang): remove from test after deprecate the "impl". {"github.com/josharian/impl", "", false, "v1.5.0"},