[tools] gopls/mod: find references to required modules

0 views
Skip to first unread message

Peter Weinberger (Gerrit)

unread,
Dec 22, 2025, 10:49:18 AM (24 hours ago) Dec 22
to goph...@pubsubhelper.golang.org, golang-...@googlegroups.com, Alan Donovan, Go LUCI, antonio vereecken, Robert Findley, golang-co...@googlegroups.com

Peter Weinberger submitted the change

Change information

Commit message:
gopls/mod: find references to required modules

With this CL, users will be able to click on a required module in a
go.mod file, and see the import statements that reference its
packages.

In addition to integrating with LSP clients, this code avoids
reporting imports of nested modules.

Testing: there are marker tests, but self-contained. A lot
of natural uses will be to find modules from the module cache.
I tested by hand getting references from a go.mod file in
the tools repository. For instance, when searching for references to
golang/x/tools in gopls/go.mod, for marker_test.go it finds
the 8 imports of packages in golang.org/x/tools,
but none of the many golang.go/x/tools/gopls imports.

Fixes golang/go#75810
Change-Id: I08022dd29173a6d4ea8c728c7eb8e54a462a5889
Reviewed-by: Alan Donovan <adon...@google.com>
Files:
  • M gopls/doc/features/navigation.md
  • M gopls/doc/release/v0.22.0.md
  • M gopls/internal/cache/mod.go
  • A gopls/internal/mod/references.go
  • M gopls/internal/server/references.go
  • A gopls/internal/test/marker/testdata/references/issue75810.txt
  • A gopls/internal/test/marker/testdata/references/issue75810A.txt
Change size: L
Delta: 7 files changed, 275 insertions(+), 1 deletion(-)
Branch: refs/heads/master
Submit Requirements:
  • requirement satisfiedCode-Review: +2 by Alan Donovan
  • requirement satisfiedTryBots-Pass: LUCI-TryBot-Result+1 by Go LUCI
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: I08022dd29173a6d4ea8c728c7eb8e54a462a5889
Gerrit-Change-Number: 713160
Gerrit-PatchSet: 29
Gerrit-Owner: Peter Weinberger <p...@google.com>
Gerrit-Reviewer: Alan Donovan <adon...@google.com>
Gerrit-Reviewer: Peter Weinberger <p...@google.com>
Gerrit-Reviewer: antonio vereecken <antoniov...@gmail.com>
Gerrit-CC: Robert Findley <rfin...@golang.org>
open
diffy
satisfied_requirement
Reply all
Reply to author
Forward
0 new messages