Update for API change in golang.org/x/tools/go/types.
Fixes #91.
Signed-off-by: David Symonds <dsymonds@golang.org>
diff --git a/lint.go b/lint.go
index ed45646..45a65ef 100644
--- a/lint.go
+++ b/lint.go
@@ -1398,11 +1398,11 @@
// Re-evaluate expr outside of its context to see if it's untyped.
// (An expr evaluated within, for example, an assignment context will get the type of the LHS.)
- typ, _, err := types.EvalNode(f.fset, expr, f.pkg.typesPkg, scope)
+ tv, err := types.EvalNode(f.fset, expr, f.pkg.typesPkg, scope)
if err != nil {
return "", false
}
- if b, ok := typ.(*types.Basic); ok {
+ if b, ok := tv.Type.(*types.Basic); ok {
if dt, ok := basicTypeKinds[b.Kind()]; ok {
return dt, true
}
diff --git a/lint_test.go b/lint_test.go
index 3999458..cd81449 100644
--- a/lint_test.go
+++ b/lint_test.go
@@ -230,13 +230,13 @@
}
// Use the first child scope of the package, which will be the file scope.
scope := pkg.Scope().Child(0)
- typ, _, err := types.Eval(test.typString, pkg, scope)
+ tv, err := types.Eval(test.typString, pkg, scope)
if err != nil {
t.Errorf("types.Eval(%q): %v", test.typString, err)
continue
}
- if got := exportedType(typ); got != test.exp {
- t.Errorf("exportedType(%v) = %t, want %t", typ, got, test.exp)
+ if got := exportedType(tv.Type); got != test.exp {
+ t.Errorf("exportedType(%v) = %t, want %t", tv.Type, got, test.exp)
}
}
}