Skip to content
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

x/tools/cmd/goimports: should not propose imports that are shadowed by vendored copies #23148

Open
timakin opened this issue Dec 15, 2017 · 4 comments
Labels
Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@timakin
Copy link
Contributor

timakin commented Dec 15, 2017

When you format import sections, goimports help us out of kindness.
However, it mistakenly mix GOPATH-depended packages with packages under the vendor directory.

I expect it should exclude GOPATH-depended one from an import section. if I use any vendoring tool.

(It maybe the role of golint, so if you mind, cound you point out?)

@timakin
Copy link
Contributor Author

timakin commented Dec 15, 2017

$ tree $GOPATH
$GOPATH
└── src
    ├── foo
    │   ├── main.go
    │   └── vendor
    │       └── bar
    │           └── bar.go
    ├── bar
    │   └── bar.go
    └── baz
        └── baz.go
# foo/main.go
package main

import (
	"bar"
	"baz" # Should exclude this line cuz it couldn't be found under the `vendor` path.
)

func main() {
	baz.Baz(&bar.Bar{N: 100, S: "bar"})
}

@mvdan mvdan changed the title cmd/goimports: should exclude GOPATH-depended import if vendor/ is available x/tools/cmd/goimports: should exclude GOPATH-depended import if vendor/ is available Dec 15, 2017
@gopherbot gopherbot added this to the Unreleased milestone Dec 15, 2017
@gopherbot gopherbot added the Tools This label describes issues relating to any tools in the x/tools repository. label Sep 12, 2019
@heschi heschi changed the title x/tools/cmd/goimports: should exclude GOPATH-depended import if vendor/ is available x/tools/cmd/goimports: should not propose imports that are shadowed by vendored copies Nov 7, 2019
@heschi
Copy link
Contributor

heschi commented Nov 7, 2019

This seems like a real bug that could be fixed, but won't be an issue in module mode.

@vasilevp
Copy link

There can still be vendor in module mode though

@rulisastra
Copy link

has this been resolved?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Tools This label describes issues relating to any tools in the x/tools repository.
Projects
None yet
Development

No branches or pull requests

5 participants