AWSV001

package
v0.0.0-...-724c62b Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2022 License: MPL-2.0 Imports: 5 Imported by: 0

README

AWSV001

The AWSV001 analyzer reports when a validation.StringInSlice() call has the first parameter of a []string, which suggests either that AWS API model constants are not available or that the usage is prior to the AWS Go SDK adding functions that return all values for the enumeration type.

If the API model constants are not available, this check can be ignored but it is recommended to submit an AWS Support case to the AWS service team for adding the constants.

If the elements of the string slice are AWS Go SDK constants, this check reports when the parameter should be switched to the newer AWS Go SDK ENUM_Values() function.

Flagged Code

&schema.Schema{
    ValidateFunc: validation.StringInSlice([]string{
        service.EnumTypeExample1,
        service.EnumTypeExample2,
    }, false),
}

Passing Code

&schema.Schema{
    ValidateFunc: validation.StringInSlice(service.EnumType_Values(), false),
}

Ignoring Check

The check can be ignored for a certain line via a //lintignore:AWSV001 comment on the previous line or at the end of the offending line, e.g.

//lintignore:AWSV001
ValidateFunc: validation.StringInSlice([]string{
    service.EnumTypeExample1,
    service.EnumTypeExample2,
}, false),

Documentation

Index

Constants

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

Variables

View Source
var Analyzer = &analysis.Analyzer{
	Name: analyzerName,
	Doc:  Doc,
	Requires: []*analysis.Analyzer{
		commentignore.Analyzer,
		stringinslicecallexpr.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