mirror of
https://github.com/golang/go
synced 2024-11-18 10:04:43 -07:00
go/types: don't exclude package unsafe from a Package's Imports list
There's no good reason to exclude it and it only makes the code more complicated and less consistent. Having it in the list provides an easy way to detect if a package uses operations from package unsafe. Change-Id: I2f9b0485db0a680bd82f3b93a350b048db3f7701 Reviewed-on: https://go-review.googlesource.com/37694 Reviewed-by: Alan Donovan <adonovan@google.com>
This commit is contained in:
parent
359ca5ccc8
commit
72359cf840
@ -52,7 +52,7 @@ func (pkg *Package) Complete() bool { return pkg.complete }
|
||||
func (pkg *Package) MarkComplete() { pkg.complete = true }
|
||||
|
||||
// Imports returns the list of packages directly imported by
|
||||
// pkg; the list is in source order. Package unsafe is excluded.
|
||||
// pkg; the list is in source order.
|
||||
//
|
||||
// If pkg was loaded from export data, Imports includes packages that
|
||||
// provide package-level objects referenced by pkg. This may be more or
|
||||
|
@ -215,9 +215,7 @@ func (check *Checker) collectObjects() {
|
||||
// for clients; it is not needed for type-checking)
|
||||
if !pkgImports[imp] {
|
||||
pkgImports[imp] = true
|
||||
if imp != Unsafe {
|
||||
pkg.imports = append(pkg.imports, imp)
|
||||
}
|
||||
pkg.imports = append(pkg.imports, imp)
|
||||
}
|
||||
|
||||
// local name overrides imported package name
|
||||
|
Loading…
Reference in New Issue
Block a user