mirror of
https://github.com/mgechev/revive.git
synced 2025-11-25 22:12:38 +02:00
fix: avoid false positive for blank identifier (#1376)
The fact that the error variable is not used is out of the scope of the rule This pattern that can be found in benchmarks and examples. It should be allowed.
This commit is contained in:
@@ -61,6 +61,17 @@ func (w lintErrors) Visit(_ ast.Node) ast.Visitor {
|
||||
}
|
||||
|
||||
id := spec.Names[0]
|
||||
if id.Name == "_" {
|
||||
// avoid false positive for blank identifier
|
||||
|
||||
// The fact that the error variable is not used
|
||||
// is out of the scope of the rule
|
||||
|
||||
// This pattern that can be found in benchmarks and examples
|
||||
// should be allowed.
|
||||
continue
|
||||
}
|
||||
|
||||
prefix := "err"
|
||||
if id.IsExported() {
|
||||
prefix = "Err"
|
||||
|
||||
Reference in New Issue
Block a user