S018

SchemasStandard

check for Schema that should use TypeList with MaxItems: 1

The S018 analyzer reports cases of Schema including MaxItems: 1 and Type: schema.TypeSet that should be simplified to Type: schema.TypeList.

Examples

&schema.Schema{
    MaxItems: 1,
    Type:     schema.TypeSet,
}
&schema.Schema{
    MaxItems: 1,
    Type:     schema.TypeList,
}

Ignoring reports

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

//lintignore:S018
&schema.Schema{
    MaxItems: 1,
    Type:     schema.TypeSet,
}

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