Skip to content

Commit

Permalink
fix issue #792 (#793)
Browse files Browse the repository at this point in the history
  • Loading branch information
chavacava committed Feb 18, 2023
1 parent b2bc00b commit 10d4f5f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions rule/redefines-builtin-id.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions testdata/redefines-builtin-id.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 ()

0 comments on commit 10d4f5f

Please sign in to comment.