-
Notifications
You must be signed in to change notification settings - Fork 18k
x/tools/cmd/goimports: unnecessary rename of imports #29556
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
Comments
This was was intentional. See #28428 and https://go-review.googlesource.com/c/152000 Closing, but feel free to reopen one of these bugs if you strongly disagree. |
Yeah. goimports only understands SIV-style /vN suffixes and adds names to everything it finds surprising. It could be taught the gopkg.in convention, I suppose, but I'd like to have a coherent policy about what it should and shouldn't understand, per the discussion in #28428 (comment). |
Hm. I'd forgotten that gopkg.in is already specially handled by the go command.
That's some justification to support it in goimports, I suppose. |
As @heschik pointed out, gopkg.in is a known special case in the go command, so I agree that it should be a known special case here. It doesn't make sense to penalize gopkg.in users by renaming all their imports unnecessarily. |
Change https://golang.org/cl/157357 mentions this issue: |
A pacakge name cannot contain a . anyway, so this is a mostly likely internal package name in the presence of a . in the import path. This stops goimports from adding a local alias in places where it is not needed, for instance in gopkg.in conventions. Fixes golang/go#29556 Change-Id: I0ab11f2852d7f1dae14457995692760077201c8e
A pacakge name cannot contain a . anyway, so this is a mostly likely internal package name in the presence of a . in the import path. This stops goimports from adding a local alias in places where it is not needed, for instance in gopkg.in conventions. Fixes golang/go#29556 Change-Id: I0ab11f2852d7f1dae14457995692760077201c8e
In GOPATH mode:
Why did goimports rename this import? It should not be doing that. The package clause in the package already says blackfriday, and furthermore the package name follows the standard import path rules for package names on gopkg.in.
/cc @heschik @bradfitz
The text was updated successfully, but these errors were encountered: