R005

ResourcesStandard

check for ResourceData.HasChange() calls that can be combined into one HasChanges() call

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

Examples

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

Ignoring reports

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

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

This page is generated from passes/R005/README.md, which lives beside the analyzer.