goanalysis

package
v1.23.8 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2020 License: GPL-3.0 Imports: 33 Imported by: 0

Documentation

Overview

Package checker 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

View Source
var (
	Debug = os.Getenv("GL_GOANALYSIS_DEBUG")
)

Functions

func MakeFakeLoaderProgram added in v1.20.0

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

func NeedFacts added in v1.19.0

func NeedFacts(analyzers []*analysis.Analyzer) bool

NeedFacts reports whether any analysis required by the specified set needs facts. If so, we must load the entire program from source.

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
}

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]interface{}) *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(ctx context.Context, lintCtx *linter.Context) ([]result.Issue, error)

func (*Linter) SetTypecheckMode added in v1.20.0

func (lnt *Linter) SetTypecheckMode()

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(ctx 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