Imports #
"fmt"
"go/ast"
"go/build"
"go/parser"
"go/token"
"go/types"
"io"
"os"
"os/exec"
"path/filepath"
"strings"
"sync"
_ "unsafe"
"fmt"
"go/ast"
"go/build"
"go/parser"
"go/token"
"go/types"
"io"
"os"
"os/exec"
"path/filepath"
"strings"
"sync"
_ "unsafe"
Importing is a sentinel taking the place in Importer.packages for a package that is in the process of being imported.
var importing types.Package
An Importer provides the context for importing packages from source code.
type Importer struct {
ctxt *build.Context
fset *token.FileSet
sizes types.Sizes
packages map[string]*types.Package
}
Import(path) is a shortcut for ImportFrom(path, ".", 0).
func (p *Importer) Import(path string) (*types.Package, error)
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 the package. Package path resolution and file system operations are controlled by the context maintained 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 the type checker may not be able to determine all exported entities (e.g. due to cgo dependencies).
func (p *Importer) ImportFrom(path string, srcDir string, mode types.ImportMode) (*types.Package, error)
New returns a new Importer for the given context, file set, and map of packages. The context is used to resolve import paths to package paths, and identifying the files belonging to the package. If the context provides non-nil file system functions, they are used instead of the regular package os functions. The file set is used to track position information of package files; and imported packages are added to the packages map.
func New(ctxt *build.Context, fset *token.FileSet, packages map[string]*types.Package) *Importer
func (p *Importer) absPath(path string) (string, error)
func (p *Importer) cgo(bp *build.Package) (*ast.File, error)
func (p *Importer) isAbsPath(path string) bool
func (p *Importer) joinPath(elem ...string) string
func (p *Importer) parseFiles(dir string, filenames []string) ([]*ast.File, error)
go:linkname setUsesCgo go/types.srcimporter_setUsesCgo
func setUsesCgo(conf *types.Config)
Generated with Arrow