AWSR001

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: 6 Imported by: 0

README

AWSR001

The AWSR001 analyzer reports when a fmt.Sprintf() call contains the format string ending .amazonaws.com. This domain suffix is only valid in the AWS Commercial and GovCloud (US) partitions.

To ensure the correct domain suffix is used in all partitions, the *AWSClient available to all resources provides the PartitionHostname() and RegionalHostname() receiver methods.

Flagged Code

fmt.Sprintf("%s.amazonaws.com", d.Id())

fmt.Sprintf("%s.%s.amazonaws.com", d.Id(), meta.(*AWSClient).region)

Passing Code

meta.(*AWSClient).PartitionHostname(d.Id())

meta.(*AWSClient).RegionalHostname(d.Id())

Ignoring Check

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

//lintignore:AWSR001
fmt.Sprintf("%s.amazonaws.com", d.Id())

Documentation

Index

Constants

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

Variables

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