visitor

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2025 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoInspectorResult = errors.New("zerolint: inspector result missing")

ErrNoInspectorResult is returned when the ast inspector is missing.

Functions

This section is empty.

Types

type Options added in v0.0.8

type Options struct {
	Level     level.LintLevel
	Excludes  set.Set[string]
	Generated bool
	Regex     *regexp.Regexp
}

Options defines configurable parameters for the linter.

type Visitor

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

Visitor is an AST visitor for analyzing the usage of pointers to zero-sized types. It identifies various patterns where such pointers might be used unnecessarily.

func New added in v0.0.8

func New(opt Options) *Visitor

New creates a new Visitor configured with the provided Options.

func (*Visitor) AllDetected added in v0.0.8

func (v *Visitor) AllDetected() iter.Seq[string]

AllDetected returns a sorted iterator over all detected zero-sized types.

func (*Visitor) HasDetected added in v0.0.8

func (v *Visitor) HasDetected() bool

HasDetected tells whether any zero-sized types have been detected during analysis.

func (*Visitor) Run added in v0.0.8

func (v *Visitor) Run(pass *analysis.Pass) (any, error)

Run performs the actual analysis on the provided analysis.Pass.

Jump to

Keyboard shortcuts

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