type go/types.Package
174 uses
go/types (current package)
api.go#L83: Import(path string) (*Package, error)
api.go#L109: ImportFrom(path, dir string, mode ImportMode) (*Package, error)
api.go#L414: func (conf *Config) Check(path string, fset *token.FileSet, files []*ast.File, info *Info) (*Package, error) {
check.go#L102: pkg *Package
check.go#L107: impMap map[importKey]*Package // maps (import path, source directory) to (complete or fake) package
check.go#L118: seenPkgMap map[*Package]bool
check.go#L227: func NewChecker(conf *Config, fset *token.FileSet, pkg *Package, info *Info) *Checker {
check.go#L251: impMap: make(map[importKey]*Package),
errors.go#L29: func (check *Checker) qualifier(pkg *Package) string {
errors.go#L34: check.seenPkgMap = make(map[*Package]bool)
errors.go#L48: func (check *Checker) markImports(pkg *Package) {
eval.go#L24: func Eval(fset *token.FileSet, pkg *Package, pos token.Pos, expr string) (_ TypeAndValue, err error) {
eval.go#L57: func CheckExpr(fset *token.FileSet, pkg *Package, pos token.Pos, expr ast.Expr, info *Info) (err error) {
lookup.go#L44: func LookupFieldOrMethod(T Type, addressable bool, pkg *Package, name string) (obj Object, index []int, indirect bool) {
lookup.go#L89: func lookupFieldOrMethod(T Type, addressable bool, pkg *Package, name string, foldCase bool) (obj Object, index []int, indirect bool) {
lookup.go#L498: func fieldIndex(fields []*Var, pkg *Package, name string) int {
lookup.go#L511: func lookupMethod(methods []*Func, pkg *Package, name string, foldCase bool) (int, *Func) {
methodlist.go#L52: func (l *methodList) Lookup(pkg *Package, name string, foldCase bool) (int, *Func) {
methodset.go#L43: func (s *MethodSet) Lookup(pkg *Package, name string) *Selection {
mono.go#L170: func (w *monoGraph) recordInstance(pkg *Package, pos token.Pos, tparams []*TypeParam, targs []Type, xlist []ast.Expr) {
mono.go#L181: func (w *monoGraph) assign(pkg *Package, pos token.Pos, tpar *TypeParam, targ Type) {
mono.go#L263: func (w *monoGraph) localNamedVertex(pkg *Package, named *Named) int {
named.go#L326: func (n *Named) lookupMethod(pkg *Package, name string, foldCase bool) (int, *Func) {
object.go#L21: Pkg() *Package // package to which this object belongs; nil for labels and objects in the Universe scope
object.go#L52: sameId(pkg *Package, name string) bool
object.go#L63: func Id(pkg *Package, name string) string {
object.go#L85: pkg *Package
object.go#L133: func (obj *object) Pkg() *Package { return obj.pkg }
object.go#L160: func (obj *object) sameId(pkg *Package, name string) bool {
object.go#L186: imported *Package
object.go#L192: func NewPkgName(pos token.Pos, pkg *Package, name string, imported *Package) *PkgName {
object.go#L198: func (obj *PkgName) Imported() *Package { return obj.imported }
object.go#L208: func NewConst(pos token.Pos, pkg *Package, name string, typ Type, val constant.Value) *Const {
object.go#L229: func NewTypeName(pos token.Pos, pkg *Package, name string, typ Type) *TypeName {
object.go#L235: func _NewTypeNameLazy(pos token.Pos, pkg *Package, name string, load func(named *Named) (tparams []*TypeParam, underlying Type, methods []*Func)) *TypeName {
object.go#L289: func NewVar(pos token.Pos, pkg *Package, name string, typ Type) *Var {
object.go#L294: func NewParam(pos token.Pos, pkg *Package, name string, typ Type) *Var {
object.go#L301: func NewField(pos token.Pos, pkg *Package, name string, typ Type, embedded bool) *Var {
object.go#L327: func NewFunc(pos token.Pos, pkg *Package, name string, sig *Signature) *Func {
object.go#L378: func NewLabel(pos token.Pos, pkg *Package, name string) *Label {
object.go#L496: func writePackage(buf *bytes.Buffer, pkg *Package, qf Qualifier) {
package.go#L13: type Package struct {
package.go#L18: imports []*Package
package.go#L25: func NewPackage(path, name string) *Package {
package.go#L27: return &Package{path: path, name: name, scope: scope}
package.go#L31: func (pkg *Package) Path() string { return pkg.path }
package.go#L34: func (pkg *Package) Name() string { return pkg.name }
package.go#L37: func (pkg *Package) SetName(name string) { pkg.name = name }
package.go#L42: func (pkg *Package) Scope() *Scope { return pkg.scope }
package.go#L46: func (pkg *Package) Complete() bool { return pkg.complete }
package.go#L49: func (pkg *Package) MarkComplete() { pkg.complete = true }
package.go#L57: func (pkg *Package) Imports() []*Package { return pkg.imports }
package.go#L61: func (pkg *Package) SetImports(list []*Package) { pkg.imports = list }
package.go#L63: func (pkg *Package) String() string {
resolver.go#L134: func (check *Checker) importPackage(at positioner, path, dir string) *Package {
resolver.go#L219: var pkgImports = make(map[*Package]bool)
scope.go#L279: func (*lazyObject) Pkg() *Package { panic("unreachable") }
scope.go#L291: func (*lazyObject) sameId(pkg *Package, name string) bool { panic("unreachable") }
typeset.go#L59: func (s *_TypeSet) LookupMethod(pkg *Package, name string, foldCase bool) (int, *Func) {
typestring.go#L30: type Qualifier func(*Package) string
typestring.go#L34: func RelativeTo(pkg *Package) Qualifier {
typestring.go#L38: return func(other *Package) string {
universe.go#L21: var Unsafe *Package
version.go#L47: func (check *Checker) allowVersion(pkg *Package, major, minor int) bool {
golang.org/x/exp/apidiff
apidiff.go#L24: func Changes(old, new *types.Package) Report {
apidiff.go#L38: old, new *types.Package
apidiff.go#L50: func newDiffer(old, new *types.Package) *differ {
golang.org/x/tools/go/gcexportdata
gcexportdata.go#L116: func Read(in io.Reader, fset *token.FileSet, imports map[string]*types.Package, path string) (*types.Package, error) {
gcexportdata.go#L156: func Write(out io.Writer, fset *token.FileSet, pkg *types.Package) error {
gcexportdata.go#L173: func ReadBundle(in io.Reader, fset *token.FileSet, imports map[string]*types.Package) ([]*types.Package, error) {
gcexportdata.go#L185: func WriteBundle(out io.Writer, fset *token.FileSet, pkgs []*types.Package) error {
importer.go#L28: func NewImporter(fset *token.FileSet, imports map[string]*types.Package) types.ImporterFrom {
importer.go#L34: imports map[string]*types.Package
importer.go#L37: func (imp importer) Import(importPath string) (*types.Package, error) {
importer.go#L41: func (imp importer) ImportFrom(importPath, srcDir string, mode types.ImportMode) (_ *types.Package, err error) {
golang.org/x/tools/go/packages
packages.go#L347: Types *types.Package
packages.go#L1006: importer := importerFunc(func(path string) (*types.Package, error) {
packages.go#L1092: type importerFunc func(path string) (*types.Package, error)
packages.go#L1094: func (f importerFunc) Import(path string) (*types.Package, error) { return f(path) }
packages.go#L1276: view := make(map[string]*types.Package) // view seen by gcexportdata
golang.org/x/tools/internal/gcimporter
bexport.go#L68: pkgIndex map[*types.Package]int
bexport.go#L92: func BExportData(fset *token.FileSet, pkg *types.Package) (b []byte, err error) {
bexport.go#L109: pkgIndex: make(map[*types.Package]int),
bexport.go#L175: func (p *exporter) pkg(pkg *types.Package, emptypath bool) {
bimport.go#L24: imports map[string]*types.Package
bimport.go#L33: pkgList []*types.Package // in order of appearance
bimport.go#L53: func BImportData(fset *token.FileSet, imports map[string]*types.Package, data []byte, path string) (_ int, pkg *types.Package, err error) {
bimport.go#L160: list := append(([]*types.Package)(nil), p.pkgList[1:]...)
bimport.go#L174: func (p *importer) pkg() *types.Package {
bimport.go#L392: func (p *importer) qualifiedName() (pkg *types.Package, name string) {
bimport.go#L420: func (p *importer) typ(parent *types.Package, tname *types.Named) types.Type {
bimport.go#L606: func (p *importer) fieldList(parent *types.Package) (fields []*types.Var, tags []string) {
bimport.go#L617: func (p *importer) field(parent *types.Package) (*types.Var, string) {
bimport.go#L644: func (p *importer) methodList(parent *types.Package, baseType *types.Named) (methods []*types.Func) {
bimport.go#L654: func (p *importer) method(parent *types.Package, baseType *types.Named) *types.Func {
bimport.go#L671: func (p *importer) fieldName(parent *types.Package) (pkg *types.Package, name string, alias bool) {
bimport.go#L729: var pkg *types.Package
gcimporter.go#L153: func Import(packages map[string]*types.Package, path, srcDir string, lookup func(path string) (io.ReadCloser, error)) (pkg *types.Package, err error) {
gcimporter.go#L261: type byPath []*types.Package
iexport.go#L35: func IExportShallow(fset *token.FileSet, pkg *types.Package) ([]byte, error) {
iexport.go#L43: err := iexportCommon(&out, fset, bundle, shallow, iexportVersion, []*types.Package{pkg})
iexport.go#L50: func IImportShallow(fset *token.FileSet, imports map[string]*types.Package, data []byte, path string, insert InsertType) (*types.Package, error) {
iexport.go#L62: type InsertType = func(pkg *types.Package, name string)
iexport.go#L73: func IExportData(out io.Writer, fset *token.FileSet, pkg *types.Package) error {
iexport.go#L75: return iexportCommon(out, fset, bundle, shallow, iexportVersion, []*types.Package{pkg})
iexport.go#L79: func IExportBundle(out io.Writer, fset *token.FileSet, pkgs []*types.Package) error {
iexport.go#L84: func iexportCommon(out io.Writer, fset *token.FileSet, bundle, shallow bool, version int, pkgs []*types.Package) (err error) {
iexport.go#L102: allPkgs: map[*types.Package]bool{},
iexport.go#L257: pkgObjs := map[*types.Package][]pkgObj{}
iexport.go#L274: var pkgs []*types.Package
iexport.go#L317: localpkg *types.Package // (nil in bundle mode)
iexport.go#L322: allPkgs map[*types.Package]bool
iexport.go#L416: currPkg *types.Package
iexport.go#L422: func (w *exportWriter) exportPath(pkg *types.Package) string {
iexport.go#L660: func (w *exportWriter) pkg(pkg *types.Package) {
iexport.go#L676: func (w *exportWriter) typ(t types.Type, pkg *types.Package) {
iexport.go#L690: func (p *iexporter) typOff(t types.Type, pkg *types.Package) uint64 {
iexport.go#L705: func (w *exportWriter) doTyp(t types.Type, pkg *types.Package) {
iexport.go#L830: func (w *exportWriter) setPkg(pkg *types.Package, write bool) {
iexport.go#L846: func (w *exportWriter) typeList(ts *typeparams.TypeList, pkg *types.Package) {
iexport.go#L853: func (w *exportWriter) tparamList(prefix string, list *typeparams.TypeParamList, pkg *types.Package) {
iimport.go#L59: pkg *types.Package
iimport.go#L87: func IImportData(fset *token.FileSet, imports map[string]*types.Package, data []byte, path string) (int, *types.Package, error) {
iimport.go#L96: func IImportBundle(fset *token.FileSet, imports map[string]*types.Package, data []byte) ([]*types.Package, error) {
iimport.go#L100: func iimportCommon(fset *token.FileSet, imports map[string]*types.Package, data []byte, bundle bool, path string, insert InsertType) (pkgs []*types.Package, err error) {
iimport.go#L168: pkgCache: make(map[uint64]*types.Package),
iimport.go#L171: pkgIndex: make(map[*types.Package]map[string]uint64),
iimport.go#L188: pkgList := make([]*types.Package, r.uint64())
iimport.go#L226: pkgs = make([]*types.Package, r.uint64())
iimport.go#L229: imps := make([]*types.Package, r.uint64())
iimport.go#L244: list := append(([]*types.Package)(nil), pkgList[1:]...)
iimport.go#L292: localpkg *types.Package
iimport.go#L293: insert func(pkg *types.Package, name string) // "shallow" mode only
iimport.go#L300: pkgCache map[uint64]*types.Package
iimport.go#L303: pkgIndex map[*types.Package]map[string]uint64
iimport.go#L325: func (p *iimporter) doDecl(pkg *types.Package, name string) {
iimport.go#L421: func (p *iimporter) pkgAt(off uint64) *types.Package {
iimport.go#L470: currPkg *types.Package
iimport.go#L707: func (r *importReader) qualifiedIdent() (*types.Package, string) {
iimport.go#L771: func (r *importReader) pkg() *types.Package { return r.p.pkgAt(r.uint64()) }
ureader_yes.go#L28: imports map[string]*types.Package // previously imported packages, indexed by path
ureader_yes.go#L33: pkgs []*types.Package
ureader_yes.go#L64: func UImportData(fset *token.FileSet, imports map[string]*types.Package, data []byte, path string) (_ int, pkg *types.Package, err error) {
ureader_yes.go#L83: func readUnifiedPackage(fset *token.FileSet, ctxt *types.Context, imports map[string]*types.Package, input pkgbits.PkgDecoder) *types.Package {
ureader_yes.go#L96: pkgs: make([]*types.Package, input.NumElems(pkgbits.RelocPkg)),
ureader_yes.go#L226: func (r *reader) pkg() *types.Package {
ureader_yes.go#L231: func (pr *pkgReader) pkgIdx(idx pkgbits.Index) *types.Package {
ureader_yes.go#L243: func (r *reader) doPkg() *types.Package {
ureader_yes.go#L263: imports := make([]*types.Package, r.Len())
ureader_yes.go#L274: func flattenImports(pkgs []*types.Package) []*types.Package {
ureader_yes.go#L275: var res []*types.Package
ureader_yes.go#L276: seen := make(map[*types.Package]struct{})
ureader_yes.go#L497: func (pr *pkgReader) objIdx(idx pkgbits.Index) (*types.Package, string) {
ureader_yes.go#L499: var objPkg *types.Package
ureader_yes.go#L720: func (r *reader) qualifiedIdent() (*types.Package, string) { return r.ident(pkgbits.SyncSym) }
ureader_yes.go#L721: func (r *reader) localIdent() (*types.Package, string) { return r.ident(pkgbits.SyncLocalIdent) }
ureader_yes.go#L722: func (r *reader) selector() (*types.Package, string) { return r.ident(pkgbits.SyncSelector) }
ureader_yes.go#L724: func (r *reader) ident(marker pkgbits.SyncMarker) (*types.Package, string) {
ureader_yes.go#L733: func pkgScope(pkg *types.Package) *types.Scope {