type go/types.Package
185 uses
go/types (current package)
api.go#L91: Import(path string) (*Package, error)
api.go#L117: ImportFrom(path, dir string, mode ImportMode) (*Package, error)
api.go#L484: func (conf *Config) Check(path string, fset *token.FileSet, files []*ast.File, info *Info) (*Package, error) {
check.go#L124: pkg *Package
check.go#L129: impMap map[importKey]*Package // maps (import path, source directory) to (complete or fake) package
check.go#L141: seenPkgMap map[*Package]bool
check.go#L236: func NewChecker(conf *Config, fset *token.FileSet, pkg *Package, info *Info) *Checker {
check.go#L260: 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#L135: func (check *Checker) qualifier(pkg *Package) string {
format.go#L140: check.seenPkgMap = make(map[*Package]bool)
format.go#L154: func (check *Checker) markImports(pkg *Package) {
lookup.go#L40: func LookupSelection(T Type, addressable bool, pkg *Package, name string) (Selection, bool) {
lookup.go#L88: func LookupFieldOrMethod(T Type, addressable bool, pkg *Package, name string) (obj Object, index []int, indirect bool) {
lookup.go#L97: func lookupFieldOrMethod(T Type, addressable bool, pkg *Package, name string, foldCase bool) (obj Object, index []int, indirect bool) {
lookup.go#L147: func lookupFieldOrMethodImpl(T Type, addressable bool, pkg *Package, name string, foldCase bool) (obj Object, index []int, indirect bool) {
lookup.go#L664: 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#L694: 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#L60: sameId(pkg *Package, name string, foldCase bool) bool
object.go#L76: func Id(pkg *Package, name string) string {
object.go#L98: pkg *Package
object.go#L114: func (obj *object) Pkg() *Package { return obj.pkg }
object.go#L139: func (obj *object) sameId(pkg *Package, name string, foldCase bool) bool {
object.go#L207: imported *Package
object.go#L212: func NewPkgName(pos token.Pos, pkg *Package, name string, imported *Package) *PkgName {
object.go#L218: func (obj *PkgName) Imported() *Package { return obj.imported }
object.go#L228: func NewConst(pos token.Pos, pkg *Package, name string, typ Type, val constant.Value) *Const {
object.go#L253: func NewTypeName(pos token.Pos, pkg *Package, name string, typ Type) *TypeName {
object.go#L259: func _NewTypeNameLazy(pos token.Pos, pkg *Package, name string, load func(*Named) ([]*TypeParam, Type, []*Func, []func())) *TypeName {
object.go#L344: func NewVar(pos token.Pos, pkg *Package, name string, typ Type) *Var {
object.go#L352: func NewParam(pos token.Pos, pkg *Package, name string, typ Type) *Var {
object.go#L359: func NewField(pos token.Pos, pkg *Package, name string, typ Type, embedded bool) *Var {
object.go#L367: func newVar(kind VarKind, pos token.Pos, pkg *Package, name string, typ Type) *Var {
object.go#L409: func NewFunc(pos token.Pos, pkg *Package, name string, sig *Signature) *Func {
object.go#L469: func (obj *Func) Pkg() *Package { return obj.object.Pkg() }
object.go#L500: func NewLabel(pos token.Pos, pkg *Package, name string) *Label {
object.go#L622: 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#L226: 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#L202: func (*lazyObject) Pkg() *Package { panic("unreachable") }
scope.go#L212: 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
go.pact.im/x/plumb/internal/discover
provider.go#L28: Types *types.Package
provider.go#L75: Pkg *types.Package // the declaring package
go.pact.im/x/plumb/internal/emit
emit.go#L103: func assignAliases(pkgs []*types.Package, needErrors bool, destPath string, lifted, setNames map[string]bool, dest *solve.DestInfo) (map[string]string, string, []string) {
qual.go#L19: record map[string]*types.Package // path → package (recording mode)
qual.go#L26: return &qualifier{destPath: destPath, record: map[string]*types.Package{}}
qual.go#L35: func (q *qualifier) qualify(p *types.Package) string {
qual.go#L61: func (q *qualifier) recordedPackages() []*types.Package {
qual.go#L62: pkgs := make([]*types.Package, 0, len(q.record))
qual.go#L66: slices.SortFunc(pkgs, func(a, b *types.Package) int { return strings.Compare(a.Path(), b.Path()) })
report.go#L29: return types.TypeString(t, func(p *types.Package) string {
go.pact.im/x/plumb/internal/gotypes
gotypes.go#L196: return types.TypeString(t, func(p *types.Package) string {
go.pact.im/x/plumb/internal/packagestest
packagestest.go#L136: cache: map[string]*types.Package{},
packagestest.go#L178: cache map[string]*types.Package
packagestest.go#L185: func (c *recChecker) Import(path string) (*types.Package, error) {
packagestest.go#L197: func (c *recChecker) check(ip string) (*types.Package, *types.Info, error) {
golang.org/x/exp/apidiff
apidiff.go#L28: func Changes(old, new *types.Package) Report {
apidiff.go#L39: func changesInternal(old, new *types.Package, oldRootPackagePath, newRootPackagePath string) Report {
apidiff.go#L59: oldPkgs := make(map[string]*types.Package)
apidiff.go#L64: newPkgs := make(map[string]*types.Package)
apidiff.go#L92: func packageChange(p *types.Package, change string, compatible bool) Change {
apidiff.go#L103: Packages []*types.Package
apidiff.go#L107: func (m *Module) relativePath(p *types.Package) string {
apidiff.go#L112: old, new *types.Package
apidiff.go#L123: 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#L198: func Write(out io.Writer, fset *token.FileSet, pkg *types.Package) error {
gcexportdata.go#L206: func ReadBundle(in io.Reader, fset *token.FileSet, imports map[string]*types.Package) ([]*types.Package, error) {
gcexportdata.go#L211: func WriteBundle(io.Writer, *token.FileSet, []*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#L508: Types *types.Package `json:"-"`
packages.go#L1209: importer := importerFunc(func(path string) (*types.Package, error) {
packages.go#L1350: type importerFunc func(path string) (*types.Package, error)
packages.go#L1352: func (f importerFunc) Import(path string) (*types.Package, error) { return f(path) }
packages.go#L1543: view := make(map[string]*types.Package) // view seen by gcexportdata
golang.org/x/tools/go/types/objectpath
objectpath.go#L130: pkgIndex map[*types.Package]*pkgIndex
objectpath.go#L135: pkg *types.Package
objectpath.go#L186: pkg *types.Package
objectpath.go#L339: enc.pkgIndex = make(map[*types.Package]*pkgIndex)
objectpath.go#L738: 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/gcimporter
gcimporter.go#L48: 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, 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#L320: func IExportData(out io.Writer, fset *token.FileSet, pkg *types.Package) error {
iexport.go#L322: return iexportCommon(out, fset, shallow, iexportVersion, []*types.Package{pkg}, nil)
iexport.go#L325: func iexportCommon(out io.Writer, fset *token.FileSet, shallow bool, version int, pkgs []*types.Package, reportf ReportFunc) (err error) {
iexport.go#L350: allPkgs: map[*types.Package]bool{},
iexport.go#L480: pkgObjs := map[*types.Package][]pkgObj{}
iexport.go#L497: var pkgs []*types.Package
iexport.go#L540: localpkg *types.Package
iexport.go#L545: allPkgs map[*types.Package]bool
iexport.go#L655: func (w *exportWriter) exportPath(pkg *types.Package) string {
iexport.go#L912: func (w *exportWriter) pkg(pkg *types.Package) {
iexport.go#L939: func (w *exportWriter) typ(t types.Type, pkg *types.Package) {
iexport.go#L956: func (p *iexporter) typOff(t types.Type, pkg *types.Package) uint64 {
iexport.go#L972: func (w *exportWriter) doTyp(t types.Type, pkg *types.Package) {
iexport.go#L1202: func (w *exportWriter) typeList(ts *types.TypeList, pkg *types.Package) {
iexport.go#L1209: func (w *exportWriter) tparamList(prefix string, list *types.TypeParamList, pkg *types.Package) {
iexport.go#L1266: func (w *exportWriter) value(typ types.Type, v constant.Value, pkg *types.Package) {
iimport.go#L53: pkg *types.Package
iimport.go#L95: func IImportData(fset *token.FileSet, imports map[string]*types.Package, data []byte, path string) (*types.Package, error) {
iimport.go#L116: Pkg *types.Package // to be filled in by GetPackagesFunc call
iimport.go#L128: func GetPackagesFromMap(m map[string]*types.Package) GetPackagesFunc {
iimport.go#L142: func iimportCommon(fset *token.FileSet, getPackages GetPackagesFunc, data []byte, path string, shallow bool, reportf ReportFunc) (pkgs []*types.Package, err error) {
iimport.go#L200: pkgCache: make(map[uint64]*types.Package),
iimport.go#L203: pkgIndex: make(map[*types.Package]map[string]uint64),
iimport.go#L262: pkgList := make([]*types.Package, len(items))
iimport.go#L346: pkgCache map[uint64]*types.Package
iimport.go#L349: pkgIndex map[*types.Package]map[string]uint64
iimport.go#L377: func (p *iimporter) doDecl(pkg *types.Package, name string) {
iimport.go#L469: func (p *iimporter) pkgAt(off uint64) *types.Package {
iimport.go#L532: func (r *importReader) obj(pkg *types.Package, name string) {
iimport.go#L780: func (r *importReader) qualifiedIdent() (*types.Package, string) {
iimport.go#L845: func (r *importReader) pkg() *types.Package { return r.p.pkgAt(r.uint64()) }
iimport.go#L1024: func (r *importReader) signature(paramPkg *types.Package, recv *types.Var, rparams []*types.TypeParam, tparams []*types.TypeParam) *types.Signature {
iimport.go#L1045: func (r *importReader) paramList(pkg *types.Package) *types.Tuple {
iimport.go#L1053: func (r *importReader) param(pkg *types.Package) *types.Var {
iimport.go#L1088: type byPath []*types.Package
ureader.go#L28: imports map[string]*types.Package // previously imported packages, indexed by path
ureader.go#L33: pkgs []*types.Package
ureader.go#L67: func UImportData(fset *token.FileSet, imports map[string]*types.Package, data []byte, path string) (_ int, pkg *types.Package, err error) {
ureader.go#L93: func readUnifiedPackage(fset *token.FileSet, ctxt *types.Context, imports map[string]*types.Package, input pkgbits.PkgDecoder) *types.Package {
ureader.go#L106: pkgs: make([]*types.Package, input.NumElems(pkgbits.RelocPkg)),
ureader.go#L139: var imps []*types.Package
ureader.go#L249: func (r *reader) pkg() *types.Package {
ureader.go#L254: func (pr *pkgReader) pkgIdx(idx pkgbits.Index) *types.Package {
ureader.go#L266: func (r *reader) doPkg() *types.Package {
ureader.go#L501: func (pr *pkgReader) objIdx(idx pkgbits.Index) (*types.Package, string) {
ureader.go#L503: var objPkg *types.Package
ureader.go#L821: func (r *reader) qualifiedIdent() (*types.Package, string) { return r.ident(pkgbits.SyncSym) }
ureader.go#L822: func (r *reader) localIdent() (*types.Package, string) { return r.ident(pkgbits.SyncLocalIdent) }
ureader.go#L823: func (r *reader) selector() (*types.Package, string) { return r.ident(pkgbits.SyncSelector) }
ureader.go#L825: func (r *reader) ident(marker pkgbits.SyncMarker) (*types.Package, string) {
ureader.go#L834: func pkgScope(pkg *types.Package) *types.Scope {
golang.org/x/tools/internal/typesinternal
qualifier.go#L26: func FileQualifier(f *ast.File, pkg *types.Package) types.Qualifier {
qualifier.go#L38: return func(p *types.Package) string {
toonew.go#L18: func TooNewStdSymbols(pkg *types.Package, version string) map[types.Object]stdlib.Symbol {
types.go#L77: func NameRelativeTo(pkg *types.Package) types.Qualifier {
types.go#L78: return func(other *types.Package) string {
types.go#L190: func Imports(pkg *types.Package, path string) bool {