Skip to content

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

@findleyr

Description

@findleyr

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.

Metadata

Metadata

Assignees

Labels

FrozenDueToAgeToolsThis label describes issues relating to any tools in the x/tools repository.gopls/imports

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions