code: func findTypeDef(importPath, typeName string) (*ast.TypeSpec, error) {
  	cwd, err := os.Getwd()
  	if err != nil {
  		return nil, err
  	}
  
  	conf := loader.Config{
  		ParserMode: goparser.SpuriousErrors,
  		Cwd:        cwd,
  	}
  
  	conf.Import(importPath)
  
  	lprog, err := conf.Load()
  	if err != nil {
  		return nil, err
  	}
  
  	// If the pkg is vendored, the actual pkg path is going to resemble
  	// something like "{importPath}/vendor/{importPath}"
  	for k := range lprog.AllPackages {
  		realPkgPath := k.Path()
  
  		if strings.Contains(realPkgPath, "vendor/"+importPath) {
  			importPath = realPkgPath
  		}
  	}
  
  	pkgInfo := lprog.Package(importPath)
  
  	if pkgInfo == nil {
  		return nil, errors.New("package was nil")
  	}
  
  	// TODO: possibly cache pkgInfo since it's an expensive operation
  
  	for i := range pkgInfo.Files {
  		for _, astDeclaration := range pkgInfo.Files[i].Decls {
  			if generalDeclaration, ok := astDeclaration.(*ast.GenDecl); ok && generalDeclaration.Tok == token.TYPE {
  				for _, astSpec := range generalDeclaration.Specs {
  					if typeSpec, ok := astSpec.(*ast.TypeSpec); ok {
  						if typeSpec.Name.String() == typeName {
  							return typeSpec, nil
  						}
  					}
  				}
  			}
  		}
  	}
  	return nil, errors.New("type spec not found")
  }
docs: // findTypeDef attempts to find the *ast.TypeSpec for a specific type given the
  // type's name and the package's import path
  // TODO: improve finding external pkg