goose: skip function body type-checking

Learn this one weird trick to make goose an order of magnitude faster!

Reviewed-by: Herbie Ong <herbie@google.com>
Reviewed-by: Tuo Shan <shantuo@google.com>
This commit is contained in:
Ross Light
2018-03-29 09:09:09 -07:00
parent 34987b6bee
commit c9506b42e5

View File

@@ -25,9 +25,10 @@ func Generate(bctx *build.Context, wd string, pkg string) ([]byte, error) {
// TODO(light): allow errors // TODO(light): allow errors
// TODO(light): stop errors from printing to stderr // TODO(light): stop errors from printing to stderr
conf := &loader.Config{ conf := &loader.Config{
Build: new(build.Context), Build: new(build.Context),
ParserMode: parser.ParseComments, ParserMode: parser.ParseComments,
Cwd: wd, Cwd: wd,
TypeCheckFuncBodies: func(string) bool { return false },
} }
*conf.Build = *bctx *conf.Build = *bctx
n := len(conf.Build.BuildTags) n := len(conf.Build.BuildTags)