Skip to content

x/tools/cmd/goimports: Handle ambiguous import properly #9197

@gopherbot

Description

@gopherbot

by cnyegle:

Before filing a bug, please check whether it has been fixed since the
latest release. Search the issue tracker and check that you're running the
latest version of Go:

Run "go version" and compare against
http://golang.org/doc/devel/release.html  If a newer version of Go exists,
install it and retry what you did to reproduce the problem.

Thanks.

What does 'go version' print?
go version go1.3 linux/amd64

What steps reproduce the problem?
If possible, include a link to a program on play.golang.org.

Run goimports over this code http://play.golang.org/p/u_HSZ6xDLX

What happened?
goimports suggest me to import "html/template"


What should have happened instead?

goimports should suggest "text/template" as well, or add that in a comment
with FIXME: tag.

Please provide any additional information below.

goimports worked very well in the past, so when I find there's some strange escaped
character in my template.Execute result it took me a long time to figure out the reason.

text/template and html/template have same signature for most if not all functions, so
the compiler didn't complain anything.

I'd suggest when modifying/suggesting the imports, the tool put all possible candidates
in comment with FIXME: tag.

Metadata

Metadata

Assignees

No one assigned

    Labels

    NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions