Documentation ¶
Overview ¶
Package common contains constants, functions, and types that are used in more than one linter.
Index ¶
Constants ¶
const DocFilenameWithoutPath = "doc"
DocFilenameWithoutPath is the name of a file that can potentially hold a package document as opposed to a file of the same name as the package.
const FuncInit = "init"
FuncInit is a constant denoting the name of the "init" function that can exist in any package of a Go program.
const FuncMain = "main"
FuncMain is a constant denoting the name of the "main" function that exists in packageMain of a Go program.
const PackageMain = "main"
PackageMain is a constant denoting the name of the "main" package in a Go program.
Variables ¶
This section is empty.
Functions ¶
func IsGenerated ¶
IsGenerated determines if the given file is a generated file.
Developer note: Periodically check whether or not this functionality is exposed in a stdlib package by looking at the status of this accepted proposal:
https://github.com/golang/go/issues/28089
Whenever it's added in a stdlib package, use that instead of this because it's likely going to have been implemented in a manner that is a lot smarter than this implementation.
func IsTestFile ¶
IsTestFile returns true if the filename is either test_*.go or *_test.go.
func IsTestPackage ¶
IsTestPackage determines whether or not the package for the current pass is a test package. The analysis.Analyzer is already smart enough to ignore "*_test.go" files, but sometimes there are explicit packages only meant to be used in tests. These are, or at least should be, suffixed with "test" (usually "_test").
func LoadOtherFilesIntoFset ¶
LoadOtherFilesIntoFset loads all files found in *analysis.Pass.OtherFiles into the Fset in *analysis.Pass.
Types ¶
This section is empty.