S023

SchemasStandard

check for Schema that should omit Elem with incompatible Type

The S023 analyzer reports cases of schema including Elem that should be removed with incompatible Type.

Examples

&schema.Schema{
  Elem: &schema.Schema{},
  Type: TypeBool,
}

&schema.Schema{
  Elem: &schema.Schema{},
  Type: TypeFloat,
}

&schema.Schema{
  Elem: &schema.Schema{},
  Type: TypeInt,
}

&schema.Schema{
  Elem: &schema.Schema{},
  Type: TypeString,
}
&schema.Schema{
  Type: TypeBool,
}

&schema.Schema{
  Type: TypeFloat,
}

&schema.Schema{
  Type: TypeInt,
}

&schema.Schema{
  Type: TypeString,
}

Ignoring reports

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

//lintignore:S023
&schema.Schema{
  Elem: &schema.Schema{},
  Type: TypeBool,
}

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