-
Notifications
You must be signed in to change notification settings - Fork 18k
cmd/compile: confusing errors when forgetting an import for an anonymous field #27938
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
Indeed. Could use a better error message. Not urgent (ok to postpone if we don't get to it for 1.12). |
I would like to give it a try, if anyone could give me some pointers? |
FWIW, go/types reports: "undeclared name: sync" which seems clearer. @hellozee Not sure if this is a great "starter issue" in the compiler as it seems pretty central to how name lookup works - but I'm just guessing; haven't looked into this yet. But basically 1) you'd have to find which part of the code reports "sync is not a package" and why it's not complaining about sync not being defined instead. And 2) mark the respective node with Broke or SetDiag so that we don't get a 2nd error. |
@griesemer sure |
@griesemer the files in question would be |
@hellozee Yes, but it seems like this issue requires a bit more thought since the problem appears during "noding". It may be possible to avoid this with some restructuring, but that wouldn't be a "starter issue". |
Ohh better to leave it to experts then, thanks for heads up though @griesemer |
Edit: referred to wrong issue in CL by mistake. |
Change https://golang.org/cl/144261 mentions this issue: |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes - checked 1.11.
What operating system and processor architecture are you using (
go env
)?What did you do?
Forget to add an import for an anonymous struct field.
What did you expect to see?
What I see when the field isn't anonymous:
What did you see instead?
A confusing error about
sync
, and a redundant error aboutMutex
:/cc @griesemer
The text was updated successfully, but these errors were encountered: