Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/tools/gopls: consider replace directives in the zero-config algorithm #64888

Closed
findleyr opened this issue Dec 28, 2023 · 2 comments
Closed
Labels
gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@findleyr
Copy link
Contributor

After a little time using the zero-config algorithm (#57979), it has become apparent to me that we should consider replace directives within the workspace.

Specifically, I noticed while navigating around Kubernetes that gopls creates too many unnecessary views for modules in the staging directory.

If a module replaces a directory contained in the workspace, the selectViews algorithm should merge those views.

CC @adonovan @hyangah

@gopherbot gopherbot added Tools This label describes issues relating to any tools in the x/tools repository. gopls Issues related to the Go language server, gopls. labels Dec 28, 2023
@gopherbot gopherbot added this to the Unreleased milestone Dec 28, 2023
@findleyr findleyr modified the milestones: Unreleased, gopls/v0.15.0 Dec 29, 2023
@gopherbot
Copy link
Contributor

Change https://go.dev/cl/562679 mentions this issue: gopls/internal/cache: check views on any on-disk change to go.mod files

@gopherbot
Copy link
Contributor

Change https://go.dev/cl/562680 mentions this issue: gopls/internal/cache: treat local replaces as workspace modules

gopherbot pushed a commit to golang/tools that referenced this issue Feb 9, 2024
To prepare for the follow up change, where we honor local replaces in
the view selection algorithm, treat go.mod files more like go.work files
in a couple places:

- Re-run the view selection algorithm whenever a go.mod file changes on
  disk.
- Use the workspaceModFiles field in the bestView algorithm, rather than
  checking the gomod field directly.

Apart from perhaps running the view selection algorithm more frequently,
this change should have no observable impact.

For golang/go#64888

Change-Id: I9d9a74b876791a77e284a1a1d5fcc7a691199901
Reviewed-on: https://go-review.googlesource.com/c/tools/+/562679
Reviewed-by: Alan Donovan <[email protected]>
LUCI-TryBot-Result: Go LUCI <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository.
Projects
None yet
Development

No branches or pull requests

2 participants