You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
x/tools/gopls: Add a gopls command for resolving targets to locations. #80874
This can be read more about in go.dev/cl/768861 (I'll update this to doc once that cl is submitted).
The basic protocol will look like this:
Parameter types
typeResolveTargetParamsstruct {
// TextDocument identifies the document context (e.g. CWD file or -pos file).TextDocument protocol.TextDocumentIdentifier`json:"textDocument"`// Target is the literal name or regex pattern (enclosed in slashes).Targetstring`json:"target"`// PkgScope optionally overrides the package search scope (from -pkg).PkgScopestring`json:"pkgScope,omitempty"`// Range optionally restricts the search to a specific span within the file.Range*protocol.Range`json:"range,omitempty"`
}
Result types
typeResolveTargetResultstruct {
Matches []TargetMatch`json:"matches"`
}
typeTargetMatchstruct {
Packagestring`json:"package,omitempty"`// Go package pathNamestring`json:"name"`// Symbol name// Location is LSP protocol location because gopls.resolve_target// is an internal utility command to map the target symbol position to// LSP protocol locations.Location protocol.Location`json:"location"`
}
The rules for resolution are a bit trickier and still being ironed out, so will leave the source of truth to be the md file linked above.
Activity
gopherbot commentedon Aug 13, 2026
Change https://go.dev/cl/815160 mentions this issue:
gopls/internal/protocol: Add basic resolve_target gopls commandgopherbot commentedon Sep 15, 2026
Change https://go.dev/cl/817120 mentions this issue:
gopls/internal/resolvetarget: Add relative package paths.gopls/internal/protocol: Add basic resolve_target gopls command
gopherbot commentedon Oct 6, 2026
Change https://go.dev/cl/846025 mentions this issue:
gopls/internal/cmd: Add inspect subcommandgopls/internal/cmd: Add inspect subcommand
gopherbot commentedon Oct 14, 2026
Change https://go.dev/cl/821440 mentions this issue:
gopls/internal/test: allow marker tests at CWD directory