From c9506b42e5720361854d173366b2e51ca90e543f Mon Sep 17 00:00:00 2001 From: Ross Light Date: Thu, 29 Mar 2018 09:09:09 -0700 Subject: [PATCH] goose: skip function body type-checking Learn this one weird trick to make goose an order of magnitude faster! Reviewed-by: Herbie Ong Reviewed-by: Tuo Shan --- internal/goose/goose.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/internal/goose/goose.go b/internal/goose/goose.go index 79dac72..f94bfa6 100644 --- a/internal/goose/goose.go +++ b/internal/goose/goose.go @@ -25,9 +25,10 @@ func Generate(bctx *build.Context, wd string, pkg string) ([]byte, error) { // TODO(light): allow errors // TODO(light): stop errors from printing to stderr conf := &loader.Config{ - Build: new(build.Context), - ParserMode: parser.ParseComments, - Cwd: wd, + Build: new(build.Context), + ParserMode: parser.ParseComments, + Cwd: wd, + TypeCheckFuncBodies: func(string) bool { return false }, } *conf.Build = *bctx n := len(conf.Build.BuildTags)