Documentation
¶
Overview ¶
Package lint provides abstractions on top of go/analysis. These abstractions add extra information to analyzes, such as structured documentation and severities.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExhaustiveTypeSwitch ¶
func ExhaustiveTypeSwitch(v any)
ExhaustiveTypeSwitch panics when called. It can be used to ensure that type switches are exhaustive.
Types ¶
type Analyzer ¶ added in v0.2.0
type Analyzer struct {
// The analyzer's documentation. Unlike go/analysis.Analyzer.Doc,
// this field is structured, providing access to severity, options
// etc.
Doc *RawDocumentation
Analyzer *analysis.Analyzer
}
Analyzer wraps a go/analysis.Analyzer and provides structured documentation.
func InitializeAnalyzer ¶ added in v0.5.0
type Directive ¶
A directive is a comment of the form '//lint:<command> [arguments...]'. It represents instructions to the static analysis tool.
type Documentation ¶
type Documentation struct {
Title string
Text string
TitleMarkdown string
TextMarkdown string
Before string
After string
Since string
NonDefault bool
Options []string
Severity Severity
MergeIf MergeStrategy
}
func (*Documentation) Format ¶ added in v0.3.0
func (doc *Documentation) Format(metadata bool) string
func (*Documentation) FormatMarkdown ¶ added in v0.3.0
func (doc *Documentation) FormatMarkdown(metadata bool) string
func (*Documentation) String ¶
func (doc *Documentation) String() string
type MergeStrategy ¶ added in v0.3.0
type MergeStrategy int
MergeStrategy sets how merge mode should behave for diagnostics of an analyzer.
const ( MergeIfAny MergeStrategy = iota MergeIfAll )
type RawDocumentation ¶ added in v0.3.0
type RawDocumentation struct {
Title string
Text string
Before string
After string
Since string
NonDefault bool
Options []string
Severity Severity
MergeIf MergeStrategy
}
func (RawDocumentation) Compile ¶ added in v0.5.0
func (doc RawDocumentation) Compile() *Documentation
Click to show internal directories.
Click to hide internal directories.