type go/types.Package
191 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#L490: func (conf *Config) Check(path string, fset *token.FileSet, files []*ast.File, info *Info) (*Package, error) {
check.go#L162: pkg *Package
check.go#L167: impMap map[importKey]*Package // maps (import path, source directory) to (complete or fake) package
check.go#L179: seenPkgMap map[*Package]bool
check.go#L302: func NewChecker(conf *Config, fset *token.FileSet, pkg *Package, info *Info) *Checker {
check.go#L329: 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#L37: func LookupSelection(T Type, addressable bool, pkg *Package, name string) (Selection, bool) {
lookup.go#L85: func LookupFieldOrMethod(T Type, addressable bool, pkg *Package, name string) (obj Object, index []int, indirect bool) {
lookup.go#L94: func lookupFieldOrMethod(T Type, addressable bool, pkg *Package, name string, foldCase bool) (obj Object, index []int, indirect bool) {
lookup.go#L144: func lookupFieldOrMethodImpl(T Type, addressable bool, pkg *Package, name string, foldCase bool) (obj Object, index []int, indirect bool) {
lookup.go#L653: func fieldIndex(fields []*Var, pkg *Package, name string, foldCase bool) int {
lookup.go#L666: 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#L690: 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#L408: func NewFunc(pos token.Pos, pkg *Package, name string, sig *Signature) *Func {
object.go#L468: func (obj *Func) Pkg() *Package { return obj.object.Pkg() }
object.go#L499: func NewLabel(pos token.Pos, pkg *Package, name string) *Label {
object.go#L621: 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#L216: func (*lazyObject) Pkg() *Package { panic("unreachable") }
scope.go#L226: 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#L26: func Changes(old, new *types.Package) Report {
apidiff.go#L37: func changesInternal(old, new *types.Package, oldRootPackagePath, newRootPackagePath string) Report {
apidiff.go#L57: oldPkgs := make(map[string]*types.Package)
apidiff.go#L62: newPkgs := make(map[string]*types.Package)
apidiff.go#L88: func packageChange(p *types.Package, change string, compatible bool) Change {
apidiff.go#L99: Packages []*types.Package
apidiff.go#L103: func (m *Module) relativePath(p *types.Package) string {
apidiff.go#L108: old, new *types.Package
apidiff.go#L120: 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#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#L129: pkgIndex map[*types.Package]*pkgIndex
objectpath.go#L134: pkg *types.Package
objectpath.go#L185: pkg *types.Package
objectpath.go#L333: enc.pkgIndex = make(map[*types.Package]*pkgIndex)
objectpath.go#L727: 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#L14: func New(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#L278: func IExportShallow(fset *token.FileSet, pkg *types.Package, reportf ReportFunc) ([]byte, error) {
iexport.go#L286: err := iexportCommon(&out, fset, bundle, shallow, iexportVersion, []*types.Package{pkg}, reportf)
iexport.go#L302: func IImportShallow(fset *token.FileSet, getPackages GetPackagesFunc, data []byte, path string, reportf ReportFunc) (*types.Package, error) {
iexport.go#L324: func IExportData(out io.Writer, fset *token.FileSet, pkg *types.Package) error {
iexport.go#L326: return iexportCommon(out, fset, bundle, shallow, iexportVersion, []*types.Package{pkg}, nil)
iexport.go#L330: func IExportBundle(out io.Writer, fset *token.FileSet, pkgs []*types.Package) error {
iexport.go#L335: func iexportCommon(out io.Writer, fset *token.FileSet, bundle, shallow bool, version int, pkgs []*types.Package, reportf ReportFunc) (err error) {
iexport.go#L360: allPkgs: map[*types.Package]bool{},
iexport.go#L515: pkgObjs := map[*types.Package][]pkgObj{}
iexport.go#L532: var pkgs []*types.Package
iexport.go#L575: localpkg *types.Package // (nil in bundle mode)
iexport.go#L580: allPkgs map[*types.Package]bool
iexport.go#L690: func (w *exportWriter) exportPath(pkg *types.Package) string {
iexport.go#L947: func (w *exportWriter) pkg(pkg *types.Package) {
iexport.go#L975: func (w *exportWriter) typ(t types.Type, pkg *types.Package) {
iexport.go#L989: func (p *iexporter) typOff(t types.Type, pkg *types.Package) uint64 {
iexport.go#L1005: func (w *exportWriter) doTyp(t types.Type, pkg *types.Package) {
iexport.go#L1235: func (w *exportWriter) typeList(ts *types.TypeList, pkg *types.Package) {
iexport.go#L1242: func (w *exportWriter) tparamList(prefix string, list *types.TypeParamList, pkg *types.Package) {
iimport.go#L62: pkg *types.Package
iimport.go#L104: func IImportData(fset *token.FileSet, imports map[string]*types.Package, data []byte, path string) (int, *types.Package, error) {
iimport.go#L113: func IImportBundle(fset *token.FileSet, imports map[string]*types.Package, data []byte) ([]*types.Package, error) {
iimport.go#L130: Pkg *types.Package // to be filled in by GetPackagesFunc call
iimport.go#L142: func GetPackagesFromMap(m map[string]*types.Package) GetPackagesFunc {
iimport.go#L156: 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#L381: pkgCache map[uint64]*types.Package
iimport.go#L384: pkgIndex map[*types.Package]map[string]uint64
iimport.go#L412: func (p *iimporter) doDecl(pkg *types.Package, name string) {
iimport.go#L504: func (p *iimporter) pkgAt(off uint64) *types.Package {
iimport.go#L567: func (r *importReader) obj(pkg *types.Package, name string) {
iimport.go#L810: func (r *importReader) qualifiedIdent() (*types.Package, string) {
iimport.go#L875: func (r *importReader) pkg() *types.Package { return r.p.pkgAt(r.uint64()) }
iimport.go#L1054: func (r *importReader) signature(paramPkg *types.Package, recv *types.Var, rparams []*types.TypeParam, tparams []*types.TypeParam) *types.Signature {
iimport.go#L1075: func (r *importReader) paramList(pkg *types.Package) *types.Tuple {
iimport.go#L1083: func (r *importReader) param(pkg *types.Package) *types.Var {
iimport.go#L1118: type byPath []*types.Package
ureader.go#L29: imports map[string]*types.Package // previously imported packages, indexed by path
ureader.go#L34: pkgs []*types.Package
ureader.go#L68: func UImportData(fset *token.FileSet, imports map[string]*types.Package, data []byte, path string) (_ int, pkg *types.Package, err error) {
ureader.go#L94: func readUnifiedPackage(fset *token.FileSet, ctxt *types.Context, imports map[string]*types.Package, input pkgbits.PkgDecoder) *types.Package {
ureader.go#L107: pkgs: make([]*types.Package, input.NumElems(pkgbits.RelocPkg)),
ureader.go#L140: var imps []*types.Package
ureader.go#L250: func (r *reader) pkg() *types.Package {
ureader.go#L255: func (pr *pkgReader) pkgIdx(idx pkgbits.Index) *types.Package {
ureader.go#L267: func (r *reader) doPkg() *types.Package {
ureader.go#L502: func (pr *pkgReader) objIdx(idx pkgbits.Index) (*types.Package, string) {
ureader.go#L504: var objPkg *types.Package
ureader.go#L781: func (r *reader) qualifiedIdent() (*types.Package, string) { return r.ident(pkgbits.SyncSym) }
ureader.go#L782: func (r *reader) localIdent() (*types.Package, string) { return r.ident(pkgbits.SyncLocalIdent) }
ureader.go#L783: func (r *reader) selector() (*types.Package, string) { return r.ident(pkgbits.SyncSelector) }
ureader.go#L785: func (r *reader) ident(marker pkgbits.SyncMarker) (*types.Package, string) {
ureader.go#L794: 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#L19: func TooNewStdSymbols(pkg *types.Package, version string) map[types.Object]string {
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 {