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/imports: upper-cased import paths not being selected as candidates #16402
Comments
Sorry, I'm finding it hard to understand this bug report. It contains a lot of unit test code (and using the old goimports test style, which has a lot of boilerplate) and this:
What is "correctly"?
Well, your Can you just explain it without code, or update the code to use |
Also, you write:
If that's a separate unrelated bug, please file a separate bug. It's easier to track two bugs separately so they can be closed independently. |
Updated. |
Thanks. That's much better & I now understand. Normally we don't edit comments, but in this case it makes sense. If you have any future comments, please amend this thread rather than edits, though. I now also see why a directory named "go-foo" might contain "gofoo" and how that comment is related to this issue. We can address both with this bug. |
CL https://golang.org/cl/25030 mentions this issue. |
I just noticed that import paths that start with an uppercase letter don't get imported automatically after the update.
Looking at the code and https://github.com/golang/tools/blob/master/imports/fix.go#L651,
I tried to change the behavior, using strings.ToLower on
lastTwoComponents
and the package gets imported automatically.go version
)?1.6.2
go env
)?Wrote a simple test to make goimports find an import path with an uppercase letter
What did you expect to see?
Test passing and two candidates for
TestFindUpperCasedImportGoPath
.What did you see instead?
Test failed (output below) and only 1 candidate for
TestFindUpperCasedImportGoPath
.The text was updated successfully, but these errors were encountered: