Skip to content

x/tools/gopls: References does not find all references in the workspace #73781

Open
@zejunlitg

Description

@zejunlitg

What version of Go, VS Code & VS Code Go extension are you using?

go version go1.13.15 linux/amd64

golang.org/x/tools/gopls v0.9.4
    golang.org/x/tools/[email protected] h1:YhHOxVi++ILnY+QnH9FGtRKZZrunSaR7OW8/dCp7bBk=

vscode:
Version: 1.70.2 (Universal)

Version Information
  • Run go version to get version of Go from the VS Code integrated terminal.
  • Run gopls -v version to get version of Gopls from the VS Code integrated terminal.
  • Run code -v or code-insiders -v to get version of VS Code or VS Code Insiders.
  • Check your installed extensions to get the version of the VS Code Go extension
  • Run Ctrl+Shift+P (Cmd+Shift+P on Mac OS) > Go: Locate Configured Go Tools command.

Share the Go related settings you have added/edited

see below

Run Preferences: Open Settings (JSON) command to open your settings.json file.
Share all the settings with the go. or ["go"] or gopls prefixes.

{
    "go.autocompleteUnimportedPackages": true,
    "go.languageServerFlags": [
        
    ],
    "go.useLanguageServer": true,
    "gopls": {
    },
}

Describe the bug

Bug description:
Gopls only finds the references on package level, not on module level.
References in other packages can be found/peeked ONLY AFTER I opened certain package and see the reference,
which is useless, because the point of finding all references is it finds all references for me without needing to open
all the packages.

What I expect:
Find all reference finds all references of a function on a module level, it should search all the packages in this module.

Steps to reproduce the behavior:

Use Find all references all Peek references feature on any function in a Go project using go module mode, this happens.

Screenshots or recordings

N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.ToolsThis label describes issues relating to any tools in the x/tools repository.goplsIssues related to the Go language server, gopls.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions