R004

ResourcesStandard

check for ResourceData.Set() calls using incompatible value types

The R004 analyzer reports incorrect types for a Set() call value. The Set() function only supports a subset of basic types, slices and maps of that subset of basic types, and the schema.Set type.

Examples

var t time.Time

d.Set("example", t)
var t time.Time

d.Set("example", t.Format(time.RFC3339))

Ignoring reports

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

var t time.Time

//lintignore:R004
d.Set("example", t)

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