[tools] gopls/internal/mcp: fix reporting in go_diagnostics tool

0 views
Skip to first unread message

Madeline Kalil (Gerrit)

unread,
Jun 8, 2026, 2:55:00 PM (2 days ago) Jun 8
to goph...@pubsubhelper.golang.org, golang-...@googlegroups.com, Alan Donovan, golang...@luci-project-accounts.iam.gserviceaccount.com, Hongxiang Jiang, golang-co...@googlegroups.com

Madeline Kalil submitted the change

Change information

Commit message:
gopls/internal/mcp: fix reporting in go_diagnostics tool

The go_diagnostics tool reports parse and build errors
across the entire workspace. If an array of files
is provided, it reports additional diagnostics (i.e. quick
fixes and go/analysis findings).

The additional diagnostic reporting is broken when
the tool input has more than one file because we
always use the uri of the first file in the input array.
If the input is ["a.go", "b.go"], diagnostics for "b.go"
are reported as coming from "a.go".

Use the correct uri for the diagnostic and add
tests to verify that diagnostics are reported
with the correct file.

Fixes golang/go#79892
Change-Id: I76c506377cdf05ed0e86a799c00085f286701923
Reviewed-by: Alan Donovan <adon...@google.com>
Files:
  • M gopls/internal/mcp/workspace_diagnostics.go
  • M gopls/internal/test/marker/testdata/mcptools/workspace_diagnostics.txt
Change size: S
Delta: 2 files changed, 38 insertions(+), 4 deletions(-)
Branch: refs/heads/master
Submit Requirements:
Open in Gerrit
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: merged
Gerrit-Project: tools
Gerrit-Branch: master
Gerrit-Change-Id: I76c506377cdf05ed0e86a799c00085f286701923
Gerrit-Change-Number: 788180
Gerrit-PatchSet: 2
Gerrit-Owner: Madeline Kalil <mka...@google.com>
Gerrit-Reviewer: Alan Donovan <adon...@google.com>
Gerrit-Reviewer: Hongxiang Jiang <hxj...@golang.org>
Gerrit-Reviewer: Madeline Kalil <mka...@google.com>
open
diffy
satisfied_requirement
Reply all
Reply to author
Forward
0 new messages