srcimporter
packagestandard libraryThis package is not in the latest version of its module.
Details
Validgo.mod file
The Go module system was introduced in Go 1.11 and is the official dependency management solution for Go.
Redistributable license
Redistributable licenses place minimal restrictions on how software can be used, modified, and redistributed.
Tagged version
Modules with tagged versions give importers more predictable builds.
Stable version
When a project reaches major version v1 it is considered stable.
- Learn more about best practices
Repository
Links
Documentation¶
Overview¶
Package srcimporter implements importing directlyfrom source files rather than installed packages.
Index¶
Constants¶
This section is empty.
Variables¶
This section is empty.
Functions¶
This section is empty.
Types¶
typeImporter¶
type Importer struct {// contains filtered or unexported fields}An Importer provides the context for importing packages from source code.
funcNew¶
New returns a new Importer for the given context, file set, and mapof packages. The context is used to resolve import paths to package paths,and identifying the files belonging to the package. If the context providesnon-nil file system functions, they are used instead of the regular packageos functions. The file set is used to track position information of packagefiles; and imported packages are added to the packages map.
func (*Importer)ImportFrom¶
ImportFrom imports the package with the given import path resolved from the given srcDir,adds the new package to the set of packages maintained by the importer, and returns thepackage. Package path resolution and file system operations are controlled by the contextmaintained with the importer. The import mode must be zero but is otherwise ignored.Packages that are not comprised entirely of pure Go files may fail to import because thetype checker may not be able to determine all exported entities (e.g. due to cgo dependencies).