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: organizeImports is non-deterministic #59976

Closed
findleyr opened this issue May 4, 2023 · 2 comments
Closed

x/tools/gopls: organizeImports is non-deterministic #59976

findleyr opened this issue May 4, 2023 · 2 comments
Assignees
Labels
gopls Issues related to the Go language server, gopls. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@findleyr
Copy link
Contributor

findleyr commented May 4, 2023

Discovered while porting the marker tests: organizeImports is non-deterministic in its manipulation of the AST. For example, consider the following program:

package p

import (
   "fmt" // a
   "bytes" // b
)

When removing the import block, organizeImports leaves behind exactly one of the a, b, comments, but non-deterministically.

@findleyr findleyr added this to the gopls/v0.13.0 milestone May 4, 2023
@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 4, 2023
@gopherbot
Copy link

Change https://go.dev/cl/492675 mentions this issue: gopls: port import tests to the new marker framework

gopherbot pushed a commit to golang/tools that referenced this issue May 4, 2023
Port all the import tests by reusing the "codeaction" marker, with the
exception of one which was flaky due to golang/go#59976.

Updates golang/go#54845

Change-Id: I60688ba0bbc6f5c17018d304748555f3951d0556
Reviewed-on: https://go-review.googlesource.com/c/tools/+/492675
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Robert Findley <rfindley@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
@adonovan adonovan assigned adonovan and findleyr and unassigned adonovan May 4, 2023
@adonovan adonovan added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label May 4, 2023
@findleyr findleyr modified the milestones: gopls/v0.13.0, gopls/v0.12.0 May 4, 2023
@gopherbot
Copy link

Change https://go.dev/cl/492738 mentions this issue: internal/imports: sort fixes for deterministic results

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. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. 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