Skip to content
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

go/types: dot-imported packages are too aggressively marked as "used" #8969

griesemer opened this issue Oct 20, 2014 · 3 comments


Copy link

1) $ cat a.go b.go
package p

import . "unsafe"

var _ = Pointer(nil)
package p

import . "unsafe"

2) $ gotype a.go b.go
doesn't report an error

3) $ go tool 6g a.go b.go
b.go:3: imported and not used: "unsafe"

Issue: When dot-importing a package, the dot-imported objects are not cloned. But they
are marked when used so that the type-checker can detect that a dot-imported package was
used. Since the objects are shared, once an object from a dot-imported package is used,
that package is used no matter where else it's imported (for instance, it may be shared
via Configuration.Packages in another package).
Copy link

Comment 1:

Related: since the type-checker sets obj.used flags for objects in other packages, it is
not safe to run two instances of the type-checker in parallel as they race calling

Copy link

Comment 2:

CL mentions this issue.

Copy link
Contributor Author

Comment 3:

This issue was closed by revision golang/tools@b10dfb9.

Status changed to Fixed.

@griesemer griesemer self-assigned this Oct 23, 2014
@golang golang locked and limited conversation to collaborators Jun 25, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
None yet

No branches or pull requests

3 participants