Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix issue #792 #793

Merged
merged 1 commit into from
Feb 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 ()