mirror of
https://github.com/golang/go
synced 2024-11-05 17:26:11 -07:00
go/gcexportdata: use IExportData when writing gcexportdata
Updates golang/go#28260 Change-Id: Id0ef98e1599fbef4dd67ba23c20ddb8bc4d33228 Reviewed-on: https://go-review.googlesource.com/c/tools/+/198742 Run-TryBot: Rebecca Stambler <rstambler@golang.org> Reviewed-by: Robert Griesemer <gri@golang.org>
This commit is contained in:
parent
9901302c21
commit
246a69f4f1
@ -100,7 +100,7 @@ func Read(in io.Reader, fset *token.FileSet, imports map[string]*types.Package,
|
||||
// Write writes encoded type information for the specified package to out.
|
||||
// The FileSet provides file position information for named objects.
|
||||
func Write(out io.Writer, fset *token.FileSet, pkg *types.Package) error {
|
||||
b, err := gcimporter.BExportData(fset, pkg)
|
||||
b, err := gcimporter.IExportData(fset, pkg)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -143,12 +143,20 @@ func IImportData(fset *token.FileSet, imports map[string]*types.Package, data []
|
||||
p.pkgIndex[pkg] = nameIndex
|
||||
pkgList[i] = pkg
|
||||
}
|
||||
if len(pkgList) == 0 {
|
||||
errorf("no packages found for %s", path)
|
||||
panic("unreachable")
|
||||
}
|
||||
var localpkg *types.Package
|
||||
for _, pkg := range pkgList {
|
||||
if pkg.Path() == path {
|
||||
localpkg = pkg
|
||||
break
|
||||
}
|
||||
}
|
||||
if localpkg == nil {
|
||||
localpkg = pkgList[0]
|
||||
}
|
||||
|
||||
names := make([]string, 0, len(p.pkgIndex[localpkg]))
|
||||
for name := range p.pkgIndex[localpkg] {
|
||||
|
Loading…
Reference in New Issue
Block a user