oracle: skip cgo processing for queries that don't need SSA/PTA
This makes type-based queries faster and more robust because they needn't invoke a C compiler, at the cost of worse results in/near .go files that import "C". It's particularly important for "referrers" since a refererrs query on a name from the standard library can load every package in the workspace. Fixes issue 10347 Change-Id: I2f65474ce963de5c0897ba67eeb26290dd449cf1 Reviewed-on: https://go-review.googlesource.com/8493 Reviewed-by: David Crawshaw <crawshaw@golang.org>
This commit is contained in:
parent
8a9ac1b806
commit
f0d8175b3e
|
|
@ -278,6 +278,9 @@ func parseQueryPos(lprog *loader.Program, posFlag string, needExact bool) (*quer
|
|||
// allowErrors causes type errors to be silently ignored.
|
||||
// (Not suitable if SSA construction follows.)
|
||||
func allowErrors(lconf *loader.Config) {
|
||||
ctxt := *lconf.Build // copy
|
||||
ctxt.CgoEnabled = false
|
||||
lconf.Build = &ctxt
|
||||
lconf.AllowErrors = true
|
||||
lconf.TypeChecker.Error = func(err error) {}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue