-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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
cmd/compile: "dot import" causes confusing error in 1.6 #14683
Comments
|
We actually have tests in |
@rsc In light of the explicit test to make sure this works, do we still want to continue to treat this as an error? @ianlancetaylor If we have explicit tests for this, why are they not failing? |
@quentinmit it works when you use (edit: corrected |
To be pedantically clear, it also works with |
All right, well if there are tests that it should work, then I guess it can stay. The error message here is not critical for Go 1.7. |
The error message is now different at Go tip (as of 992ce90):
But still not critical. |
Change https://golang.org/cl/174130 mentions this issue: |
go version
)?1.6
go env
)?amd64 all around. Reproduced identical output in both Ubuntu (well, mint) and OSX 10.11.
@davecheney and I have already had a bit of a back and forth on this already on golang-nuts (I'll avoid actually requiring anyone to read this, but for attribution sake it's here). It seems if I replace the dot import in the test file (
badlink_test.go
):with a full import:
It fixes it. However the dot import did (and still does) work in 1.5.3.
Dave thinks the dot import should be a compiler error. I agree. However I'm a bit confused as to the state of relative imports in go. I held they were a deliberate omission, but there's mention of limited support which I don't know the details of. And again, this does work in 1.5.3, so unless I screwed something else up (repeatedly, on different machines) this is a regression.
Possibly related?:
#14609
For the record, I don't generally like relative imports, but saw the dot import in tests at a talk and thought that it seemed like a nice exception. A way for a
_test
package to say "I'm testing myself". But I'd be happy if this was just a more clear error.The text was updated successfully, but these errors were encountered: