Skip to content

Latest commit

 

History

History
30 lines (22 loc) · 854 Bytes

README.md

File metadata and controls

30 lines (22 loc) · 854 Bytes

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
}