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

Closed
griesemer opened this issue Oct 20, 2014 · 3 comments
Closed

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

griesemer opened this issue Oct 20, 2014 · 3 comments
Assignees

Comments

@griesemer
Copy link
Contributor

@griesemer griesemer commented Oct 20, 2014

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).
@adonovan
Copy link
Contributor

@adonovan adonovan commented Oct 20, 2014

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
obj.used=true.

Loading

@gopherbot
Copy link

@gopherbot gopherbot commented Oct 22, 2014

Comment 2:

CL https://golang.org/cl/163740043 mentions this issue.

Loading

@griesemer
Copy link
Contributor Author

@griesemer griesemer commented Oct 23, 2014

Comment 3:

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

Status changed to Fixed.

Loading

@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.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants