Skip to content

Latest commit

 

History

History

R005

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

R005

The R005 analyzer reports when multiple HasChange() calls in a conditional can be combined into a single HasChanges() call.

Flagged Code

if d.HasChange("attr1") || d.HasChange("attr2") {
  // handle attr1 and attr2 changes
}

Passing Code

if d.HasChanges("attr1", "attr2") {
  // handle attr1 and attr2 changes
}

Ignoring Reports

Singular reports can be ignored by adding the a //lintignore:R005 Go code comment at the end of the offending line or on the line immediately proceding, e.g.

//lintignore:R005
if d.HasChange("attr1") || d.HasChange("attr2") {
  // handle attr1 and attr2 changes
}