-
Notifications
You must be signed in to change notification settings - Fork 18k
cmd/compile: failure to reject unused dot import #22072
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
@mdempsky am sure you already know but the same applies when we import pretty much any package and have the same symbol matched and used in a struct e.g import . "bytes"
import . "strconv"
import . "net/http"
var _ = struct {
Server int
Reader int
NumError string
}{Reader: 0, NumError: "a", Server: 0} |
@odeke-em Yep. The problem is that when we're noding the The problem with this approach is when we access the named object that's been dot imported, we eagerly mark the import as used, even if it turns out later we didn't need the object. |
@mdempsky aha, turns out that @griesemer had already reported this bug back in September 2013 with #6428. How should we handle the dups? |
Duplicate of #6428. |
cmd/compile accepts this package, but it should be rejected with an error that import "bytes" is unused:
The text was updated successfully, but these errors were encountered: