type go/types.Package
160 uses
go/types (current package)
api.go#L86: Import(path string) (*Package, error)
api.go#L112: ImportFrom(path, dir string, mode ImportMode) (*Package, error)
api.go#L482: func (conf *Config) Check(path string, fset *token.FileSet, files []*ast.File, info *Info) (*Package, error) {
check.go#L158: pkg *Package
check.go#L162: impMap map[importKey]*Package // maps (import path, source directory) to (complete or fake) package
check.go#L174: seenPkgMap map[*Package]bool
check.go#L292: func NewChecker(conf *Config, fset *token.FileSet, pkg *Package, info *Info) *Checker {
check.go#L319: impMap: make(map[importKey]*Package),
eval.go#L24: func Eval(fset *token.FileSet, pkg *Package, pos token.Pos, expr string) (_ TypeAndValue, err error) {
eval.go#L56: func CheckExpr(fset *token.FileSet, pkg *Package, pos token.Pos, expr ast.Expr, info *Info) (err error) {
format.go#L103: func (check *Checker) qualifier(pkg *Package) string {
format.go#L108: check.seenPkgMap = make(map[*Package]bool)
format.go#L122: func (check *Checker) markImports(pkg *Package) {
lookup.go#L44: func LookupFieldOrMethod(T Type, addressable bool, pkg *Package, name string) (obj Object, index []int, indirect bool) {
lookup.go#L53: func lookupFieldOrMethod(T Type, addressable bool, pkg *Package, name string, foldCase bool) (obj Object, index []int, indirect bool) {
lookup.go#L103: func lookupFieldOrMethodImpl(T Type, addressable bool, pkg *Package, name string, foldCase bool) (obj Object, index []int, indirect bool) {
lookup.go#L612: func fieldIndex(fields []*Var, pkg *Package, name string, foldCase bool) int {
lookup.go#L625: func methodIndex(methods []*Func, pkg *Package, name string, foldCase bool) (int, *Func) {
methodset.go#L43: func (s *MethodSet) Lookup(pkg *Package, name string) *Selection {
mono.go#L176: func (w *monoGraph) recordInstance(pkg *Package, pos token.Pos, tparams []*TypeParam, targs []Type, xlist []ast.Expr) {
mono.go#L187: func (w *monoGraph) assign(pkg *Package, pos token.Pos, tpar *TypeParam, targ Type) {
mono.go#L269: func (w *monoGraph) localNamedVertex(pkg *Package, named *Named) int {
named.go#L608: func (n *Named) lookupMethod(pkg *Package, name string, foldCase bool) (int, *Func) {
object.go#L32: Pkg() *Package // package to which this object belongs; nil for labels and objects in the Universe scope
object.go#L66: sameId(pkg *Package, name string, foldCase bool) bool
object.go#L82: func Id(pkg *Package, name string) string {
object.go#L104: pkg *Package
object.go#L152: func (obj *object) Pkg() *Package { return obj.pkg }
object.go#L179: func (obj *object) sameId(pkg *Package, name string, foldCase bool) bool {
object.go#L247: imported *Package
object.go#L252: func NewPkgName(pos token.Pos, pkg *Package, name string, imported *Package) *PkgName {
object.go#L258: func (obj *PkgName) Imported() *Package { return obj.imported }
object.go#L268: func NewConst(pos token.Pos, pkg *Package, name string, typ Type, val constant.Value) *Const {
object.go#L293: func NewTypeName(pos token.Pos, pkg *Package, name string, typ Type) *TypeName {
object.go#L299: func _NewTypeNameLazy(pos token.Pos, pkg *Package, name string, load func(named *Named) (tparams []*TypeParam, underlying Type, methods []*Func)) *TypeName {
object.go#L344: func NewVar(pos token.Pos, pkg *Package, name string, typ Type) *Var {
object.go#L349: func NewParam(pos token.Pos, pkg *Package, name string, typ Type) *Var {
object.go#L356: func NewField(pos token.Pos, pkg *Package, name string, typ Type, embedded bool) *Var {
object.go#L397: func NewFunc(pos token.Pos, pkg *Package, name string, sig *Signature) *Func {
object.go#L457: func (obj *Func) Pkg() *Package { return obj.object.Pkg() }
object.go#L488: func NewLabel(pos token.Pos, pkg *Package, name string) *Label {
object.go#L610: func packagePrefix(pkg *Package, qf Qualifier) string {
package.go#L15: type Package struct {
package.go#L19: imports []*Package
package.go#L28: func NewPackage(path, name string) *Package {
package.go#L30: return &Package{path: path, name: name, scope: scope}
package.go#L34: func (pkg *Package) Path() string { return pkg.path }
package.go#L37: func (pkg *Package) Name() string { return pkg.name }
package.go#L40: func (pkg *Package) SetName(name string) { pkg.name = name }
package.go#L46: func (pkg *Package) GoVersion() string { return pkg.goVersion }
package.go#L52: func (pkg *Package) Scope() *Scope {
package.go#L61: func (pkg *Package) Complete() bool { return pkg.complete }
package.go#L64: func (pkg *Package) MarkComplete() { pkg.complete = true }
package.go#L75: func (pkg *Package) Imports() []*Package { return pkg.imports }
package.go#L79: func (pkg *Package) SetImports(list []*Package) { pkg.imports = list }
package.go#L81: func (pkg *Package) String() string {
predicates.go#L228: func samePkg(a, b *Package) bool {
resolver.go#L136: func (check *Checker) importPackage(at positioner, path, dir string) *Package {
resolver.go#L225: var pkgImports = make(map[*Package]bool)
scope.go#L203: func (*lazyObject) Pkg() *Package { panic("unreachable") }
scope.go#L215: func (*lazyObject) sameId(*Package, string, bool) bool { panic("unreachable") }
typeset.go#L62: func (s *_TypeSet) LookupMethod(pkg *Package, name string, foldCase bool) (int, *Func) {
typestring.go#L31: type Qualifier func(*Package) string
typestring.go#L35: func RelativeTo(pkg *Package) Qualifier {
typestring.go#L39: return func(other *Package) string {
universe.go#L23: var Unsafe *Package
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#L157: func Read(in io.Reader, fset *token.FileSet, imports map[string]*types.Package, path string) (*types.Package, error) {
gcexportdata.go#L205: func Write(out io.Writer, fset *token.FileSet, pkg *types.Package) error {
gcexportdata.go#L222: func ReadBundle(in io.Reader, fset *token.FileSet, imports map[string]*types.Package) ([]*types.Package, error) {
gcexportdata.go#L234: 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#L502: Types *types.Package `json:"-"`
packages.go#L1199: importer := importerFunc(func(path string) (*types.Package, error) {
packages.go#L1312: type importerFunc func(path string) (*types.Package, error)
packages.go#L1314: func (f importerFunc) Import(path string) (*types.Package, error) { return f(path) }
packages.go#L1505: view := make(map[string]*types.Package) // view seen by gcexportdata
golang.org/x/tools/go/types/objectpath
objectpath.go#L579: func Object(pkg *types.Package, p Path) (types.Object, error) {
golang.org/x/tools/go/types/typeutil
imports.go#L15: func Dependencies(pkgs ...*types.Package) []*types.Package {
imports.go#L16: var result []*types.Package
imports.go#L17: seen := make(map[*types.Package]bool)
imports.go#L18: var visit func(pkgs []*types.Package)
imports.go#L19: visit = func(pkgs []*types.Package) {
golang.org/x/tools/internal/aliases
aliases.go#L28: func NewAlias(enabled bool, pos token.Pos, pkg *types.Package, name string, rhs types.Type, tparams []*types.TypeParam) *types.TypeName {
golang.org/x/tools/internal/gcimporter
gcimporter.go#L47: func Import(fset *token.FileSet, packages map[string]*types.Package, path, srcDir string, lookup func(path string) (io.ReadCloser, error)) (pkg *types.Package, err error) {
iexport.go#L279: func IExportShallow(fset *token.FileSet, pkg *types.Package, reportf ReportFunc) ([]byte, error) {
iexport.go#L287: err := iexportCommon(&out, fset, bundle, shallow, iexportVersion, []*types.Package{pkg}, reportf)
iexport.go#L303: func IImportShallow(fset *token.FileSet, getPackages GetPackagesFunc, data []byte, path string, reportf ReportFunc) (*types.Package, error) {
iexport.go#L325: func IExportData(out io.Writer, fset *token.FileSet, pkg *types.Package) error {
iexport.go#L327: return iexportCommon(out, fset, bundle, shallow, iexportVersion, []*types.Package{pkg}, nil)
iexport.go#L331: func IExportBundle(out io.Writer, fset *token.FileSet, pkgs []*types.Package) error {
iexport.go#L336: func iexportCommon(out io.Writer, fset *token.FileSet, bundle, shallow bool, version int, pkgs []*types.Package, reportf ReportFunc) (err error) {
iexport.go#L361: allPkgs: map[*types.Package]bool{},
iexport.go#L516: pkgObjs := map[*types.Package][]pkgObj{}
iexport.go#L533: var pkgs []*types.Package
iexport.go#L577: localpkg *types.Package // (nil in bundle mode)
iexport.go#L582: allPkgs map[*types.Package]bool
iexport.go#L692: func (w *exportWriter) exportPath(pkg *types.Package) string {
iexport.go#L947: func (w *exportWriter) pkg(pkg *types.Package) {
iexport.go#L966: func (w *exportWriter) typ(t types.Type, pkg *types.Package) {
iexport.go#L980: func (p *iexporter) typOff(t types.Type, pkg *types.Package) uint64 {
iexport.go#L995: func (w *exportWriter) doTyp(t types.Type, pkg *types.Package) {
iexport.go#L1225: func (w *exportWriter) typeList(ts *types.TypeList, pkg *types.Package) {
iexport.go#L1232: func (w *exportWriter) tparamList(prefix string, list *types.TypeParamList, pkg *types.Package) {
iimport.go#L61: pkg *types.Package
iimport.go#L103: func IImportData(fset *token.FileSet, imports map[string]*types.Package, data []byte, path string) (int, *types.Package, error) {
iimport.go#L112: func IImportBundle(fset *token.FileSet, imports map[string]*types.Package, data []byte) ([]*types.Package, error) {
iimport.go#L129: Pkg *types.Package // to be filled in by GetPackagesFunc call
iimport.go#L141: func GetPackagesFromMap(m map[string]*types.Package) GetPackagesFunc {
iimport.go#L155: func iimportCommon(fset *token.FileSet, getPackages GetPackagesFunc, data []byte, bundle bool, path string, shallow bool, reportf ReportFunc) (pkgs []*types.Package, err error) {
iimport.go#L222: pkgCache: make(map[uint64]*types.Package),
iimport.go#L225: pkgIndex: make(map[*types.Package]map[string]uint64),
iimport.go#L284: pkgList := make([]*types.Package, len(items))
iimport.go#L300: pkgs = make([]*types.Package, r.uint64())
iimport.go#L303: imps := make([]*types.Package, r.uint64())
iimport.go#L382: pkgCache map[uint64]*types.Package
iimport.go#L385: pkgIndex map[*types.Package]map[string]uint64
iimport.go#L413: func (p *iimporter) doDecl(pkg *types.Package, name string) {
iimport.go#L505: func (p *iimporter) pkgAt(off uint64) *types.Package {
iimport.go#L554: currPkg *types.Package
iimport.go#L808: func (r *importReader) qualifiedIdent() (*types.Package, string) {
iimport.go#L873: func (r *importReader) pkg() *types.Package { return r.p.pkgAt(r.uint64()) }
iimport.go#L1116: type byPath []*types.Package
ureader_yes.go#L28: imports map[string]*types.Package // previously imported packages, indexed by path
ureader_yes.go#L34: 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#L90: func readUnifiedPackage(fset *token.FileSet, ctxt *types.Context, imports map[string]*types.Package, input pkgbits.PkgDecoder) *types.Package {
ureader_yes.go#L104: pkgs: make([]*types.Package, input.NumElems(pkgbits.RelocPkg)),
ureader_yes.go#L137: var imps []*types.Package
ureader_yes.go#L248: func (r *reader) pkg() *types.Package {
ureader_yes.go#L253: func (pr *pkgReader) pkgIdx(idx pkgbits.Index) *types.Package {
ureader_yes.go#L265: func (r *reader) doPkg() *types.Package {
ureader_yes.go#L496: func (pr *pkgReader) objIdx(idx pkgbits.Index) (*types.Package, string) {
ureader_yes.go#L498: var objPkg *types.Package
ureader_yes.go#L729: func (r *reader) qualifiedIdent() (*types.Package, string) { return r.ident(pkgbits.SyncSym) }
ureader_yes.go#L730: func (r *reader) localIdent() (*types.Package, string) { return r.ident(pkgbits.SyncLocalIdent) }
ureader_yes.go#L731: func (r *reader) selector() (*types.Package, string) { return r.ident(pkgbits.SyncSelector) }
ureader_yes.go#L733: func (r *reader) ident(marker pkgbits.SyncMarker) (*types.Package, string) {
ureader_yes.go#L742: func pkgScope(pkg *types.Package) *types.Scope {
golang.org/x/tools/internal/typesinternal
qualifier.go#L18: func FileQualifier(f *ast.File, pkg *types.Package) types.Qualifier {
qualifier.go#L30: return func(p *types.Package) string {
toonew.go#L19: func TooNewStdSymbols(pkg *types.Package, version string) map[types.Object]string {
types.go#L63: func NameRelativeTo(pkg *types.Package) types.Qualifier {
types.go#L64: return func(other *types.Package) string {