kimporter

package
v0.0.0-...-52b1b20 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 21, 2020 License: MIT Imports: 25 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Builtin

type Builtin struct {
	types.Object
	// contains filtered or unexported fields
}

func (*Builtin) Pos

func (b *Builtin) Pos() token.Pos

type Config

type Config struct {
	PackageSrc map[string][]byte

	SrcMap        map[string][]byte
	CheckFuncs    bool
	CheckImports  bool
	NoConcurrency bool
	Tests         bool

	// TypesInfo specifies what, if any, package info to load
	TypesInfo TypesInfo

	// ImportsTypesInfo speifies whether or not to also load type info for imported packages
	ImportsTypesInfo bool
}

type Importer

type Importer struct {
	// contains filtered or unexported fields
}

func New

func New(mx *mg.Ctx, cfg *Config) *Importer

func (*Importer) Import

func (kp *Importer) Import(path string) (*types.Package, error)

func (*Importer) ImportFrom

func (kp *Importer) ImportFrom(ipath, srcDir string, mode types.ImportMode) (*types.Package, error)

func (*Importer) ImportPackage

func (kp *Importer) ImportPackage(ipath, srcDir string) (*Package, error)

ImportPackage import package with import path ipath relative to srcDir NOTE: All Package fields except the underlying types.Package are optional.

type Package

type Package struct {
	*types.Package

	// Fset is the FileSet used for parsing
	Fset *token.FileSet

	// Info holds type info about the package
	Info *types.Info

	// Package holds type and package info for type-checked imports
	Imports map[string]*Package

	// Files maps the package file tbasenames to their parsed ast files
	Files map[string]*ast.File
}

Package holds type and package info for a type-checked package. NOTE: All fields except the underlying types.Package are optional.

func NewPackage

func NewPackage(pkg *types.Package, fset *token.FileSet, files map[string]*ast.File, info *types.Info, imports map[string]*Package) *Package

NewPackage is equivalent to &Package{Package: pkg, Fset: fset, Types: info, Imports: imports} All arguments except pkg are optional. NewPackage panics if pkg is nil.

func PkgBuiltin

func PkgBuiltin() *Package

func PkgUnsafe

func PkgUnsafe() *Package

type TypesInfo

type TypesInfo uint

TypesInfo specifies what, if any, types.Info to load

const (
	// TypesInfoTypes loads types.Info.Types
	TypesInfoTypes TypesInfo = 1 << iota
	// TypesInfoDefs loads types.Info.Defs
	TypesInfoDefs
	// TypesInfoUses loads types.Info.Uses
	TypesInfoUses
	// TypesInfoImplicits loads types.Info.Implicits
	TypesInfoImplicits
	// TypesInfoSelections loads types.Info.Selections
	TypesInfoSelections
	// TypesInfoScopes loads types.Info.Scopes
	TypesInfoScopes
	// TypesInfoInitOrder loads types.Info.InitOrder
	TypesInfoInitOrder
	// TypesInfoAll loads all types.Info fields
	TypesInfoAll = TypesInfoTypes |
		TypesInfoDefs |
		TypesInfoUses |
		TypesInfoImplicits |
		TypesInfoSelections |
		TypesInfoScopes |
		TypesInfoInitOrder
)

func (TypesInfo) New

func (ti TypesInfo) New() *types.Info

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL