S024

SchemasStandard

check for Schema that should omit ForceNew in data source schema attributes

The S024 analyzer reports extraneous usage of ForceNew in data source schema attributes.

Examples

&schema.Resource{
  Read: /* ... */,
  Schema: map[string]*schema.Schema{
    "example": {
      ForceNew: true,
      Required: true,
      Type:     schema.TypeString,
    },
  },
}
&schema.Resource{
  Read: /* ... */,
  Schema: map[string]*schema.Schema{
    "example": {
      Required: true,
      Type:     schema.TypeString,
    },
  },
}

Ignoring reports

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

//lintignore:S024
&schema.Resource{
  Read: /* ... */,
  Schema: map[string]*schema.Schema{
    "example": {
      ForceNew: true,
      Required: true,
      Type:     schema.TypeString,
    },
  },
}

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