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 exclude GOPATH-depended import if `vendor/` is available #23148

Open
timakin opened this issue Dec 15, 2017 · 1 comment

Comments

@timakin
Copy link
Contributor

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

This comment has been minimized.

Copy link
Contributor Author

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 label Sep 12, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.