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
Milestone

Comments

@VojtechVitek
Copy link

@VojtechVitek VojtechVitek commented Nov 7, 2018

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 VojtechVitek commented Nov 7, 2018

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

@heschik
Copy link
Contributor

@heschik heschik commented Nov 7, 2018

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

@heschik heschik closed this Nov 7, 2018
@VojtechVitek
Copy link
Author

@VojtechVitek VojtechVitek commented Nov 7, 2018

Thanks for the quick fix!

@requilence
Copy link

@requilence requilence commented Jan 21, 2019

@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

@heschik
Copy link
Contributor

@heschik heschik 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
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.