// makeTypeRef return the type reference; including package alias or without package if local.
makeTypeRef return the type reference; including package alias or without package if local.
// makeTypeRef return the type reference ; including package alias or without package if local .
func makeTypeRef(pkgCache *PkgCache, typ types.Type) (string, error) {
	pkgs, err := getTypePkgs(typ)
	if err != nil {
		return "", err
	}
	res := typ.String()
	for _, pkg := range pkgs {
		if pkg.Path() == pkgCache.Local {
			res = strings.ReplaceAll(res, pkg.Path()+".", "")
			continue
		}
		name := pkgCache.Name(pkg)
		if name == "" {
			return "", errors.New("import not found for type", j.MKV{"pkg": pkg})
		}
		res = strings.ReplaceAll(res, pkg.Path(), name)
	}
	return res, nil
}
func makeTypeRef ( pkgCache * PkgCache , typ types . Type ) ( string , error ) { pkgs , err := getTypePkgs ( typ ) if err != nil { return " " , err } res := typ . String ( ) for _ , pkg := range pkgs { if pkg . Path ( ) == pkgCache . Local { res = strings . ReplaceAll ( res , pkg . Path ( ) + " " , " " ) continue } name := pkgCache . Name ( pkg ) if name == " " { return " " , errors . New ( " " , j . MKV { " " : pkg } ) } res = strings . ReplaceAll ( res , pkg . Path ( ) , name ) } return res , nil }
makeTypeRef return the type reference; including package alias or without package if local.
makeTypeRef return the type reference ; including package alias or without package if local .