Skip to content

x/tools/cmd/goimports: prioritize closer package #17557

@henryas

Description

@henryas

Please answer these questions before submitting your issue. Thanks!

What version of Go are you using (go version)?

Go version 1.7.3

What operating system and processor architecture are you using (go env)?

Windows 10 Home 64-bit, with Sublime Text IDE (with GoSublime)

What did you do?

Had different projects, each containing a package with the same name, and then in one of the projects, created a go file that used of one of the packages and called goimports to suggest an import line.

What did you expect to see?

I was hoping to see goimports suggesting an import line that is closer to the current file. In this case, it should suggest the package in the current project.

Or if there are multiple packages with the same name within the same project, it should suggest an import line that is closer to the current file.

What did you see instead?

Goimports currently suggests a random import line for packages with the same name, which is often inaccurate at times. It often suggests a same-name package from different projects, which is irrelevant.

If goimports can understand which import line is closer, it will appear to better understand the context of the package being imported and act more intelligently.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions