goanalysis

package
v1.53.1 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2023 License: GPL-3.0 Imports: 35 Imported by: 0

Documentation

Overview

Package goanalysis defines the implementation of the checker commands. The same code drives the multi-analysis driver, the single-analysis driver that is conventionally provided for convenience along with each analysis package, and the test driver.

Index

Constants

View Source
const (
	TheOnlyAnalyzerName = "the_only_name"
	TheOnlyanalyzerDoc  = "the_only_doc"
)

Variables

This section is empty.

Functions

func DummyRun added in v1.47.0

func DummyRun(_ *analysis.Pass) (any, error)

func MakeFakeLoaderProgram added in v1.20.0

func MakeFakeLoaderProgram(pass *analysis.Pass) *loader.Program

Types

type Diagnostic added in v1.19.0

type Diagnostic struct {
	analysis.Diagnostic
	Analyzer *analysis.Analyzer
	Position token.Position
	Pkg      *packages.Package
}

type EncodingIssue added in v1.21.0

type EncodingIssue struct {
	FromLinter           string
	Text                 string
	Pos                  token.Position
	LineRange            *result.Range
	Replacement          *result.Replacement
	ExpectNoLint         bool
	ExpectedNoLintLinter string
}

type Fact added in v1.19.0

type Fact struct {
	Path string // non-empty only for object facts
	Fact analysis.Fact
}

type IllTypedError added in v1.20.0

type IllTypedError struct {
	Pkg *packages.Package
}

func (*IllTypedError) Error added in v1.20.0

func (e *IllTypedError) Error() string

type Issue added in v1.21.0

type Issue struct {
	result.Issue
	Pass *analysis.Pass
}

func NewIssue added in v1.21.0

func NewIssue(i *result.Issue, pass *analysis.Pass) Issue

type Linter

type Linter struct {
	// contains filtered or unexported fields
}

func NewLinter

func NewLinter(name, desc string, analyzers []*analysis.Analyzer, cfg map[string]map[string]any) *Linter

func (*Linter) Desc

func (lnt *Linter) Desc() string

func (*Linter) LoadMode added in v1.20.0

func (lnt *Linter) LoadMode() LoadMode

func (*Linter) Name

func (lnt *Linter) Name() string

func (*Linter) Run

func (lnt *Linter) Run(_ context.Context, lintCtx *linter.Context) ([]result.Issue, error)

func (*Linter) UseOriginalPackages added in v1.20.0

func (lnt *Linter) UseOriginalPackages()

func (*Linter) WithContextSetter added in v1.20.0

func (lnt *Linter) WithContextSetter(cs func(*linter.Context)) *Linter

func (*Linter) WithIssuesReporter added in v1.20.0

func (lnt *Linter) WithIssuesReporter(r func(*linter.Context) []Issue) *Linter

func (*Linter) WithLoadMode added in v1.20.0

func (lnt *Linter) WithLoadMode(loadMode LoadMode) *Linter

type LoadMode added in v1.20.0

type LoadMode int
const (
	LoadModeNone LoadMode = iota
	LoadModeSyntax
	LoadModeTypesInfo
	LoadModeWholeProgram
)

func (LoadMode) String added in v1.20.0

func (loadMode LoadMode) String() string

type MetaLinter added in v1.19.0

type MetaLinter struct {
	// contains filtered or unexported fields
}

func NewMetaLinter added in v1.19.0

func NewMetaLinter(linters []*Linter) *MetaLinter

func (MetaLinter) Desc added in v1.19.0

func (ml MetaLinter) Desc() string

func (MetaLinter) Name added in v1.19.0

func (ml MetaLinter) Name() string

func (MetaLinter) Run added in v1.19.0

func (ml MetaLinter) Run(_ context.Context, lintCtx *linter.Context) ([]result.Issue, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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