Hang on to the type information even when the typechecker fails.
diff --git a/lint.go b/lint.go
index e3957d0..177321e 100644
--- a/lint.go
+++ b/lint.go
@@ -217,9 +217,8 @@
astFiles = append(astFiles, f.f)
}
pkg, err := config.Check(anyFile.f.Name.Name, p.fset, astFiles, info)
- if err != nil {
- return err
- }
+ // Remember the typechecking info, even if config.Check failed,
+ // since we will get partial information.
p.typesPkg = pkg
p.typesInfo = info
return err
diff --git a/testdata/var-decl.go b/testdata/var-decl.go
index 897e370..978433d 100644
--- a/testdata/var-decl.go
+++ b/testdata/var-decl.go
@@ -4,11 +4,13 @@
package foo
import "fmt"
+import "net/http"
// Q is a test type.
type Q bool
-var myInt int = 7 // MATCH /should.*int.*myInt.*inferred/
+var myInt int = 7 // MATCH /should.*int.*myInt.*inferred/
+var mux *http.ServeMux = http.NewServeMux() // MATCH /should.*\*http\.ServeMux.*inferred/
var myZeroInt int = 0 // MATCH /should.*= 0.*myZeroInt.*zero value/
var myZeroFlt float32 = 0. // MATCH /should.*= 0\..*myZeroFlt.*zero value/