Hi, I'm working on some codegen logic which uses a file's AST to generate some functions. I want to find the zero values of certain identifier types, and to do this, I need underlying types of these indentifiers.
So I use go's type checker, however it takes a very long time for it to completely type-check a package (a comparatively large package as compared to other packages in the source code). The whole source code takes about 30s to build but about 1 minute to type-check a large package.
I'm using the importer which loads the program from source:
conf := types.Config{Importer: importer.ForCompiler(fset, "source", nil)}
info := &types.Info{
Uses: make(map[*ast.Ident]types.Object),
}
_, err := conf.Check(pkgPath, fset, fileAST, info)
Seems like I'm missing something here. Any help would be great!
Thanks