cmd/compile: use types2.Unsafe to represent package unsafe in gcimports

Followup todo in CL 346769.

Change-Id: I6c870014523426d65d135da999f97a818a997237
Reviewed-on: https://go-review.googlesource.com/c/go/+/347270
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
This commit is contained in:
Cuong Manh Le 2021-09-02 10:42:43 +07:00
parent 9afbf82667
commit 3db4888a05
2 changed files with 1 additions and 5 deletions

View file

@ -35,7 +35,7 @@ func checkFiles(noders []*noder) (posMap, *types2.Package, *types2.Info) {
// typechecking
importer := gcimports{
packages: make(map[string]*types2.Package),
packages: map[string]*types2.Package{"unsafe": types2.Unsafe},
}
conf := types2.Config{
GoVersion: base.Flag.Lang,

View file

@ -147,10 +147,6 @@ func (r *reader2) doPkg() *types2.Package {
if path == "builtin" {
return nil // universe
}
if path == "unsafe" {
// TODO(mdempsky): This should be in r.p.imports.
return types2.Unsafe
}
if path == "" {
path = r.p.pkgPath
}