Skip to content

x/tools/cmd/goimports: prefer rand/v2 where applicable #66407

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
findleyr opened this issue Mar 19, 2024 · 1 comment
Closed

x/tools/cmd/goimports: prefer rand/v2 where applicable #66407

findleyr opened this issue Mar 19, 2024 · 1 comment
Assignees
Labels
FrozenDueToAge gopls/imports Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@findleyr
Copy link
Member

cmd/goimports and gopls' goimports integration do not select rand/v2 in the following scenario, resulting in a type error:

package main

import (
	"fmt"
	"math/rand"
)

func main() {
	fmt.Println(rand.Perm())
}

https://go.dev/play/p/pNTZiwDiG8F

This issue is related to #58382 and #41800, where the goimports does not prefer a the latest version of a module. However, goimports treats standard library packages differently, and so this bug will require a separate fix.

@findleyr findleyr added this to the gopls/v0.16.0 milestone Mar 19, 2024
@gopherbot gopherbot added the Tools This label describes issues relating to any tools in the x/tools repository. label Mar 19, 2024
@gopherbot
Copy link
Contributor

Change https://go.dev/cl/573075 mentions this issue: imports: prefer math/rand/v2 over math/rand

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge gopls/imports 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