diff --git a/rule/redefines-builtin-id.go b/rule/redefines-builtin-id.go index 23dd85a..b3ff084 100644 --- a/rule/redefines-builtin-id.go +++ b/rule/redefines-builtin-id.go @@ -89,6 +89,9 @@ func (w *lintRedefinesBuiltinID) Visit(node ast.Node) ast.Visitor { case *ast.GenDecl: switch n.Tok { case token.TYPE: + if len(n.Specs) < 1 { + return nil + } typeSpec, ok := n.Specs[0].(*ast.TypeSpec) if !ok { return nil diff --git a/testdata/redefines-builtin-id.go b/testdata/redefines-builtin-id.go index 0593799..22e5975 100644 --- a/testdata/redefines-builtin-id.go +++ b/testdata/redefines-builtin-id.go @@ -29,3 +29,6 @@ var any int // MATCH /redefinition of the built-in type any/ const any = 1 // MATCH /redefinition of the built-in type any/ var i, copy int // MATCH /redefinition of the built-in function copy/ + +// issue #792 +type ()