Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Cache ¶ added in v1.15.2
type Cache interface {
Find(dir, pkgPath string) (f io.ReadCloser, err error)
}
Cache represents a cache for the importer.
type Importer ¶
type Importer struct {
// contains filtered or unexported fields
}
Importer represents a Go package importer.
func NewImporter ¶
NewImporter creates an Importer object that meets types.ImporterFrom and types.Importer interface.
func (*Importer) ImportFrom ¶
ImportFrom returns the imported package for the given import path when imported by a package file located in dir. If the import failed, besides returning an error, ImportFrom is encouraged to cache and return a package anyway, if one was created. This will reduce package inconsistencies and follow-on type checker errors due to the missing package. The mode value must be 0; it is reserved for future use. Two calls to ImportFrom with the same path and dir must return the same package.