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: signal version differences in go.mod when using go.work #57026

Closed
hyangah opened this issue Dec 1, 2022 · 3 comments
Closed
Assignees
Labels
FeatureRequest FrozenDueToAge gopls Issues related to the Go language server, gopls. modules NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made.
Milestone

Comments

@hyangah
Copy link
Contributor

hyangah commented Dec 1, 2022

go.mod is not a lock file and go's module version selection may pick versions different from what are written in go.mod require statement. But most of time, we expect the versions appearing in go.mod are the versions actually in use. Especially, when using go.work or replace or exclude come into play, the difference can be sometimes confusing.

How about surfacing this when the versions chosen by Go and written in the main module's go.mod are different?
Either using 1) inlay hints next to the require statement or 2) informational diagnostics on the require statement.

cc ideas from @ianthehat

@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 1, 2022
@gopherbot gopherbot added this to the Unreleased milestone Dec 1, 2022
@hyangah hyangah added FeatureRequest and removed gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository. labels Dec 1, 2022
@toothrot toothrot added the NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made. label Dec 1, 2022
@findleyr findleyr added the gopls Issues related to the Go language server, gopls. label Dec 6, 2022
@findleyr
Copy link
Contributor

findleyr commented Dec 6, 2022

Makes sense to me.

CC @bcmills, who may have insight.

@findleyr
Copy link
Contributor

Peter and I just discussed this, and realized it would be useful to compute this information whenever we build the metadata graph (cache.metadataGraph.build). Then adding an inlay hint becomes a very cheap operation.

@gopherbot
Copy link
Contributor

Change https://go.dev/cl/466976 mentions this issue: gopls/mod: warn when a different module version is used.

@golang golang locked and limited conversation to collaborators Mar 15, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FeatureRequest FrozenDueToAge gopls Issues related to the Go language server, gopls. modules NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made.
Projects
None yet
Development

No branches or pull requests

6 participants