R019

ResourcesStandard

check for (*schema.ResourceData).HasChanges() receiver method usage with many arguments

The R019 analyzer reports when there are a large number of arguments being passed to (*schema.ResourceData).HasChanges(), which it may be preferable to use (*schema.ResourceData).HasChangesExcept() instead.

Options

Namespaced under the check ID on the command line, as -R019.threshold=VALUE.

Flag Default Effect
threshold 5 Number of arguments before a report is emitted

Examples

d.HasChanges("attr1", "attr2", "attr3", "attr4", "attr5")
d.HasChangesExcept("metadata_attr")

Ignoring reports

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

//lintignore:R019
d.HasChanges("attr1", "attr2", "attr3", "attr4", "attr5")

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