S022

package
v0.26.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 26, 2021 License: MPL-2.0 Imports: 4 Imported by: 2

README

S022

The S022 analyzer reports cases of schema that declare Elem of *schema.Resource with TypeMap, which has undefined behavior. Only TypeList and TypeSet can be used for configuration block attributes.

Flagged Code

&schema.Schema{
  Type: schema.TypeMap,
  Elem: &schema.Resource{},
}

Passing Code

&schema.Schema{
  Type: schema.TypeList,
  Elem: &schema.Resource{},
}

// or

&schema.Schema{
  Type: schema.TypeSet,
  Elem: &schema.Resource{},
}

// or

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

Ignoring Reports

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

//lintignore:S022
&schema.Schema{
  Type: schema.TypeMap,
  Elem: &schema.Resource{},
}

Documentation

Overview

Package S022 defines an Analyzer that checks for Schema of TypeMap with invalid Elem of *schema.Resource

Index

Constants

View Source
const Doc = `` /* 264-byte string literal not displayed */

Variables

View Source
var Analyzer = &analysis.Analyzer{
	Name: analyzerName,
	Doc:  Doc,
	Requires: []*analysis.Analyzer{
		schemainfo.Analyzer,
		commentignore.Analyzer,
	},
	Run: run,
}

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL