func (p *Packagist) Inspect(patterns ...string) (TypeMap, error) {
	if p.PackageLoaderFunc == nil {
		p.PackageLoaderFunc = packages.Load
	}
	if p.PathFilterFunc == nil {
		p.PathFilterFunc = func(string) bool { return true }
	}
	if p.typeMap = make(TypeMap); len(patterns) == 0 {
		return p.typeMap, nil
	}
	pkgs, err := p.load(patterns...)
	if err != nil {
		return nil, err
	}
	for _, pkg := range pkgs {
		p.filter(pkg)
	}
	return p.typeMap, nil
}
Inspect finds matching types in the packages named by the given patterns.
package internal
import (
	"errors"
	"go/token"
	"go/types"
	"strings"
	"golang.org/x/tools/go/packages"
)
type (
	Packagist struct {
		PackageLoaderFunc PackageLoaderFunc
		PathFilterFunc    PathFilterFunc
		IncludeUnexported bool
		IncludeTestFiles  bool
		typeMap TypeMap
	}
	PackageLoaderFunc func(*packages.Config, ...string) ([]*packages.Package, error)
	PathFilterFunc func(string) bool
	PathReplaceFunc func(string) string
	QualifierFunc func(p types.Package) string
	TypeMap map[string]types.Type
)