// NewImporter returns a new instance of the types.Importer interface // that reads type information from export data files written by gc. // The Importer also satisfies types.ImporterFrom. // // Export data files are located using "go build" workspace conventions // and the build.Default context. // // Use this importer instead of go/importer.For("gc", ...) to avoid the // version-skew problems described in the documentation of this package, // or to control the FileSet or access the imports map populated during // package loading. // // Deprecated: Use the higher-level API in golang.org/x/tools/go/packages, // which is more efficient. func NewImporter(fset *token.FileSet, imports map[string]*types.Package) types.ImporterFrom { … } type importer … func (imp importer) Import(importPath string) (*types.Package, error) { … } func (imp importer) ImportFrom(importPath, srcDir string, mode types.ImportMode) (_ *types.Package, err error) { … }