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: Goimports removes valid import paths when pkgName != dirName #28646

Closed
VojtechVitek opened this issue Nov 7, 2018 · 5 comments

Comments

@VojtechVitek
Copy link

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

$ go version
go version go1.11.1 darwin/amd64

Does this issue reproduce with the latest release?

go get -u -v golang.org/x/tools/cmd/goimports

As of writing, goimports are on this commit: golang/tools@4ca4995

Regression reproducer

Please, see a reproducer repo: https://github.com/VojtechVitek/goimports-bug

Issue

Seems like latest goimports started removing completely valid import paths when package name doesn't match the pkg's directory name.

@gopherbot gopherbot added this to the Unreleased milestone Nov 7, 2018
@VojtechVitek
Copy link
Author

VojtechVitek commented Nov 7, 2018

Probably a duplicate of #28645, which was submitted while I was writing this down.

@heschi
Copy link
Contributor

heschi commented Nov 7, 2018

Yep, should be fixed now. Sorry for the trouble.

@heschi heschi closed this as completed Nov 7, 2018
@VojtechVitek
Copy link
Author

Thanks for the quick fix!

@requilence
Copy link

@heschik Just to make you know, it is still not fixed at 1.11.4
And I can't find a fix at goimports repo

@heschi
Copy link
Contributor

heschi commented Jan 22, 2019

Most of goimports' code is in x/tools/imports. The bad change was rolled back in golang/tools@a28dfb4. If you're still having problems, please file a new bug with more detail, ideally a repro case.

@golang golang locked and limited conversation to collaborators Jan 22, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants