goanalysis

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: May 6, 2024 License: GPL-3.0 Imports: 34 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

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

Types

type Diagnostic

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

type EncodingIssue

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

type Fact

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

type Issue

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

func NewIssue

func NewIssue(issue *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

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

func (lnt *Linter) UseOriginalPackages()

func (*Linter) WithContextSetter

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

func (*Linter) WithIssuesReporter

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

func (*Linter) WithLoadMode

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

type LoadMode

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

func (LoadMode) String

func (loadMode LoadMode) String() string

type MetaLinter

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

func NewMetaLinter

func NewMetaLinter(linters []*Linter) *MetaLinter

func (MetaLinter) Desc

func (MetaLinter) Desc() string

func (MetaLinter) Name

func (MetaLinter) Name() string

func (MetaLinter) Run

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