diff --git a/errcheck/errcheck.go b/errcheck/errcheck.go index a5ee371..220c476 100644 --- a/errcheck/errcheck.go +++ b/errcheck/errcheck.go @@ -167,7 +167,7 @@ func (c *Checker) LoadPackages(paths ...string) ([]*packages.Package, error) { buildFlags = append(buildFlags, fmt.Sprintf("-mod=%s", c.Mod)) } cfg := &packages.Config{ - Mode: packages.LoadAllSyntax, + Mode: packages.NeedSyntax | packages.NeedTypes | packages.NeedTypesInfo, Tests: !c.Exclusions.TestFiles, BuildFlags: buildFlags, } diff --git a/errcheck/errcheck_test.go b/errcheck/errcheck_test.go index 842d86c..d870ed2 100644 --- a/errcheck/errcheck_test.go +++ b/errcheck/errcheck_test.go @@ -39,7 +39,7 @@ func init() { assertMarkers = make(map[marker]bool) cfg := &packages.Config{ - Mode: packages.LoadSyntax, + Mode: packages.NeedSyntax | packages.NeedTypes, Tests: true, } pkgs, err := packages.Load(cfg, testPackage)