x/playground: goimports removes a needed import #46491
Labels
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
What version of Go are you using (
go version
)?Latest.
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?Playground
What did you do?
Tested in go playground https://play.golang.org/
Playground link: https://play.golang.org/p/Fq83n0Gc2YC
What did you expect to see?
goimports ideally should add the package name before the import as an alias. That was the previous behaviour. Or at least, not remove the import because it will break the code.
What did you see instead?
goimports removes the needed import and breaks the code.
error ./prog.go:4:2: undefined: foo
Related discussion
#29557
The text was updated successfully, but these errors were encountered: