-
Notifications
You must be signed in to change notification settings - Fork 18k
x/tools/cmd/goimports: does not associate package name with import paths containing dashes #17546
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
It's not really Go style to use dashes in package names on disk. That said, this is an easy fix. I guess I'd approve if if somebody sends it, since goimports used to accept it. It was the recent directory pruning speed optimizations which broke it. |
I'll pick this up if nobody else is working on it. |
I hit this bug today with the following two packages:
goimports will remove them and go build fails. If I put them in and use gofmt, go build will work fine. |
@zmb3, I'm guessing you never worked on this? |
Apparently this was already fixed by #16402 @jmrodri, that's not a complete bug report. Got a minimal program to demonstrate it? And does those already exist on disk? And is your GOPATH set? I'm guessing people either need to update their goimports binaries, or the reason that your imports are being deleted is because either your GOPATH is wrong, or you simply don't have the "github.com/foo/go-some-hyphen-package" checked out on disk, so goimports is unable to tell that "go-some-hyphen-package" is really "somehyphenpackage" or whatever, so it deletes it, looking like it's unused. Without a more complete bug report, I'm not sure what to do here. Could somebody reopen this or a new bug report if this is still occurring? I'm guessing it's fixed. |
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?What operating system and processor architecture are you using (
go env
)?What did you do?
What did you expect to see?
I expect nothing to happen because the source code file is properly formatted according to
gofmt -d <package>
. The package also compiles. So the import paths are correct.What did you see instead?
Note that e.g. package
github.com/xh3b4sd/worker-pool
has apackage workerpool
declaration. The same applies to the other packages removed. They all define package declarations where the dash is removed.The text was updated successfully, but these errors were encountered: