Skip to content

x/tools/gopls/internal/analysis/simplifyrange: adapt for go1.23 range over func #67239

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

Closed
adonovan opened this issue May 7, 2024 · 5 comments
Assignees
Labels
gopls/analysis Issues related to running analysis in gopls gopls Issues related to the Go language server, gopls. Refactoring Issues related to refactoring tools Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@adonovan
Copy link
Member

adonovan commented May 7, 2024

When it sees for _ = range x { ... }, the simplifyrange analyzer in gopls offers a suggested fix to remove the _ = part. This is not legal in go1.23 if x is a func.

@adonovan adonovan added this to the gopls/v0.16.0 milestone May 7, 2024
@adonovan adonovan added the gopls/analysis Issues related to running analysis in gopls label May 7, 2024
@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 May 7, 2024
@adonovan adonovan added the Refactoring Issues related to refactoring tools label May 8, 2024
@findleyr
Copy link
Member

findleyr commented May 23, 2024

From dupes:

@gopherbot
Copy link
Contributor

Change https://go.dev/cl/588056 mentions this issue: gopls/internal/analysis/simplifyrange: suppress on range-over-func

@adonovan
Copy link
Member Author

adonovan commented Jun 24, 2024

Reopening since the proposal to make them optional again was accepted:

This change is expected to sneak into the go1.23 release candidate, so we can simply revert CL 588056 without worrying about whether the file has go1.23 of go1.24+ semantics.

@adonovan adonovan reopened this Jun 24, 2024
@gopherbot
Copy link
Contributor

Change https://go.dev/cl/594555 mentions this issue: gopls/internal/analysis/simplifyrange: reenable on range-over-func

@gopherbot
Copy link
Contributor

Change https://go.dev/cl/596095 mentions this issue: gopls/internal/analysis/simplifyrange: reenable on range-over-func

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
gopls/analysis Issues related to running analysis in gopls gopls Issues related to the Go language server, gopls. Refactoring Issues related to refactoring tools Tools This label describes issues relating to any tools in the x/tools repository.
Projects
None yet
Development

No branches or pull requests

3 participants